Zend Framework  1.12
Public Member Functions | List of all members
Zend_Search_Lucene_FSM Class Reference

Public Member Functions

 __construct ($states=array(), $inputAphabet=array(), $rules=array())
 Finite State machine constructor.
 
 addStates ($states)
 Add states to the state machine.
 
 addState ($state)
 Add state to the state machine.
 
 setState ($state)
 Set FSM state.
 
 getState ()
 Get FSM state.
 
 addInputSymbols ($inputAphabet)
 Add symbols to the input alphabet.
 
 addInputSymbol ($inputSymbol)
 Add symbol to the input alphabet.
 
 addRules ($rules)
 Add transition rules.
 
 addRule ($sourceState, $input, $targetState, $inputAction=null)
 Add symbol to the input alphabet.
 
 addEntryAction ($state, Zend_Search_Lucene_FSMAction $action)
 Add state entry action.
 
 addExitAction ($state, Zend_Search_Lucene_FSMAction $action)
 Add state exit action.
 
 addInputAction ($state, $inputSymbol, Zend_Search_Lucene_FSMAction $action)
 Add input action (defined by {state, input} pair).
 
 addTransitionAction ($sourceState, $targetState, Zend_Search_Lucene_FSMAction $action)
 Add transition action (defined by {state, input} pair).
 
 process ($input)
 Process an input.
 
 reset ()
 

Constructor & Destructor Documentation

__construct (   $states = array(),
  $inputAphabet = array(),
  $rules = array() 
)

Finite State machine constructor.

$states is an array of integers or strings with a list of possible machine states constructor treats fist list element as a sturt state (assignes it to $_current state). It may be reassigned by setState() call. States list may be empty and can be extended later by addState() or addStates() calls.

$inputAphabet is the same as $states, but represents input alphabet it also may be extended later by addInputSymbols() or addInputSymbol() calls.

$rules parameter describes FSM transitions and has a structure: array( array(sourseState, input, targetState[, inputAction]), array(sourseState, input, targetState[, inputAction]), array(sourseState, input, targetState[, inputAction]), ... ) Rules also can be added later by addRules() and addRule() calls.

FSM actions are very flexible and may be defined by addEntryAction(), addExitAction(), addInputAction() and addTransitionAction() calls.

Parameters
array$states
array$inputAphabet
array$rules

Member Function Documentation

addEntryAction (   $state,
Zend_Search_Lucene_FSMAction  $action 
)

Add state entry action.

Several entry actions are allowed. Action execution order is defined by addEntryAction() calls

Parameters
integer | string$state
Zend_Search_Lucene_FSMAction$action
addExitAction (   $state,
Zend_Search_Lucene_FSMAction  $action 
)

Add state exit action.

Several exit actions are allowed. Action execution order is defined by addEntryAction() calls

Parameters
integer | string$state
Zend_Search_Lucene_FSMAction$action
addInputAction (   $state,
  $inputSymbol,
Zend_Search_Lucene_FSMAction  $action 
)

Add input action (defined by {state, input} pair).

Several input actions are allowed. Action execution order is defined by addInputAction() calls

Parameters
integer | string$state
integer | string$input
Zend_Search_Lucene_FSMAction$action
addInputSymbol (   $inputSymbol)

Add symbol to the input alphabet.

Parameters
integer | string$inputSymbol
addInputSymbols (   $inputAphabet)

Add symbols to the input alphabet.

Parameters
array$inputAphabet
addRule (   $sourceState,
  $input,
  $targetState,
  $inputAction = null 
)

Add symbol to the input alphabet.

Parameters
integer | string$sourceState
integer | string$input
integer | string$targetState
Zend_Search_Lucene_FSMAction | null$inputAction
Exceptions
Zend_Search_Exception
addRules (   $rules)

Add transition rules.

array structure: array( array(sourseState, input, targetState[, inputAction]), array(sourseState, input, targetState[, inputAction]), array(sourseState, input, targetState[, inputAction]), ... )

Parameters
array$rules
addState (   $state)

Add state to the state machine.

Parameters
integer | string$state
addStates (   $states)

Add states to the state machine.

Parameters
array$states
addTransitionAction (   $sourceState,
  $targetState,
Zend_Search_Lucene_FSMAction  $action 
)

Add transition action (defined by {state, input} pair).

Several transition actions are allowed. Action execution order is defined by addTransitionAction() calls

Parameters
integer | string$sourceState
integer | string$targetState
Zend_Search_Lucene_FSMAction$action
getState ( )

Get FSM state.

Returns
integer|string $state|null
process (   $input)

Process an input.

Parameters
mixed$input
Exceptions
Zend_Search_Exception
reset ( )
setState (   $state)

Set FSM state.

No any action is invoked

Parameters
integer | string$state
Exceptions
Zend_Search_Exception