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

有网站前台如何做后台百度网盘帐号登录入口

有网站前台如何做后台,百度网盘帐号登录入口,查询网站是否做301,哪有专做注册小网站的1 组合模式: 整体-部分模式,它是一种将对象组合成树状层次结构的模式,用来表示整体和部分的关系,使用户对单个对象和组合对象具有一致的访问性,属于结构型设计模式 1.1 特点: 组合模式使得客户端代码可以一致的处理单个对象和组合对象更容易在组合体内加入新的对象,客户端不…

1 组合模式:

整体-部分模式,它是一种将对象组合成树状层次结构的模式,用来表示整体和部分的关系,使用户对单个对象和组合对象具有一致的访问性,属于结构型设计模式

1.1 特点:

  1. 组合模式使得客户端代码可以一致的处理单个对象和组合对象
  2. 更容易在组合体内加入新的对象,客户端不会因为加入新的对象而改变原代码,满足''开闭原则''

1.2 缺点:

  1. 设计较复杂,客户端需要花更多的时间理清类之间的关系
  2. 不容易限制容器中的构建
  3. 不容易用继承的方法来增加构件的新功能 

1.3 结构:

  1. 抽象构件角色:
  2. 树叶构件角色:
  3. 树枝构件角色/中间构件: 

1.4 组合模式分为透明式的组合模式和安全式的组合模式。 

  1. 透明式:抽象构件声明了所有子类中的全部方法,客户端无需区别树叶对象和树枝对象
  2. 安全式:将管理子构件的方法移到树枝构件中,抽象构件和树叶构件没有对子对象的管理方法

1.5 代码实现

透明模式

public class CompositePattern {public static void main(String[] args) {Component c0 = new Composite();Component c1 = new Composite();Component leaf1 = new Leaf("1");Component leaf2 = new Leaf("2");Component leaf3 = new Leaf("3");c0.add(leaf1);c0.add(c1);c1.add(leaf2);c1.add(leaf3);c0.operation();}
}
//抽象构件
interface Component {public void add(Component c);public void remove(Component c);public Component getChild(int i);public void operation();
}
//树叶构件
class Leaf implements Component {private String name;public Leaf(String name) {this.name = name;}public void add(Component c) {}public void remove(Component c) {}public Component getChild(int i) {return null;}public void operation() {System.out.println("树叶" + name + ":被访问!");}
}
//树枝构件
class Composite implements Component {private ArrayList<Component> children = new ArrayList<Component>();public void add(Component c) {children.add(c);}public void remove(Component c) {children.remove(c);}public Component getChild(int i) {return children.get(i);}public void operation() {for (Object obj : children) {((Component) obj).operation();}}
}
树叶1:被访问!
树叶2:被访问!
树叶3:被访问!

安全模式

interface Component {public void operation();
}
public class CompositePattern {public static void main(String[] args) {Composite c0 = new Composite();Composite c1 = new Composite();Component leaf1 = new Leaf("1");Component leaf2 = new Leaf("2");Component leaf3 = new Leaf("3");c0.add(leaf1);c0.add(c1);c1.add(leaf2);c1.add(leaf3);c0.operation();}
}

http://www.wangmingla.cn/news/126278.html

相关文章:

  • 化工网站模板长尾关键词挖掘精灵官网
  • 如何把网站免费做靠前最简短的培训心得
  • 微信辅助做单网站seo优化外包顾问
  • 食品销售公司网站制作品牌推广的步骤和技巧
  • 十大房地产公司排行榜宁波关键词排名优化
  • 网站域名需icp备案seo分析工具
  • 旅游网站建设方案的总结推广方案流程
  • 织梦如何做响应式手机网站seo免费推广软件
  • 网站文件验证seo关键词优化推荐
  • 聊城做网站推广费用如何建立网站平台
  • 网页设计公司简约搜索引擎网站优化推广
  • 网站服务器安全部署收录优美图片
  • 重庆网站制作定制网络营销论文5000字
  • 做网站开发所需的知识技能旅游网站的网页设计
  • 北京微信网站开发百度指数购买
  • 在线网站推广工具seo推广和百度推广的区别
  • 做银行应该关注的网站国际热点新闻
  • 高端网站设计制作方法建一个网站大概需要多少钱
  • 15年做哪个网站致富北京软件开发公司
  • 对电子商务网站建设与管理的理解网络卖货平台有哪些
  • 零下一度网站建设今日新闻消息
  • 做网站购买域名之后营销推广方式有哪些
  • 织梦系统网站模板修改网络推广官网首页
  • 南宁网站建设 超薄网络品牌推广方案模板
  • 德阳网站建设绍兴seo排名收费
  • ab客外贸营销郑州seo网络营销
  • 网站开发子账号百度平台
  • 个人网站怎么命名网站制作
  • 秦皇岛市 网站建设网站关键字优化软件
  • 做进化树的在线网站站长网站