-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
sequence.go
39 lines (28 loc) · 1.08 KB
/
sequence.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
package core
var (
_ = []MutableLengthSequence{(*List)(nil), (*ByteSlice)(nil), (*RuneSlice)(nil)}
_ Sequence = (*Array)(nil)
)
// A Sequence is a sequence of Inox values, it is not necessarily mutable.
type Sequence interface {
Indexable
slice(start, end int) Sequence
}
// A MutableSequence is a mutable sequence of Inox values, the number of elements cannot be necessarily changed.
type MutableSequence interface {
Sequence
// after the modification, set should inform the watchers about a mutation of kind SetElemAtIndex
// if the MutableSequence is watchable.
set(ctx *Context, i int, v Value)
SetSlice(ctx *Context, start, end int, v Sequence)
}
type MutableLengthSequence interface {
MutableSequence
// after the insertion, insertElement should inform the watchers about a mutation of kind InsertElemAtIndex
// if the MutableLengthSequence is watchable.
insertElement(ctx *Context, v Value, i Int)
removePosition(ctx *Context, i Int)
removePositionRange(ctx *Context, r IntRange)
insertSequence(ctx *Context, seq Sequence, i Int)
appendSequence(ctx *Context, seq Sequence)
}