example

package
v0.0.0-...-05962f3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConcreteElementA

type ConcreteElementA struct {
}

具体元素A

func (*ConcreteElementA) Accept

func (t *ConcreteElementA) Accept(v Visitor)

Accept 接受访问者

func (*ConcreteElementA) FeatureA

func (t *ConcreteElementA) FeatureA() string

具体元素A的方法

type ConcreteElementB

type ConcreteElementB struct {
}

具体元素B

func (*ConcreteElementB) Accept

func (t *ConcreteElementB) Accept(v Visitor)

Accept 接受访问者

func (*ConcreteElementB) FeatureB

func (t *ConcreteElementB) FeatureB() string

具体元素B的方法

type ConcreteVisitorA

type ConcreteVisitorA struct {
}

具体访问者A

func (*ConcreteVisitorA) VisitConcreteElementA

func (v *ConcreteVisitorA) VisitConcreteElementA(e *ConcreteElementA)

具体访问者A的方法

func (*ConcreteVisitorA) VisitConcreteElementB

func (v *ConcreteVisitorA) VisitConcreteElementB(e *ConcreteElementB)

具体访问者A的方法

type ConcreteVisitorB

type ConcreteVisitorB struct {
}

具体访问者B

func (*ConcreteVisitorB) VisitConcreteElementA

func (v *ConcreteVisitorB) VisitConcreteElementA(e *ConcreteElementA)

具体访问者B的方法

func (*ConcreteVisitorB) VisitConcreteElementB

func (v *ConcreteVisitorB) VisitConcreteElementB(e *ConcreteElementB)

具体访问者B的方法

type Element

type Element interface {
	Accept(v Visitor)
}

元素定义了一个接受访问者的接口

type Visitor

type Visitor interface {
	VisitConcreteElementA(e *ConcreteElementA)
	VisitConcreteElementB(e *ConcreteElementB)
}

访问者接口

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL