module AWS::Flow::Core::SimpleDFA

Contains a data flow analysis (DFA)-like framework, where transition functions can perform arbitrary computation before moving to the next state. @api private

Attributes

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

Public Instance Methods

add_transition(state, symbol, &block) click to toggle source

@api private

# File lib/aws/flow/simple_dfa.rb, line 67
def add_transition(state, symbol, &block)
  @symbols << symbol unless @symbols.include? symbol
  @states << state unless @states.include? state
  @transitions[[state, symbol]] = block
end
define_general(state, &block) click to toggle source

@api private

# File lib/aws/flow/simple_dfa.rb, line 58
def define_general(state, &block)
  @symbols.each do |symbol|
    if @transitions[[state, symbol]].nil?
      @transitions[[state, symbol]] = block
    end
  end
end
get_start_state() click to toggle source

@return the start state

The start state that was provided when this instance was created.

@api private

# File lib/aws/flow/simple_dfa.rb, line 45
def get_start_state
  @start_state
end
get_transitions() click to toggle source

@return [Array]

The list of all transitions that were added with {#add_transition}.

@api private

# File lib/aws/flow/simple_dfa.rb, line 53
def get_transitions
  @transitions
end
init(start_state) click to toggle source

Creates a new ‘SimpleDFA` instance.

@param start_state

The state with which to start the framework.

@api private

# File lib/aws/flow/simple_dfa.rb, line 32
def init(start_state)
  include InstanceMethods
  @start_state = start_state
  @symbols = []
  @states = []
  @transitions = {}
  @states << start_state
end
uncovered_transitions() click to toggle source

@api private

# File lib/aws/flow/simple_dfa.rb, line 74
def uncovered_transitions
  @states.product(@symbols) - @transitions.keys
end