Class: Nfa2Dfa::Transition
- Inherits:
-
Object
- Object
- Nfa2Dfa::Transition
- Defined in:
- lib/transition.rb
Overview
Transition between states
Instance Attribute Summary collapse
-
#alphabet ⇒ Object
readonly
Returns the value of attribute alphabet.
-
#beginning_state ⇒ Object
readonly
Returns the value of attribute beginning_state.
-
#ending_state ⇒ Object
readonly
Returns the value of attribute ending_state.
Instance Method Summary collapse
-
#initialize(beg_state, alphabet, end_state) ⇒ Transition
constructor
A new instance of Transition.
- #print ⇒ Object
- #to_graph_transition(graphviz_graph) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(beg_state, alphabet, end_state) ⇒ Transition
Returns a new instance of Transition.
10 11 12 13 14 |
# File 'lib/transition.rb', line 10 def initialize(beg_state, alphabet, end_state) @beginning_state = beg_state @alphabet = alphabet @ending_state = end_state end |
Instance Attribute Details
#alphabet ⇒ Object (readonly)
Returns the value of attribute alphabet.
8 9 10 |
# File 'lib/transition.rb', line 8 def alphabet @alphabet end |
#beginning_state ⇒ Object (readonly)
Returns the value of attribute beginning_state.
8 9 10 |
# File 'lib/transition.rb', line 8 def beginning_state @beginning_state end |
#ending_state ⇒ Object (readonly)
Returns the value of attribute ending_state.
8 9 10 |
# File 'lib/transition.rb', line 8 def ending_state @ending_state end |
Instance Method Details
#print ⇒ Object
27 28 29 |
# File 'lib/transition.rb', line 27 def print puts @beginning_state.id + '-' + @alphabet + '-' + @ending_state.id end |
#to_graph_transition(graphviz_graph) ⇒ Object
16 17 18 19 20 |
# File 'lib/transition.rb', line 16 def to_graph_transition(graphviz_graph) graphviz_graph.add_edges( @beginning_state.graphviz_node, @ending_state.graphviz_node, :label => @alphabet) end |
#to_s ⇒ Object
22 23 24 25 |
# File 'lib/transition.rb', line 22 def to_s ret = @beginning_state.to_s + '-' + alphabet + '-' + @ending_state.to_s ret end |