example

package
v0.0.0-...-8d22ec3 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 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 Component

type Component interface {
	Execute()
}

组件接口

type Composite

type Composite struct {
	// contains filtered or unexported fields
}

组件的组合

func NewComposite

func NewComposite() *Composite

创建一个新的组合对象

func (*Composite) Add

func (c *Composite) Add(component Component)

将一个新组件添加到组合中

func (*Composite) Execute

func (c *Composite) Execute()

遍历复合子对象

type Leaf

type Leaf struct {
	// contains filtered or unexported fields
}

叶节点,用于描述层次结构中的原始叶节点对象

func NewLeaf

func NewLeaf(value int) *Leaf

创建一个新的叶节点对象

func (*Leaf) Execute

func (l *Leaf) Execute()

打印叶节点对象的值

Jump to

Keyboard shortcuts

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