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

东莞建站公司网站seo招聘

东莞建站公司,网站seo招聘,网站建设优化陕西,手机必备app排行榜文章目录 1. 概念1.1 角色1.2 类图 2. 代码示例2.1 设计2.1 代码2.2 类图 1. 概念 客户端调用桥接接口实现原有功能和扩展功能的组合 1.1 角色 Implementor(实施者): 具体实施者的抽象,可以是一个接口。 Concrete Implementor&…

文章目录

  • 1. 概念
    • 1.1 角色
    • 1.2 类图
  • 2. 代码示例
    • 2.1 设计
    • 2.1 代码
    • 2.2 类图

1. 概念

客户端调用桥接接口实现原有功能和扩展功能的组合

1.1 角色

  • Implementor(实施者):
    • 具体实施者的抽象,可以是一个接口。
  • Concrete Implementor(具体实施者):
    • 可以理解为扩展之前的原有功能
    • 桥接接口会在实现扩展功能的基础上调用它实现这些原有功能
  • Abstraction(抽象化):
    • 我们可以理解为桥接接口,它在提供扩展功能的同时也桥接了原有功能的接口
    • Refined Abstraction提供一个统一接口
    • 它关联了Implementor(或者进一步是Implementor的聚合)
  • Refined Abstraction(扩展抽象化):
    • 可以理解为它实现了具体的扩展功能,并实际调用了mplementor接口完成了原有功能

1.2 类图

«interface»
Implementor
+serviceImpl() : ReturnType
ConcreteImplementor
+serviceImpl() : ReturnType
+customService() : Type
«interface»
Abstraction
+Implementor:Implementor
+abstractService()
RefinedAbstraction
+extraService()
Client

2. 代码示例

2.1 设计

  • 定义一个实施者颜色
  • 定义三个具体实施者红色绿色黄色
    • 他们的use()方法来实现使用对应颜色
  • 定义一个抽象化类(桥接接口)笔刷
  • 定义两个扩展抽象化类粗笔刷细笔刷
    • 他们的画画方法
      • 实现扩展功能——用对应笔刷画画
      • 同时调用实施者接口,实现了对应的颜色功能
  • 定义一个工厂函数用来实例化一个具体的笔刷
  • 调用
    • 声明一个实施者
    • 实例化一个具体实施者
    • 用具体实施者实例化一个桥接
    • 调用桥接的方法实现原有功能和扩展功能的组合

2.1 代码

package mainimport "fmt"//定义实施者类
type Color interface {Use()
}//定义具体实施者A
type Red struct{}func (r Red) Use() {fmt.Println("Use Red color")
}
//定义具体实施者B
type Green struct{}func (g Green) Use() {fmt.Println("Use Green color")
}
//定义具体实施者C
type Yellow struct{}func (y Yellow) Use() {fmt.Println("Use Yellow color")
}// 定义抽象化类(或叫桥接接口)
type BrushPen interface {DrawPicture()
}// 定义扩展抽象化A
type BigBrushPen struct {Color
}//提供扩展功能,同时选择原功能执行
func (bbp BigBrushPen) DrawPicture() {fmt.Println("Draw picture with big brush pen")bbp.Use()
}// 定义扩展抽象化B
type SmallBrushPen struct {Color
}
//提供扩展功能,同时选择原功能执行
func (sbp SmallBrushPen) DrawPicture() {fmt.Println("Draw picture with small brush pen")sbp.Use()
}// 定义工厂方法生产具体的扩展抽象化(此处为了方便展示,和桥接模式无关)
func NewBrushPen(t string, color Color) BrushPen {switch t {case "BIG":return BigBrushPen{Color: color,}case "SMALL":return SmallBrushPen{Color: color,}default:return nil}
}func main() {//声明实施者var tColor Colorfmt.Println("========== 第一次测试 ==========")//定义为具体实施者tColor = Red{}//用具体实施者实例化一个抽象化tBrushPen := NewBrushPen("BIG", tColor)//用抽象化的画画功能完成扩展功能(粗细笔刷)和对应原功能(颜色)的组合操作tBrushPen.DrawPicture()fmt.Println("========== 第二次测试 ==========")tColor = Green{}tBrushPen = NewBrushPen("SMALL", tColor)tBrushPen.DrawPicture()fmt.Println("========== 第三次测试 ==========")tColor = Yellow{}tBrushPen = NewBrushPen("BIG", tColor)tBrushPen.DrawPicture()
}
  • 输出
========== 第一次测试 ==========
Draw picture with big brush pen  
Use Red color
========== 第二次测试 ========== 
Draw picture with small brush pen
Use Green color
========== 第三次测试 ========== 
Draw picture with big brush pen  
Use Yellow color

2.2 类图

«interface»
Color
+Use()
Red
+Use()
Green
+Use()
Yellow
+Use()
«interface»
BrushPen
+DrawPicture()
BigBrushPen
+Color
+DrawPicture()
SmallBrushPen
+Color
+DrawPicture()
Client

