摘要: public class 中介者模式 { public static void main(String[] args) { Mediator mediator=new ConcreteMediator(); ColleagueA colleagueA=new ColleagueA(mediator) 阅读全文
posted @ 2023-10-31 22:23 辞楠 阅读(17) 评论(0) 推荐(0)
摘要: import java.util.ArrayList; import java.util.List; public class 访问者结构 { public static void main(String[] args) { Visit visit1=new VisitA(); Visit visi 阅读全文
posted @ 2023-10-31 21:32 辞楠 阅读(18) 评论(0) 推荐(0)
摘要: public class 策略模式 { public static void main(String[] args) { Strategy add=new ConcreteStrategyA(); Strategy sub=new ConcreteStrategyB(); Strategy mult 阅读全文
posted @ 2023-10-31 19:31 辞楠 阅读(17) 评论(0) 推荐(0)
摘要: public class 状态模式 { public static void main(String[] args) { Context context=new Context(); context.Request(); context.Request(); context.Request(); / 阅读全文
posted @ 2023-10-31 17:37 辞楠 阅读(16) 评论(0) 推荐(0)
摘要: import java.util.ArrayList; import java.util.List; public class 观察者模式 { public static void main(String[] args) { Subject subjectA = new ConcreteSubjec 阅读全文
posted @ 2023-10-31 16:31 辞楠 阅读(17) 评论(0) 推荐(0)
摘要: public class 命令模式 { public static void main(String[] args) { Tv tv=new Tv(); Command onCommand=new OnCommand(tv); Command offCommand=new OffCommand(tv 阅读全文
posted @ 2023-10-31 15:15 辞楠 阅读(17) 评论(0) 推荐(0)