## Zend_Search_Lucene_FSM

Description

Abstract Finite State Machine

Take a look on Wikipedia state machine description: http://en.wikipedia.org/wiki/Finite_state_machine

Any type of Transducers (Moore machine or Mealy machine) also may be implemented by using this abstract FSM. process() methods invokes a specified actions which may construct FSM output. Actions may be also used to signal, that we have reached Accept State

- abstract:
- license: New BSD License
- copyright: Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)

Located in /Zend/Search/Lucene/FSM.php (line 43)

Direct descendents

Class | Description
--- | ---
Zend_Search_Lucene_Search_BooleanExpressionRecognizer |
Zend_Search_Lucene_Search_QueryLexer |
Zend_Search_Lucene_Search_QueryParser |

Method Summary
Zend_Search_Lucene_FSM __construct ([array $states = array()], [array $inputAphabet = array()], [array $rules = array()])
void addEntryAction (integer|string $state, Zend_Search_Lucene_FSMAction $action)
void addExitAction (integer|string $state, Zend_Search_Lucene_FSMAction $action)
void addInputAction (integer|string $state, $inputSymbol, Zend_Search_Lucene_FSMAction $action, integer|string $input)
void addInputSymbol (integer|string $inputSymbol)
void addInputSymbols (array $inputAphabet)
void addRule (integer|string $sourceState, integer|string $input, integer|string $targetState, [Zend_Search_Lucene_FSMAction|null $inputAction = null])
void addRules (array $rules)
void addState (integer|string $state)
void addStates (array $states)
void addTransitionAction (integer|string $sourceState, integer|string $targetState, Zend_Search_Lucene_FSMAction $action)
integer|string getState ()
void process (mixed $input)
void reset ()
void setState (integer|string $state)
Methods
Constructor __construct (line 141)

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.

- access: public

Zend_Search_Lucene_FSM __construct ([array $states = array()], [array $inputAphabet = array()], [array $rules = array()])

- array $states
- array $inputAphabet
- array $rules

Redefined in descendants as:

- Zend_Search_Lucene_Search_BooleanExpressionRecognizer::__construct() : Object constructor
- Zend_Search_Lucene_Search_QueryLexer::__construct()
- Zend_Search_Lucene_Search_QueryParser::__construct() : Parser constructor

addEntryAction (line 287)

Add state entry action.

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

- access: public

void addEntryAction (integer|string $state, Zend_Search_Lucene_FSMAction $action)

- integer|string $state
- Zend_Search_Lucene_FSMAction $action

addExitAction (line 308)

Add state exit action.

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

- access: public

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

- integer|string $state
- Zend_Search_Lucene_FSMAction $action

addInputAction (line 330)

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

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

- access: public

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

- integer|string $state
- integer|string $input
- Zend_Search_Lucene_FSMAction $action
- $inputSymbol

addInputSymbol (line 217)

Add symbol to the input alphabet

- access: public

void addInputSymbol (integer|string $inputSymbol)

- integer|string $inputSymbol

addInputSymbols (line 205)

Add symbols to the input alphabet

- access: public

void addInputSymbols (array $inputAphabet)

- array $inputAphabet

addRule (line 251)

Add symbol to the input alphabet

- access: public
- throws: Zend_Search_Exception

void addRule (integer|string $sourceState, integer|string $input, integer|string $targetState, [Zend_Search_Lucene_FSMAction|null $inputAction = null])

- integer|string $sourceState
- integer|string $input
- integer|string $targetState
- Zend_Search_Lucene_FSMAction|null $inputAction

addRules (line 235)

Add transition rules

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

- access: public

void addRules (array $rules)

- array $rules

addState (line 165)

Add state to the state machine

- access: public

void addState (integer|string $state)

- integer|string $state

addStates (line 153)

Add states to the state machine

- access: public

void addStates (array $states)

- array $states

addTransitionAction (line 358)

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

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

- access: public

void addTransitionAction (integer|string $sourceState, integer|string $targetState, Zend_Search_Lucene_FSMAction $action)

- integer|string $sourceState
- integer|string $targetState
- Zend_Search_Lucene_FSMAction $action

getState (line 195)

Get FSM state.

- access: public

integer|string getState ()
process (line 384)

Process an input

- access: public
- throws: Zend_Search_Exception

void process (mixed $input)

- mixed $input

reset (line 424)

- access: public

void reset ()
setState (line 181)

Set FSM state.

No any action is invoked

- access: public
- throws: Zend_Search_Exception

void setState (integer|string $state)

- integer|string $state

Documentation generated on Wed, 21 Feb 2007 11:49:35 -0800 by phpDocumentor 1.3.1