MCPcopy Create free account
hub / github.com/copernet/copernicus / Insert

Method Insert

util/stack.go:66–77  ·  view source on GitHub ↗
(index int, value interface{})

Source from the content-addressed store, hash-verified

64}
65
66func (s *Stack) Insert(index int, value interface{}) bool {
67 if index > s.Size()-1 || index < 0 {
68 return false
69 }
70
71 lastArray := make([]interface{}, 0)
72 lastArray = append(lastArray, s.array[index:]...)
73 s.array = s.array[:index]
74 s.array = append(s.array, value)
75 s.array = append(s.array, lastArray...)
76 return true
77}
78
79func (s *Stack) Top(i int) interface{} {
80 stackLen := s.Size()

Callers 2

TestStackFunction · 0.95
EvalScriptFunction · 0.80

Calls 1

SizeMethod · 0.95

Tested by 1

TestStackFunction · 0.76