-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase_location.go
56 lines (44 loc) · 1.17 KB
/
base_location.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package main
import "errors"
type Location interface {
GetButtonTitle() string
GetHeader() string
GetDescription() string
Link(Location)
GetLinkedLocations() []Location
Enter(*State)
}
type BaseLocation struct {
Header string
ButtonTitle string
Description string
LinkedLocations []Location
LinkedActions []Action
}
func (location *BaseLocation) Link(nextLocation Location) {
if nextLocation == nil {
panic(errors.New("NEXTLOCATION = NIL"))
}
location.LinkedLocations = append(location.LinkedLocations, nextLocation)
}
func (location *BaseLocation) GetLinkedLocations() []Location {
return location.LinkedLocations
}
func (location *BaseLocation) LinkAction(nextAction Action) {
location.LinkedActions = append(location.LinkedActions, nextAction)
}
func (location *BaseLocation) GetLinkedActions() []Action {
return location.LinkedActions
}
func (location *BaseLocation) GetButtonTitle() string {
return location.ButtonTitle
}
func (location *BaseLocation) GetHeader() string {
return location.Header
}
func (location *BaseLocation) GetDescription() string {
return location.Description
}
func (location *BaseLocation) Enter(*State) {
// noop
}