Class: Pacer::Filter::KeyIndex
- Inherits:
-
Object
- Object
- Pacer::Filter::KeyIndex
- Defined in:
- lib/pacer/filter/property_filter/filters.rb
Instance Attribute Summary collapse
-
#element_type ⇒ Object
readonly
Returns the value of attribute element_type.
-
#graph ⇒ Object
readonly
Returns the value of attribute graph.
Instance Method Summary collapse
-
#count(key, value) ⇒ Object
FIXME: there is no count for key indices anymore.
- #get(key, value) ⇒ Object
-
#initialize(graph, element_type) ⇒ KeyIndex
constructor
A new instance of KeyIndex.
Constructor Details
#initialize(graph, element_type) ⇒ KeyIndex
Returns a new instance of KeyIndex.
6 7 8 9 |
# File 'lib/pacer/filter/property_filter/filters.rb', line 6 def initialize(graph, element_type) @graph = graph @element_type = element_type end |
Instance Attribute Details
#element_type ⇒ Object (readonly)
Returns the value of attribute element_type.
4 5 6 |
# File 'lib/pacer/filter/property_filter/filters.rb', line 4 def element_type @element_type end |
#graph ⇒ Object (readonly)
Returns the value of attribute graph.
4 5 6 |
# File 'lib/pacer/filter/property_filter/filters.rb', line 4 def graph @graph end |
Instance Method Details
#count(key, value) ⇒ Object
FIXME: there is no count for key indices anymore. I’m counting up to 10 elements to try to find good indices, otherwise using anything…
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/pacer/filter/property_filter/filters.rb', line 14 def count(key, value) iter = get(key, value).iterator 10.times do |n| if iter.hasNext iter.next else return n end end 1_000_000 # Random high number. end |
#get(key, value) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/pacer/filter/property_filter/filters.rb', line 26 def get(key, value) if element_type == :vertex graph.blueprints_graph.getVertices(key, value) else graph.blueprints_graph.getEdges(key, value) end end |