Class: Pacer::Neo4j::Algo::PathPipe
- Inherits:
-
Pipes::RubyPipe
- Object
- Pipes::RubyPipe
- Pacer::Neo4j::Algo::PathPipe
- Defined in:
- lib/pacer-neo4j/algo/path_pipe.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#algo ⇒ Object
readonly
Returns the value of attribute algo.
-
#current_paths ⇒ Object
Returns the value of attribute current_paths.
-
#graph ⇒ Object
readonly
Returns the value of attribute graph.
-
#hits ⇒ Object
Returns the value of attribute hits.
-
#max_hits ⇒ Object
readonly
Returns the value of attribute max_hits.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
-
#initialize(algo, graph, target, max_hits) ⇒ PathPipe
constructor
A new instance of PathPipe.
- #next_raw ⇒ Object
- #next_raw_path ⇒ Object
- #processNextStart ⇒ Object
- #unwrap(vertex) ⇒ Object
Constructor Details
#initialize(algo, graph, target, max_hits) ⇒ PathPipe
Returns a new instance of PathPipe.
13 14 15 16 17 18 19 |
# File 'lib/pacer-neo4j/algo/path_pipe.rb', line 13 def initialize(algo, graph, target, max_hits) super() @algo = algo @max_hits = max_hits || -1 @graph = graph.blueprints_graph @target = unwrap target if target end |
Instance Attribute Details
#algo ⇒ Object (readonly)
Returns the value of attribute algo.
10 11 12 |
# File 'lib/pacer-neo4j/algo/path_pipe.rb', line 10 def algo @algo end |
#current_paths ⇒ Object
Returns the value of attribute current_paths.
11 12 13 |
# File 'lib/pacer-neo4j/algo/path_pipe.rb', line 11 def current_paths @current_paths end |
#graph ⇒ Object (readonly)
Returns the value of attribute graph.
10 11 12 |
# File 'lib/pacer-neo4j/algo/path_pipe.rb', line 10 def graph @graph end |
#hits ⇒ Object
Returns the value of attribute hits.
11 12 13 |
# File 'lib/pacer-neo4j/algo/path_pipe.rb', line 11 def hits @hits end |
#max_hits ⇒ Object (readonly)
Returns the value of attribute max_hits.
10 11 12 |
# File 'lib/pacer-neo4j/algo/path_pipe.rb', line 10 def max_hits @max_hits end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
10 11 12 |
# File 'lib/pacer-neo4j/algo/path_pipe.rb', line 10 def target @target end |
Instance Method Details
#next_raw ⇒ Object
51 52 53 |
# File 'lib/pacer-neo4j/algo/path_pipe.rb', line 51 def next_raw unwrap starts.next end |
#next_raw_path ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/pacer-neo4j/algo/path_pipe.rb', line 33 def next_raw_path loop do if current_paths if hits == 0 self.current_paths = nil elsif current_paths.hasNext self.hits -= 1 return current_paths.next else self.current_paths = nil end else self.hits = max_hits self.current_paths = @algo.findAllPaths(next_raw, target).iterator end end end |
#processNextStart ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/pacer-neo4j/algo/path_pipe.rb', line 21 def processNextStart next_raw_path.map do |e| if e.is_a? Node Neo4jVertex.new e, graph elsif e.is_a? Relationship Neo4jEdge.new e, graph else e end end end |
#unwrap(vertex) ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/pacer-neo4j/algo/path_pipe.rb', line 55 def unwrap(vertex) if vertex.respond_to? :element vertex.element.raw_element else vertex.raw_element end end |