Class: Rley::GFG::GrmFlowGraph::Branching

Inherits:
Struct
  • Object
show all
Defined in:
lib/rley/gfg/grm_flow_graph.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(aVertex, aCallEdge) ⇒ Branching

Returns a new instance of Branching.



98
99
100
101
102
103
# File 'lib/rley/gfg/grm_flow_graph.rb', line 98

def initialize(aVertex, aCallEdge)
  super(aVertex)
  self.in_edge = aCallEdge
  self.to_visit = aVertex.edges.dup
  self.visited = []
end

Instance Attribute Details

#in_edgeObject

Returns the value of attribute in_edge

Returns:

  • (Object)

    the current value of in_edge



97
98
99
# File 'lib/rley/gfg/grm_flow_graph.rb', line 97

def in_edge
  @in_edge
end

#to_visitObject

Returns the value of attribute to_visit

Returns:

  • (Object)

    the current value of to_visit



97
98
99
# File 'lib/rley/gfg/grm_flow_graph.rb', line 97

def to_visit
  @to_visit
end

#vertexObject

Returns the value of attribute vertex

Returns:

  • (Object)

    the current value of vertex



97
98
99
# File 'lib/rley/gfg/grm_flow_graph.rb', line 97

def vertex
  @vertex
end

#visitedObject

Returns the value of attribute visited

Returns:

  • (Object)

    the current value of visited



97
98
99
# File 'lib/rley/gfg/grm_flow_graph.rb', line 97

def visited
  @visited
end

Instance Method Details

#done?Boolean

Returns:

  • (Boolean)


105
106
107
# File 'lib/rley/gfg/grm_flow_graph.rb', line 105

def done?
  to_visit.empty?
end

#next_edgeObject



109
110
111
112
113
114
# File 'lib/rley/gfg/grm_flow_graph.rb', line 109

def next_edge
  next_one = to_visit.shift
  visited << next_one.successor unless next_one.nil?

  return next_one
end