module AWS::Flow::DecisionStateMachineDFA

@api private

Attributes

start_state[RW]
states[RW]
symbols[RW]
transitions[RW]

Public Instance Methods

add_transition(state, symbol, next_state, function = nil) click to toggle source
# File lib/aws/decider/state_machines.rb, line 48
def add_transition(state, symbol, next_state, function = nil)
  @symbols << symbol unless @symbols.include? symbol
  [state, next_state].each do |this_state|
    @states << this_state unless @states.include? this_state
  end
  @transitions[[state, symbol]] = [next_state, function]
end
add_transitions(list_of_transitions) click to toggle source
# File lib/aws/decider/state_machines.rb, line 56
def add_transitions(list_of_transitions)
  list_of_transitions.each {|transition| add_transition(*transition)}
end
get_start_state() click to toggle source
# File lib/aws/decider/state_machines.rb, line 32
def get_start_state
  @start_state
end
get_transitions() click to toggle source
# File lib/aws/decider/state_machines.rb, line 42
def get_transitions
  # Turns out, you are your own ancestor.
  ancestors.slice(1..-1).map {|x| x.transitions if x.respond_to? :transitions}.compact.
    inject({}) {|x, y| x.merge(y)}.merge(@transitions)
end
init(start_state) click to toggle source
# File lib/aws/decider/state_machines.rb, line 23
def init(start_state)
  include InstanceMethods
  @start_state = start_state
  @symbols = []
  @states = []
  @transitions = {}
  @states << start_state
end
self_transitions(symbol) click to toggle source
# File lib/aws/decider/state_machines.rb, line 36
def self_transitions(symbol)
  states.each do |state|
    add_transition(state, symbol, state) unless @transitions[[state, symbol]]
  end
end
uncovered_transitions() click to toggle source
# File lib/aws/decider/state_machines.rb, line 60
def uncovered_transitions
  @states.product(@symbols) - @transitions.keys
end