// Contains() for an Int64 is merely seeing if the passed value is // within the range, assuming the value is an int64. func (it *Int64) Contains(tsv graph.Value) bool { graph.ContainsLogIn(it, tsv) it.runstats.Contains += 1 var v int64 if tsv.IsNode() { v = int64(tsv.(Int64Node)) } else { v = int64(tsv.(Int64Quad)) } if it.min <= v && v <= it.max { it.result = v return graph.ContainsLogOut(it, it.toValue(v), true) } return graph.ContainsLogOut(it, it.toValue(v), false) }
func (it *Iterator) Contains(v graph.Value) bool { graph.ContainsLogIn(it, v) if v == nil { return graph.ContainsLogOut(it, v, false) } else if it.nodes != v.IsNode() { return graph.ContainsLogOut(it, v, false) } var vi int64 if it.nodes { vi = int64(v.(iterator.Int64Node)) } else { vi = int64(v.(iterator.Int64Quad)) } if _, ok := it.tree.Get(vi); ok { it.result = vi return graph.ContainsLogOut(it, v, true) } return graph.ContainsLogOut(it, v, false) }