Class: OMF::Rete::Store::NamedAlphaStore
- Inherits:
-
AlphaStore
- Object
- AlphaStore
- OMF::Rete::Store::NamedAlphaStore
- Includes:
- OMF::Rete::Store
- Defined in:
- lib/omf_rete/store/named_alpha_store.rb
Overview
This is a store where the first element in each tuple is supposed to have the same name.
Constant Summary
Constants included from OMF::Rete::Store
Instance Attribute Summary
Attributes inherited from AlphaStore
Instance Method Summary collapse
- #addTuple(tarray) ⇒ Object
-
#initialize(name, length, opts = {}) ⇒ NamedAlphaStore
constructor
Initialize a tuple store for tuples of fixed length
length
where the first element is always ‘name’ (included in length).
Methods included from OMF::Rete::Store
#add, #confirmLength, create, #createTSet, #find, #on_query, #query, #remove, #removeTuple, #subscribe, #unsubscribe
Methods inherited from AlphaStore
#createTSet, #find, #onUnregisterTSet, #registerTSet, #removeTuple, #to_s, #unregisterTSet
Constructor Details
#initialize(name, length, opts = {}) ⇒ NamedAlphaStore
Initialize a tuple store for tuples of fixed length length
where the first element is always ‘name’ (included in length)
22 23 24 25 26 27 |
# File 'lib/omf_rete/store/named_alpha_store.rb', line 22 def initialize(name, length, opts = {}) super(length, opts) @name = name super length, opts #@store = AlphaStore.new(length - 1) end |
Instance Method Details
#addTuple(tarray) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/omf_rete/store/named_alpha_store.rb', line 29 def addTuple(tarray) unless tarray[0] == @name raise WrongNameException.new(@name, tarray) end super #@store.addTuple(tarray[1 .. -1]) end |