官方网站开发模板网站seo如何做

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

官方网站开发模板,网站seo如何做,工地招聘网站,wordpress 分类目录小工具文章目录 1. 概念1.1 角色1.2 类图 2. 代码示例2.1 设计2.1 代码2.2 类图 1. 概念 客户端调用桥接接口实现原有功能和扩展功能的组合 1.1 角色 Implementor#xff08;实施者#xff09;#xff1a; 具体实施者的抽象#xff0c;可以是一个接口。 Concrete Implementor实施者 具体实施者的抽象可以是一个接口。 Concrete Implementor具体实施者 可以理解为扩展之前的原有功能桥接接口会在实现扩展功能的基础上调用它实现这些原有功能 Abstraction抽象化 我们可以理解为桥接接口它在提供扩展功能的同时也桥接了原有功能的接口为Refined Abstraction提供一个统一接口它关联了Implementor或者进一步是Implementor的聚合 Refined Abstraction扩展抽象化 可以理解为它实现了具体的扩展功能并实际调用了mplementor接口完成了原有功能
1.2 类图 #mermaid-svg-uManuL1dgEtIGHIK {font-family:“trebuchet ms”,verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-uManuL1dgEtIGHIK .error-icon{fill:#552222;}#mermaid-svg-uManuL1dgEtIGHIK .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-uManuL1dgEtIGHIK .edge-thickness-normal{stroke-width:2px;}#mermaid-svg-uManuL1dgEtIGHIK .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-uManuL1dgEtIGHIK .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-uManuL1dgEtIGHIK .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-uManuL1dgEtIGHIK .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-uManuL1dgEtIGHIK .marker{fill:#333333;stroke:#333333;}#mermaid-svg-uManuL1dgEtIGHIK .marker.cross{stroke:#333333;}#mermaid-svg-uManuL1dgEtIGHIK svg{font-family:“trebuchet ms”,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-uManuL1dgEtIGHIK g.classGroup text{fill:#9370DB;fill:#131300;stroke:none;font-family:“trebuchet ms”,verdana,arial,sans-serif;font-size:10px;}#mermaid-svg-uManuL1dgEtIGHIK g.classGroup text .title{font-weight:bolder;}#mermaid-svg-uManuL1dgEtIGHIK .nodeLabel,#mermaid-svg-uManuL1dgEtIGHIK .edgeLabel{color:#131300;}#mermaid-svg-uManuL1dgEtIGHIK .edgeLabel .label rect{fill:#ECECFF;}#mermaid-svg-uManuL1dgEtIGHIK .label text{fill:#131300;}#mermaid-svg-uManuL1dgEtIGHIK .edgeLabel .label span{background:#ECECFF;}#mermaid-svg-uManuL1dgEtIGHIK .classTitle{font-weight:bolder;}#mermaid-svg-uManuL1dgEtIGHIK .node rect,#mermaid-svg-uManuL1dgEtIGHIK .node circle,#mermaid-svg-uManuL1dgEtIGHIK .node ellipse,#mermaid-svg-uManuL1dgEtIGHIK .node polygon,#mermaid-svg-uManuL1dgEtIGHIK .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-uManuL1dgEtIGHIK .divider{stroke:#9370DB;stroke:1;}#mermaid-svg-uManuL1dgEtIGHIK g.clickable{cursor:pointer;}#mermaid-svg-uManuL1dgEtIGHIK g.classGroup rect{fill:#ECECFF;stroke:#9370DB;}#mermaid-svg-uManuL1dgEtIGHIK g.classGroup line{stroke:#9370DB;stroke-width:1;}#mermaid-svg-uManuL1dgEtIGHIK .classLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5;}#mermaid-svg-uManuL1dgEtIGHIK .classLabel .label{fill:#9370DB;font-size:10px;}#mermaid-svg-uManuL1dgEtIGHIK .relation{stroke:#333333;stroke-width:1;fill:none;}#mermaid-svg-uManuL1dgEtIGHIK .dashed-line{stroke-dasharray:3;}#mermaid-svg-uManuL1dgEtIGHIK #compositionStart,#mermaid-svg-uManuL1dgEtIGHIK .composition{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-uManuL1dgEtIGHIK #compositionEnd,#mermaid-svg-uManuL1dgEtIGHIK .composition{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-uManuL1dgEtIGHIK #dependencyStart,#mermaid-svg-uManuL1dgEtIGHIK .dependency{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-uManuL1dgEtIGHIK #dependencyStart,#mermaid-svg-uManuL1dgEtIGHIK .dependency{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-uManuL1dgEtIGHIK #extensionStart,#mermaid-svg-uManuL1dgEtIGHIK .extension{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-uManuL1dgEtIGHIK #extensionEnd,#mermaid-svg-uManuL1dgEtIGHIK .extension{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-uManuL1dgEtIGHIK #aggregationStart,#mermaid-svg-uManuL1dgEtIGHIK .aggregation{fill:#ECECFF!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-uManuL1dgEtIGHIK #aggregationEnd,#mermaid-svg-uManuL1dgEtIGHIK .aggregation{fill:#ECECFF!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-uManuL1dgEtIGHIK .edgeTerminals{font-size:11px;}#mermaid-svg-uManuL1dgEtIGHIK :root{–mermaid-font-family:“trebuchet ms”,verdana,arial,sans-serif;} «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 color2.2 类图 #mermaid-svg-DCyd0CuexcZHBRZQ {font-family:“trebuchet ms”,verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-DCyd0CuexcZHBRZQ .error-icon{fill:#552222;}#mermaid-svg-DCyd0CuexcZHBRZQ .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-DCyd0CuexcZHBRZQ .edge-thickness-normal{stroke-width:2px;}#mermaid-svg-DCyd0CuexcZHBRZQ .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-DCyd0CuexcZHBRZQ .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-DCyd0CuexcZHBRZQ .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-DCyd0CuexcZHBRZQ .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-DCyd0CuexcZHBRZQ .marker{fill:#333333;stroke:#333333;}#mermaid-svg-DCyd0CuexcZHBRZQ .marker.cross{stroke:#333333;}#mermaid-svg-DCyd0CuexcZHBRZQ svg{font-family:“trebuchet ms”,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-DCyd0CuexcZHBRZQ g.classGroup text{fill:#9370DB;fill:#131300;stroke:none;font-family:“trebuchet ms”,verdana,arial,sans-serif;font-size:10px;}#mermaid-svg-DCyd0CuexcZHBRZQ g.classGroup text .title{font-weight:bolder;}#mermaid-svg-DCyd0CuexcZHBRZQ .nodeLabel,#mermaid-svg-DCyd0CuexcZHBRZQ .edgeLabel{color:#131300;}#mermaid-svg-DCyd0CuexcZHBRZQ .edgeLabel .label rect{fill:#ECECFF;}#mermaid-svg-DCyd0CuexcZHBRZQ .label text{fill:#131300;}#mermaid-svg-DCyd0CuexcZHBRZQ .edgeLabel .label span{background:#ECECFF;}#mermaid-svg-DCyd0CuexcZHBRZQ .classTitle{font-weight:bolder;}#mermaid-svg-DCyd0CuexcZHBRZQ .node rect,#mermaid-svg-DCyd0CuexcZHBRZQ .node circle,#mermaid-svg-DCyd0CuexcZHBRZQ .node ellipse,#mermaid-svg-DCyd0CuexcZHBRZQ .node polygon,#mermaid-svg-DCyd0CuexcZHBRZQ .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-DCyd0CuexcZHBRZQ .divider{stroke:#9370DB;stroke:1;}#mermaid-svg-DCyd0CuexcZHBRZQ g.clickable{cursor:pointer;}#mermaid-svg-DCyd0CuexcZHBRZQ g.classGroup rect{fill:#ECECFF;stroke:#9370DB;}#mermaid-svg-DCyd0CuexcZHBRZQ g.classGroup line{stroke:#9370DB;stroke-width:1;}#mermaid-svg-DCyd0CuexcZHBRZQ .classLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5;}#mermaid-svg-DCyd0CuexcZHBRZQ .classLabel .label{fill:#9370DB;font-size:10px;}#mermaid-svg-DCyd0CuexcZHBRZQ .relation{stroke:#333333;stroke-width:1;fill:none;}#mermaid-svg-DCyd0CuexcZHBRZQ .dashed-line{stroke-dasharray:3;}#mermaid-svg-DCyd0CuexcZHBRZQ #compositionStart,#mermaid-svg-DCyd0CuexcZHBRZQ .composition{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-DCyd0CuexcZHBRZQ #compositionEnd,#mermaid-svg-DCyd0CuexcZHBRZQ .composition{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-DCyd0CuexcZHBRZQ #dependencyStart,#mermaid-svg-DCyd0CuexcZHBRZQ .dependency{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-DCyd0CuexcZHBRZQ #dependencyStart,#mermaid-svg-DCyd0CuexcZHBRZQ .dependency{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-DCyd0CuexcZHBRZQ #extensionStart,#mermaid-svg-DCyd0CuexcZHBRZQ .extension{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-DCyd0CuexcZHBRZQ #extensionEnd,#mermaid-svg-DCyd0CuexcZHBRZQ .extension{fill:#333333!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-DCyd0CuexcZHBRZQ #aggregationStart,#mermaid-svg-DCyd0CuexcZHBRZQ .aggregation{fill:#ECECFF!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-DCyd0CuexcZHBRZQ #aggregationEnd,#mermaid-svg-DCyd0CuexcZHBRZQ .aggregation{fill:#ECECFF!important;stroke:#333333!important;stroke-width:1;}#mermaid-svg-DCyd0CuexcZHBRZQ .edgeTerminals{font-size:11px;}#mermaid-svg-DCyd0CuexcZHBRZQ :root{–mermaid-font-family:“trebuchet ms”,verdana,arial,sans-serif;} «interface» Color Use() Red Use() Green Use() Yellow Use() «interface» BrushPen DrawPicture() BigBrushPen Color DrawPicture() SmallBrushPen Color DrawPicture() Client