• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mlange-42 / arche / 4846030190

30 Apr 2023 07:29PM CUT coverage: 100.0%. Remained the same
4846030190

push

github

GitHub
Lock registered filters, partial recompile (#241)

136 of 136 new or added lines in 2 files covered. (100.0%)

3095 of 3095 relevant lines covered (100.0%)

2585.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/ecs/archetypes.go
1
package ecs
2

3
// Interface for an iterator over archetypes.
4
type archetypes interface {
5
        Get(index int32) *archetype
6
        Len() int32
7
}
8

9
// Implementation of an archetype iterator for a single archetype.
10
// Implements [archetypes].
11
//
12
// Used for the [Query] returned by entity batch creation methods.
13
type batchArchetype struct {
14
        Archetype  *archetype
15
        StartIndex uint32
16
}
17

18
// Get returns the value at the given index.
19
func (s batchArchetype) Get(index int32) *archetype {
2✔
20
        return s.Archetype
2✔
21
}
2✔
22

23
// Len returns the current number of items in the paged array.
24
func (s batchArchetype) Len() int32 {
8✔
25
        return 1
8✔
26
}
8✔
27

28
// Implementation of an archetype iterator for pointers.
29
// Implements [archetypes].
30
//
31
// Used for tracking filter archetypes in [Cache].
32
type archetypePointers struct {
33
        pointers []*archetype
34
}
35

36
// Get returns the value at the given index.
37
func (a *archetypePointers) Get(index int32) *archetype {
13✔
38
        return a.pointers[index]
13✔
39
}
13✔
40

41
// Add adds an element.
42
func (a *archetypePointers) Add(arch *archetype) {
52✔
43
        a.pointers = append(a.pointers, arch)
52✔
44
}
52✔
45

46
// Add adds an element.
47
func (a *archetypePointers) Remove(arch *archetype) {
2✔
48
        for i := 0; i < len(a.pointers); i++ {
5✔
49
                arch2 := a.pointers[i]
3✔
50
                if arch == arch2 {
5✔
51
                        a.pointers = append(a.pointers[:i], a.pointers[i+1:]...)
2✔
52
                        return
2✔
53
                }
2✔
54
        }
55
}
56

57
// Len returns the current number of items in the paged array.
58
func (a *archetypePointers) Len() int32 {
15✔
59
        return int32(len(a.pointers))
15✔
60
}
15✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc