Class: Pacer::Pipes::PathWrappingPipe
- Defined in:
- lib/pacer/pipe/path_wrapping_pipe.rb
Instance Attribute Summary collapse
-
#edge_wrapper ⇒ Object
Returns the value of attribute edge_wrapper.
-
#graph ⇒ Object
readonly
Returns the value of attribute graph.
-
#other_wrapper ⇒ Object
Returns the value of attribute other_wrapper.
-
#vertex_wrapper ⇒ Object
Returns the value of attribute vertex_wrapper.
Attributes inherited from RubyPipe
Instance Method Summary collapse
- #getCurrentPath ⇒ Object
-
#initialize(graph, vertex_extensions = [], edge_extensions = []) ⇒ PathWrappingPipe
constructor
A new instance of PathWrappingPipe.
- #instance(pipe, g) ⇒ Object
- #processNextStart ⇒ Object
Methods inherited from RubyPipe
#enablePath, #reset, #setStarts
Constructor Details
#initialize(graph, vertex_extensions = [], edge_extensions = []) ⇒ PathWrappingPipe
Returns a new instance of PathWrappingPipe.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/pacer/pipe/path_wrapping_pipe.rb', line 7 def initialize(graph, vertex_extensions = [], edge_extensions = []) super() if graph.is_a? Array @graph, @vertex_wrapper, @edge_wrapper = graph else @graph = graph @vertex_wrapper = Pacer::Wrappers::WrapperSelector.build graph, :vertex, vertex_extensions || Set[] @edge_wrapper = Pacer::Wrappers::WrapperSelector.build graph, :edge, edge_extensions || Set[] end end |
Instance Attribute Details
#edge_wrapper ⇒ Object
Returns the value of attribute edge_wrapper.
5 6 7 |
# File 'lib/pacer/pipe/path_wrapping_pipe.rb', line 5 def edge_wrapper @edge_wrapper end |
#graph ⇒ Object (readonly)
Returns the value of attribute graph.
4 5 6 |
# File 'lib/pacer/pipe/path_wrapping_pipe.rb', line 4 def graph @graph end |
#other_wrapper ⇒ Object
Returns the value of attribute other_wrapper.
5 6 7 |
# File 'lib/pacer/pipe/path_wrapping_pipe.rb', line 5 def other_wrapper @other_wrapper end |
#vertex_wrapper ⇒ Object
Returns the value of attribute vertex_wrapper.
5 6 7 |
# File 'lib/pacer/pipe/path_wrapping_pipe.rb', line 5 def vertex_wrapper @vertex_wrapper end |
Instance Method Details
#getCurrentPath ⇒ Object
25 26 27 |
# File 'lib/pacer/pipe/path_wrapping_pipe.rb', line 25 def getCurrentPath starts.getCurrentPath end |
#instance(pipe, g) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/pacer/pipe/path_wrapping_pipe.rb', line 18 def instance(pipe, g) g ||= graph p = PathWrappingPipe.new [g, vertex_wrapper, edge_wrapper] p.setStarts pipe p end |
#processNextStart ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/pacer/pipe/path_wrapping_pipe.rb', line 29 def processNextStart path = starts.next path.collect do |item| if item.is_a? Pacer::Vertex vertex_wrapper.new graph, item elsif item.is_a? Pacer::Edge edge_wrapper.new graph, item elsif other_wrapper other_wrapper.new graph, item else item end end end |