Class: FiniteAutomata
- Inherits:
-
Object
- Object
- FiniteAutomata
- Defined in:
- lib/finite_automata.rb
Overview
This class defines the finite_automata Ruby library.
Instance Attribute Summary collapse
-
#accepting_states ⇒ Object
Returns the value of attribute accepting_states.
-
#alphabet ⇒ Object
Returns the value of attribute alphabet.
-
#start_state ⇒ Object
Returns the value of attribute start_state.
-
#state_transitions ⇒ Object
Returns the value of attribute state_transitions.
-
#states ⇒ Object
Returns the value of attribute states.
Instance Method Summary collapse
-
#initialize(states = [], start_state = nil, alphabet = [], accepting_states = [], state_transitions = {}) ⇒ FiniteAutomata
constructor
A new instance of FiniteAutomata.
Constructor Details
#initialize(states = [], start_state = nil, alphabet = [], accepting_states = [], state_transitions = {}) ⇒ FiniteAutomata
Returns a new instance of FiniteAutomata.
7 8 9 10 11 12 13 14 |
# File 'lib/finite_automata.rb', line 7 def initialize(states = [], start_state = nil, alphabet = [], accepting_states = [], state_transitions = {}) @states = states @start_state = start_state @alphabet = alphabet @accepting_states = accepting_states @state_transitions = state_transitions end |
Instance Attribute Details
#accepting_states ⇒ Object
Returns the value of attribute accepting_states.
5 6 7 |
# File 'lib/finite_automata.rb', line 5 def accepting_states @accepting_states end |
#alphabet ⇒ Object
Returns the value of attribute alphabet.
5 6 7 |
# File 'lib/finite_automata.rb', line 5 def alphabet @alphabet end |
#start_state ⇒ Object
Returns the value of attribute start_state.
5 6 7 |
# File 'lib/finite_automata.rb', line 5 def start_state @start_state end |
#state_transitions ⇒ Object
Returns the value of attribute state_transitions.
5 6 7 |
# File 'lib/finite_automata.rb', line 5 def state_transitions @state_transitions end |
#states ⇒ Object
Returns the value of attribute states.
5 6 7 |
# File 'lib/finite_automata.rb', line 5 def states @states end |