Move Size handling out of Base

This commit is contained in:
kortschak 2014-07-30 12:14:46 +09:30
parent 525230206a
commit ee6d4c8db7
5 changed files with 17 additions and 5 deletions

View file

@ -240,3 +240,7 @@ func (it *HasA) Close() {
// Register this iterator as a HasA.
func (it *HasA) Type() graph.Type { return graph.HasA }
func (it *HasA) Size() (int64, bool) {
return 0, true
}

View file

@ -80,11 +80,6 @@ func (it *Base) Result() graph.Value {
return it.Last
}
// If you're empty and you know it, clap your hands.
func (it *Base) Size() (int64, bool) {
return 0, true
}
// Accessor
func (it *Base) CanNext() bool { return it.canNext }

View file

@ -200,3 +200,7 @@ func (it *LinksTo) Stats() graph.IteratorStats {
Size: fanoutFactor * subitStats.Size,
}
}
func (it *LinksTo) Size() (int64, bool) {
return 0, true
}

View file

@ -151,3 +151,8 @@ func (it *Optional) Stats() graph.IteratorStats {
Size: subStats.Size,
}
}
// If you're empty and you know it, clap your hands.
func (it *Optional) Size() (int64, bool) {
return 0, true
}

View file

@ -212,3 +212,7 @@ func (it *Comparison) Optimize() (graph.Iterator, bool) {
func (it *Comparison) Stats() graph.IteratorStats {
return it.subIt.Stats()
}
func (it *Base) Size() (int64, bool) {
return 0, true
}