MCPcopy Create free account
hub / github.com/SolarLune/masterplan / Head

Method Head

stack.go:137–154  ·  view source on GitHub ↗

Head returns the rest of the Stack from this Card up (excluding this Card). The slice is sorted vertically, starting with the top of the stack.

()

Source from the content-addressed store, hash-verified

135
136// Head returns the rest of the Stack from this Card up (excluding this Card). The slice is sorted vertically, starting with the top of the stack.
137func (stack *Stack) Head() []*Card {
138 rest := []*Card{}
139
140 above := stack.Above
141 tested := map[*Card]bool{}
142 for above != nil {
143 if _, exists := tested[above]; exists {
144 break
145 }
146 rest = append(rest, above)
147 tested[above] = true
148 above = above.Stack.Above
149 }
150
151 sort.Slice(rest, func(i, j int) bool { return rest[i].Rect.Y < rest[j].Rect.Y })
152
153 return rest
154}
155
156// Tail returns the rest of the Stack from this Card down (excluding this Card). The slice is sorted vertically, starting with the top of the stack.
157func (stack *Stack) Tail() []*Card {

Callers 6

PostUpdateMethod · 0.95
TopNumberableMethod · 0.95
TopMethod · 0.95
IndexMethod · 0.95
AllMethod · 0.95
UpdateMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected