当前位置: 首页 > news >正文

没疫情的19个城市成都官网seo费用

没疫情的19个城市,成都官网seo费用,如何建设自己的网站 知乎,客服外包怎么找项目文章目录 一、组合模式定义二、例子2.1 菜鸟教程例子2.1.1 创建 Employee 类,该类带有 Employee 对象的列表。2.1.2 使用 Employee 类来创建和打印员工的层次结构。 2.2 JDK源码——java.awt.Container2.3 Spring源码——CompositeCacheManager 三、其他设计模式 一…

文章目录

  • 一、组合模式定义
  • 二、例子
    • 2.1 菜鸟教程例子
      • 2.1.1 创建 Employee 类,该类带有 Employee 对象的列表。
      • 2.1.2 使用 Employee 类来创建和打印员工的层次结构。
    • 2.2 JDK源码——java.awt.Container
    • 2.3 Spring源码——CompositeCacheManager
  • 三、其他设计模式

一、组合模式定义

类型: 结构型模式
介绍: 一种树形结构。它又叫部分整体模式,是用于把一组相似的对象当作一个单一的对象。
目的: 组合模式依据树形结构来组合对象,用来表示部分以及整体层次。

二、例子

2.1 菜鸟教程例子

2.1.1 创建 Employee 类,该类带有 Employee 对象的列表。

public class Employee {private String name;private String dept;private int salary;private List<Employee> subordinates;//构造函数public Employee(String name,String dept, int sal) {this.name = name;this.dept = dept;this.salary = sal;subordinates = new ArrayList<Employee>();}public void add(Employee e) {subordinates.add(e);}public void remove(Employee e) {subordinates.remove(e);}public List<Employee> getSubordinates(){return subordinates;}public String toString(){return ("Employee :[ Name : "+ name +", dept : "+ dept + ", salary :"+ salary+" ]");}   
}

2.1.2 使用 Employee 类来创建和打印员工的层次结构。

public class CompositePatternDemo {public static void main(String[] args) {Employee CEO = new Employee("John","CEO", 30000);Employee headSales = new Employee("Robert","Head Sales", 20000);Employee headMarketing = new Employee("Michel","Head Marketing", 20000);Employee clerk1 = new Employee("Laura","Marketing", 10000);Employee clerk2 = new Employee("Bob","Marketing", 10000);Employee salesExecutive1 = new Employee("Richard","Sales", 10000);Employee salesExecutive2 = new Employee("Rob","Sales", 10000);CEO.add(headSales);CEO.add(headMarketing);headSales.add(salesExecutive1);headSales.add(salesExecutive2);headMarketing.add(clerk1);headMarketing.add(clerk2);//打印该组织的所有员工System.out.println(CEO); for (Employee headEmployee : CEO.getSubordinates()) {System.out.println(headEmployee);for (Employee employee : headEmployee.getSubordinates()) {System.out.println(employee);}}        }
}

2.2 JDK源码——java.awt.Container

public class Container extends Component {private java.util.List<Component> component = new ArrayList<>();public Component getComponent(int n) {try {return component.get(n);} catch (IndexOutOfBoundsException z) {throw new ArrayIndexOutOfBoundsException("No such child: " + n);}}public Component add(Component comp) {addImpl(comp, null, -1);return comp;}}

2.3 Spring源码——CompositeCacheManager

public class CompositeCacheManager implements CacheManager, InitializingBean {private final List<CacheManager> cacheManagers = new ArrayList();@Nullablepublic Cache getCache(String name) {Iterator var2 = this.cacheManagers.iterator();Cache cache;do {if (!var2.hasNext()) {return null;}CacheManager cacheManager = (CacheManager)var2.next();cache = cacheManager.getCache(name);} while(cache == null);return cache;}
}

三、其他设计模式

创建型模式
结构型模式

  • 1、设计模式——装饰器模式(Decorator Pattern)+ Spring相关源码

行为型模式

  • 1、设计模式——访问者模式(Visitor Pattern)+ Spring相关源码
  • 2、设计模式——中介者模式(Mediator Pattern)+ JDK相关源码
  • 3、设计模式——策略模式(Strategy Pattern)+ Spring相关源码
  • 4、设计模式——状态模式(State Pattern)
  • 5、设计模式——命令模式(Command Pattern)+ Spring相关源码
  • 6、设计模式——观察者模式(Observer Pattern)+ Spring相关源码
  • 7、设计模式——备忘录模式(Memento Pattern)
  • 8、设计模式——模板方法模式(Template Pattern)+ Spring相关源码
  • 9、设计模式——迭代器模式(Iterator Pattern)+ Spring相关源码
  • 10、设计模式——责任链模式(Chain of Responsibility Pattern)+ Spring相关源码
  • 11、设计模式——解释器模式(Interpreter Pattern)+ Spring相关源码
http://www.15wanjia.com/news/53098.html

相关文章:

  • 高端网站建设磐石网络好安卓优化大师手机版下载
  • 集团网站建设服务公司c++线上培训机构哪个好
  • 网站建设方案书下载济南seo
  • 做wish如何利用数据网站在线收录
  • 关于做情侣的网站的图片大全网站搜索系统
  • 武汉建站中心制作网站的公司有哪些
  • 微网站需网络营销的四种方式
  • 企业网站用户群郑州网站制作公司哪家好
  • 网络广告营销成功案例百度seo规则
  • 网站开发一定要用框架嘛今天的新闻联播
  • 蓬莱做网站案例4p营销理论
  • 一品威客做任务要给网站钱吗seo是什么意思如何实现
  • 建e网设计案例什么优化
  • 网站怎么做网页游戏自己有网站怎么推广
  • 工业做网站个人怎么接外贸订单
  • 网站建设设计设计网络推广工作内容
  • 国外网站内容去哪些平台做百度大搜
  • cdn如何做网站备案seo是什么专业
  • 二手站网站怎做徐州seo网站推广
  • 濮阳网络诈骗2最新消息东莞关键词优化推广
  • 网站备案多个域名备案单上填几个如何建立自己的网页
  • 网站的设计与开发的图片武汉网站推广优化
  • 怎样在网站上做链接湖南省人民政府
  • 宠物电商网站模板品牌策划公司哪家好
  • 常州网站建设开发场景营销
  • python语言基础seo外包靠谱
  • 客户网站做供应商自荐有用吗高明公司搜索seo
  • 外国人做的汉字网站如何免费注册一个网站
  • 沈阳做网站 0诚金网络专业百度权重10的网站
  • 国家企业信息查询网站磁力猫torrentkitty官网