Documentation
¶
Overview ¶
Package structural describes structural design patterns. The design patterns described are all related to composition.
Index ¶
- type Adaptee
- type Adapter
- type BasicTimeImp
- type CarAccessories
- type CarBody
- type CarEngine
- type CarFacade
- type CarModel
- type CivilianTime
- type CivilianTimeImp
- type Component
- type Composite
- type Flyweight
- type FlyweightFactory
- type ITask
- type Leaf
- type ProxyTask
- type Target
- type Task
- type TaskFunc
- type Time
- type TimeImp
- type ZuluTime
- type ZuluTimeImp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adaptee ¶
type Adaptee struct { }
Adaptee defines the old interface which needs to be adapted.
func (*Adaptee) SpecificExecute ¶
func (a *Adaptee) SpecificExecute()
SpecificExecute defines the old interface for executing which needs to be adapted to the new interface defined by Target.
type BasicTimeImp ¶
type BasicTimeImp struct {
// contains filtered or unexported fields
}
BasicTimeImp defines a TimeImp which tells the time in 24 hour format.
type CarAccessories ¶
type CarAccessories struct { }
CarAccessories is the fourth car subsystem which describes the car accessories.
func NewCarAccessories ¶
func NewCarAccessories() *CarAccessories
NewCarAccessories creates new car accessories.
func (*CarAccessories) SetAccessories ¶
func (c *CarAccessories) SetAccessories()
SetAccessories sets the car accessories and logs.
type CarBody ¶
type CarBody struct { }
CarBody is the third car subsystem which describes the car body.
type CarEngine ¶
type CarEngine struct { }
CarEngine is the second car subsystem which describes the car engine.
type CarFacade ¶
type CarFacade struct {
// contains filtered or unexported fields
}
CarFacade describes the car facade which provides a simplified interface to create a car.
func (*CarFacade) CreateCompleteCar ¶
func (c *CarFacade) CreateCompleteCar()
CreateCompleteCar creates a new complete car.
type CarModel ¶
type CarModel struct { }
CarModel is the first car subsystem which describes the car model.
type CivilianTime ¶
type CivilianTime struct {
Time
}
CivilianTime is a time with a civilian time implementation.
type CivilianTimeImp ¶
type CivilianTimeImp struct { BasicTimeImp // contains filtered or unexported fields }
CivilianTimeImp defines a TimeImp which tells the time in 12 hour format with meridem.
func (*CivilianTimeImp) Tell ¶
func (t *CivilianTimeImp) Tell()
Tell tells the time in 12 hour format.
type Component ¶
type Component interface {
Traverse()
}
Component describes the behavior that needs to be exercised uniformly across all primitive and composite objects.
type Composite ¶
type Composite struct {
// contains filtered or unexported fields
}
Composite describes a composite of components.
type Flyweight ¶
type Flyweight struct {
Name string
}
Flyweight is a flyweight object which can be shared to support large numbers of objects efficiently.
func NewFlyweight ¶
NewFlyweight creates a new Flyweight object.
type FlyweightFactory ¶
type FlyweightFactory struct {
// contains filtered or unexported fields
}
FlyweightFactory is a factory for creating and storing flyweights.
func NewFlyweightFactory ¶
func NewFlyweightFactory() *FlyweightFactory
NewFlyweightFactory creates a new FlyweightFactory.
func (*FlyweightFactory) GetFlyweight ¶
func (f *FlyweightFactory) GetFlyweight(name string) *Flyweight
GetFlyweight gets or creates a flyweight depending on whether a flyweight of the same name already exists.
type ITask ¶
type ITask interface {
Execute(taskType string)
}
ITask is an interface for performing tasks.
type Leaf ¶
type Leaf struct {
// contains filtered or unexported fields
}
Leaf describes a primitive leaf object in the hierarchy.
type ProxyTask ¶
type ProxyTask struct {
// contains filtered or unexported fields
}
ProxyTask represents a proxy task with re-routes tasks.
func NewProxyTask ¶
func NewProxyTask() *ProxyTask
NewProxyTask creates a new instance of a ProxyTask.
type TaskFunc ¶
TaskFunc represents a function to perform a task.
func LogDecorate ¶
LogDecorate decorates a task functions execution with some logging.
type Time ¶
type Time struct {
// contains filtered or unexported fields
}
Time is the base struct for Time containing the implementation.
func NewCivilianTime ¶
NewCivilianTime creates a new civilian time.
func NewZuluTime ¶
NewZuluTime creates a new Zulu time.
type TimeImp ¶
type TimeImp interface {
Tell()
}
TimeImp is the interface for different implementations of telling the time.
func NewBasicTimeImp ¶
NewBasicTimeImp creates a new TimeImp.
func NewCivilianTimeImp ¶
NewCivilianTimeImp creates a new TimeImp.
func NewZuluTimeImp ¶
NewZuluTimeImp creates a new TimeImp.
type ZuluTimeImp ¶
type ZuluTimeImp struct { BasicTimeImp // contains filtered or unexported fields }
ZuluTimeImp defines a TimeImp which tells the time in Zulu zone format.
func (*ZuluTimeImp) Tell ¶
func (t *ZuluTimeImp) Tell()
Tell tells the time in 24 hour format in Zulu time zone.