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.



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

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



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

def in_edge
  @in_edge
end

#to_visitObject

Returns the value of attribute to_visit

Returns:

  • (Object)

    the current value of to_visit



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

def to_visit
  @to_visit
end

#vertexObject

Returns the value of attribute vertex

Returns:

  • (Object)

    the current value of vertex



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

def vertex
  @vertex
end

#visitedObject

Returns the value of attribute visited

Returns:

  • (Object)

    the current value of visited



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

def visited
  @visited
end

Instance Method Details

#done?Boolean

Returns:

  • (Boolean)


107
108
109
# File 'lib/rley/gfg/grm_flow_graph.rb', line 107

def done?
  to_visit.empty?
end

#next_edgeObject



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

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

  return next_one
end