Rename Check-ish -> Contains-ish
Contains[*] indicates what the check is for. [*] I considered Has/Have, but settled on Contains to avoid confusion with the HasA iterator.
This commit is contained in:
parent
a81005ba21
commit
1606e98d9f
20 changed files with 142 additions and 143 deletions
|
|
@ -138,7 +138,7 @@ func (it *AllIterator) SubIterators() []graph.Iterator {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (it *AllIterator) Check(v graph.Value) bool {
|
||||
func (it *AllIterator) Contains(v graph.Value) bool {
|
||||
it.result = v
|
||||
return true
|
||||
}
|
||||
|
|
@ -174,8 +174,8 @@ func (it *AllIterator) Optimize() (graph.Iterator, bool) {
|
|||
func (it *AllIterator) Stats() graph.IteratorStats {
|
||||
s, _ := it.Size()
|
||||
return graph.IteratorStats{
|
||||
CheckCost: 1,
|
||||
NextCost: 2,
|
||||
Size: s,
|
||||
ContainsCost: 1,
|
||||
NextCost: 2,
|
||||
Size: s,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ func PositionOf(prefix []byte, d quad.Direction, qs *TripleStore) int {
|
|||
panic("unreachable")
|
||||
}
|
||||
|
||||
func (it *Iterator) Check(v graph.Value) bool {
|
||||
func (it *Iterator) Contains(v graph.Value) bool {
|
||||
val := v.([]byte)
|
||||
if val[0] == 'z' {
|
||||
return false
|
||||
|
|
@ -262,8 +262,8 @@ func (it *Iterator) Optimize() (graph.Iterator, bool) {
|
|||
func (it *Iterator) Stats() graph.IteratorStats {
|
||||
s, _ := it.Size()
|
||||
return graph.IteratorStats{
|
||||
CheckCost: 1,
|
||||
NextCost: 2,
|
||||
Size: s,
|
||||
ContainsCost: 1,
|
||||
NextCost: 2,
|
||||
Size: s,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -251,14 +251,14 @@ func TestIterator(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, pq := range expect {
|
||||
if !it.Check(qs.ValueOf(pq)) {
|
||||
if !it.Contains(qs.ValueOf(pq)) {
|
||||
t.Errorf("Failed to find and check %q correctly", pq)
|
||||
}
|
||||
}
|
||||
// FIXME(kortschak) Why does this fail?
|
||||
/*
|
||||
for _, pq := range []string{"baller"} {
|
||||
if it.Check(qs.ValueOf(pq)) {
|
||||
if it.Contains(qs.ValueOf(pq)) {
|
||||
t.Errorf("Failed to check %q correctly", pq)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue