Class: Factbase::IndexedNot
- Inherits:
-
Object
- Object
- Factbase::IndexedNot
- Defined in:
- lib/factbase/indexed/indexed_not.rb
Overview
Indexed term ‘not’.
Instance Method Summary collapse
-
#initialize(term, idx) ⇒ IndexedNot
constructor
A new instance of IndexedNot.
- #predict(maps, fb, params) ⇒ Object
Constructor Details
#initialize(term, idx) ⇒ IndexedNot
Returns a new instance of IndexedNot.
8 9 10 11 |
# File 'lib/factbase/indexed/indexed_not.rb', line 8 def initialize(term, idx) @term = term @idx = idx end |
Instance Method Details
#predict(maps, fb, params) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/factbase/indexed/indexed_not.rb', line 13 def predict(maps, fb, params) sub = @term.operands.first key = [maps.object_id, sub, @term.op] @idx[key] ||= { facts: nil, count: 0, yes_set: nil } entry = @idx[key] _feed(maps.to_a, entry) do sub.predict(maps, fb, params) end return nil if entry[:facts].nil? maps.respond_to?(:repack) ? maps.repack(entry[:facts]) : entry[:facts] end |