Class: FiniteState::Transition

Inherits:
Object
  • Object
show all
Defined in:
lib/finite_state/transition.rb

Overview

Represents a Transition within an Automaton

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from_state, symbol, to_state) ⇒ Transition

Initializes a new Transition

Attributes

  • from_state - the state from which the transition takes place

  • symbol - the symbol that's necessary to make the transition

  • to_state - the state after a successfull transition

Example

from_state = State.new("s0", :is_start => true)
symbol     = "a"
to_state   = State.new("s1", :is_end => true)

Transition.new(from_state, symbol, to_state)

22
23
24
25
26
# File 'lib/finite_state/transition.rb', line 22

def initialize(from_state, symbol, to_state)
  @from_state = from_state
  @symbol     = symbol
  @to_state   = to_state
end

Instance Attribute Details

#from_stateObject (readonly)

Returns the value of attribute from_state


4
5
6
# File 'lib/finite_state/transition.rb', line 4

def from_state
  @from_state
end

#symbolObject (readonly)

Returns the value of attribute symbol


4
5
6
# File 'lib/finite_state/transition.rb', line 4

def symbol
  @symbol
end

#to_stateObject (readonly)

Returns the value of attribute to_state


4
5
6
# File 'lib/finite_state/transition.rb', line 4

def to_state
  @to_state
end