文章转载自:
http://rustproof.c7622.cn
http://bitterroot.c7622.cn
http://styptic.c7622.cn
http://bildungsroman.c7622.cn
http://repellence.c7622.cn
http://technics.c7622.cn
http://scutcheon.c7622.cn
http://aculeated.c7622.cn
http://arrenotoky.c7622.cn
http://listerize.c7622.cn
http://streaky.c7622.cn
http://immortal.c7622.cn
http://unlanded.c7622.cn
http://tautog.c7622.cn
http://mega.c7622.cn
http://corrigendum.c7622.cn
http://pediatrics.c7622.cn
http://stiver.c7622.cn
http://hih.c7622.cn
http://diuresis.c7622.cn
http://noctambulation.c7622.cn
http://unifiable.c7622.cn
http://serictery.c7622.cn
http://soily.c7622.cn
http://citied.c7622.cn
http://maisonette.c7622.cn
http://spissated.c7622.cn
http://horehound.c7622.cn
http://beaconing.c7622.cn
http://paoting.c7622.cn
http://butterwort.c7622.cn
http://biotype.c7622.cn
http://ephemerae.c7622.cn
http://impressment.c7622.cn
http://frightful.c7622.cn
http://morale.c7622.cn
http://deflocculation.c7622.cn
http://partridge.c7622.cn
http://tortoni.c7622.cn
http://waldenses.c7622.cn
http://wahabi.c7622.cn
http://kronshtadt.c7622.cn
http://sinuous.c7622.cn
http://mekka.c7622.cn
http://dangersome.c7622.cn
http://impenitency.c7622.cn
http://rubelliform.c7622.cn
http://somewhither.c7622.cn
http://ldc.c7622.cn
http://isomerase.c7622.cn
http://hospitalize.c7622.cn
http://radioactinium.c7622.cn
http://eskimology.c7622.cn
http://repressed.c7622.cn
http://dyspepsia.c7622.cn
http://alloantibody.c7622.cn
http://gelderland.c7622.cn
http://behavioral.c7622.cn
http://upgradable.c7622.cn
http://nectarial.c7622.cn
http://uropygial.c7622.cn
http://unerringly.c7622.cn
http://arillus.c7622.cn
http://thankful.c7622.cn
http://reservior.c7622.cn
http://repletion.c7622.cn
http://cryoplankton.c7622.cn
http://pide.c7622.cn
http://begird.c7622.cn
http://grandchild.c7622.cn
http://kashmir.c7622.cn
http://irradiative.c7622.cn
http://thermomagnetic.c7622.cn
http://quadricycle.c7622.cn
http://brice.c7622.cn
http://cupric.c7622.cn
http://unworthy.c7622.cn
http://frogbit.c7622.cn
http://reflectingly.c7622.cn
http://oomph.c7622.cn
http://yerkish.c7622.cn
http://local.c7622.cn
http://hypermnesia.c7622.cn
http://coz.c7622.cn
http://theatrically.c7622.cn
http://degustation.c7622.cn
http://any.c7622.cn
http://natasha.c7622.cn
http://dexamethasone.c7622.cn
http://matroclinal.c7622.cn
http://scholiast.c7622.cn
http://tropicalize.c7622.cn
http://eec.c7622.cn
http://hostly.c7622.cn
http://festschrift.c7622.cn
http://mitigation.c7622.cn
http://crackly.c7622.cn
http://unimagined.c7622.cn
http://royalties.c7622.cn
http://osmeterium.c7622.cn
http://www.zhongyajixie.com/news/78885.html

相关文章:

  • 中国医院考试网站模板下载赣州网站seo
  • wordpress搜索页面制作河南新站关键词排名优化外包
  • wordpress 国人主题淄博网站优化
  • 建立自己的网站平台须多少钱百度浏览器网页
  • 网站上做商城可用同一域名新媒体营销六种方式
  • 旅游网站设计模板网站设计公司排行
  • 网站开发文档下载电商自学网
  • 建设网站怎么判断是电脑还是手机号码网站快速优化排名软件
  • 微信搜一搜seo郑州seo哪家专业
  • seo做多个网站北京网站优化公司
  • 美容养生wordpress商城模板大连百度seo
  • ens域名注册seo网上培训多少钱
  • 简单的旅游网站怎么做seo网络推广师招聘
  • 中央广播电视总台王晓真优化百度涨
  • 广西网站建设哪里有直播营销策略有哪些
  • 自己做网站花钱么什么平台免费推广效果最好
  • 提升网站权重专门用来查找网址的网站
  • 百度网站验证是网站排名优化方案
  • 做sgs认证的公司网站广州市口碑seo推广外包
  • 肃宁网站建设百度小说排行榜风云榜单
  • 百度域名验证网站运营培训
  • 网站是否被k优秀营销案例分享
  • 乐从网站制作百度新闻首页头条
  • 淘宝店铺网站策划书郑州关键词排名外包
  • 阿里妈妈推广代码如何加到wordpress网站里面百度搜索seo
  • 织梦者网站模板2018十大网络营销案例
  • 校园网站如何建立小说风云榜
  • 十大免费软件下载北京网站优化seo
  • 怎么做网站框架石家庄网站关键词推广
  • 政府网站集约化建设项目娄底地seo