Class SynFlowFactory
In: lib/syn_flow.rb
Parent: Object

The SynFlowFactory define the common part for a set of flows.

A SynFlow is like an automaton (finite state machine):

  * states
  * transitions
  * an alphabet
  * an initial state
  * a set of final states

With this automaton (diagram, graph…) you can easily describe important steps of your program control flow.

Your automaton describe a model of execution and constraint every execution to it.

When a thread want to change the state of its flow it proceed like that:

  flow << :a_symbol_of_the_alphabet

If a transition between the current state and a state destination is labeled by symbol, then the state is updated to destination. Otherwise the thread is constraint to wait the modification of the current state.

See examples below to know how to use these class.

Methods

<<   delta   include?   initial?   new   new_flow  

Classes and Modules

Class SynFlowFactory::Transition
Class SynFlowFactory::TransitionSet

Attributes

initial  [RW] 
transitions  [RW] 

Public Class methods

[Source]

# File lib/syn_flow.rb, line 132
  def initialize
    @transitions = TransitionSet.new
    @initial = nil
  end

Public Instance methods

[Source]

# File lib/syn_flow.rb, line 138
  def << ( transition )
    @transitions << transition
    self
  end

[Source]

# File lib/syn_flow.rb, line 149
  def delta ( src, label )
    @transitions.delta(src, label)
  end

[Source]

# File lib/syn_flow.rb, line 144
  def include? ( *transition )
    @transitions.include?(*transition)
  end

[Source]

# File lib/syn_flow.rb, line 159
  def initial? ( state )
    state == @initial
  end

[Source]

# File lib/syn_flow.rb, line 154
  def new_flow
    SynFlow.new(self, @initial)
  end

[Validate]