Module: AWS::Flow::Core::SimpleDFA Private

Included in:
BeginRescueEnsure
Defined in:
lib/aws/flow/simple_dfa.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

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

Defined Under Namespace

Modules: InstanceMethods

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#start_stateObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



24
25
26
# File 'lib/aws/flow/simple_dfa.rb', line 24

def start_state
  @start_state
end

#statesObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



24
25
26
# File 'lib/aws/flow/simple_dfa.rb', line 24

def states
  @states
end

#symbolsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



24
25
26
# File 'lib/aws/flow/simple_dfa.rb', line 24

def symbols
  @symbols
end

#transitionsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



24
25
26
# File 'lib/aws/flow/simple_dfa.rb', line 24

def transitions
  @transitions
end

Instance Method Details

#add_transition(state, symbol, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



67
68
69
70
71
# 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) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



58
59
60
61
62
63
64
# 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_stateObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

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

Returns:

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



45
46
47
# File 'lib/aws/flow/simple_dfa.rb', line 45

def get_start_state
  @start_state
end

#get_transitionsArray

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

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

Returns:

  • (Array)

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



53
54
55
# File 'lib/aws/flow/simple_dfa.rb', line 53

def get_transitions
  @transitions
end

#init(start_state) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Creates a new ‘SimpleDFA` instance.

Parameters:

  • start_state

    The state with which to start the framework.



32
33
34
35
36
37
38
39
# 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_transitionsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



74
75
76
# File 'lib/aws/flow/simple_dfa.rb', line 74

def uncovered_transitions
  @states.product(@symbols) - @transitions.keys
end