API Documentation

Search/Lucene/FSM.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Search_Lucene
version
$Id: FSM.php 20096 2010-01-06 02:05:09Z bkarwin $
Classes
Zend_Search_Lucene_FSM

Description

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Zend_Search_Lucene_FSM

category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Search_Lucene
Properties
$_states
$_currentState
$_inputAphabet
$_rules
$_entryActions
$_exitActions
$_inputActions
$_transitionActions
Methods
__construct
addStates
addState
setState
getState
addInputSymbols
addInputSymbol
addRules
addRule
addEntryAction
addExitAction
addInputAction
addTransitionAction
process
reset

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

Properties

$_currentState

integer|string $_currentState = 'null'

Current state

Details

$_currentState
integer|string
visibility
private
default
null
final
false
static
false

$_entryActions

array $_entryActions = 'array'

List of entry actions Each action executes when entering the state

[state] => action

Details

$_entryActions
array
visibility
private
default
array
final
false
static
false

$_exitActions

array $_exitActions = 'array'

List of exit actions Each action executes when exiting the state

[state] => action

Details

$_exitActions
array
visibility
private
default
array
final
false
static
false

$_inputActions

array $_inputActions = 'array'

List of input actions Each action executes when entering the state

[state][input] => action

Details

$_inputActions
array
visibility
private
default
array
final
false
static
false

$_inputAphabet

array $_inputAphabet = 'array'

Input alphabet

Details

$_inputAphabet
array
visibility
private
default
array
final
false
static
false

$_rules

array $_rules = 'array'

State transition table

[sourceState][input] => targetState

Details

$_rules
array
visibility
private
default
array
final
false
static
false

$_states

array $_states = 'array'

Machine States alphabet

Details

$_states
array
visibility
private
default
array
final
false
static
false

$_transitionActions

array $_transitionActions = 'array'

List of input actions Each action executes when entering the state

[state1][state2] => action

Details

$_transitionActions
array
visibility
private
default
array
final
false
static
false

Methods

__construct

__construct( array $states = array, array $inputAphabet = array, 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.

Arguments
$states
array
$inputAphabet
array
$rules
array
Details
visibility
public
final
false
static
false

addEntryAction

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

Add state entry action.

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

Arguments
$state
integerstring
$action
Zend_Search_Lucene_FSMAction
Details
visibility
public
final
false
static
false

addExitAction

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

Add state exit action.

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

Arguments
$state
integerstring
$action
Zend_Search_Lucene_FSMAction
Details
visibility
public
final
false
static
false

addInputAction

addInputAction( integer|string $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

Arguments
$state
integerstring
$inputSymbol
$action
Zend_Search_Lucene_FSMAction
Details
visibility
public
final
false
static
false

addInputSymbol

addInputSymbol( integer|string $inputSymbol ) :

Add symbol to the input alphabet

Arguments
$inputSymbol
integerstring
Details
visibility
public
final
false
static
false

addInputSymbols

addInputSymbols( array $inputAphabet ) :

Add symbols to the input alphabet

Arguments
$inputAphabet
array
Details
visibility
public
final
false
static
false

addRule

addRule( integer|string $sourceState, integer|string $input, integer|string $targetState, Zend_Search_Lucene_FSMAction|null $inputAction = null ) :

Add symbol to the input alphabet

Arguments
$sourceState
integerstring
$input
integerstring
$targetState
integerstring
$inputAction
Zend_Search_Lucene_FSMActionnull
Details
visibility
public
final
false
static
false
throws

addRules

addRules( array $rules ) :

Add transition rules

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

Arguments
$rules
array
Details
visibility
public
final
false
static
false

addState

addState( integer|string $state ) :

Add state to the state machine

Arguments
$state
integerstring
Details
visibility
public
final
false
static
false

addStates

addStates( array $states ) :

Add states to the state machine

Arguments
$states
array
Details
visibility
public
final
false
static
false

addTransitionAction

addTransitionAction( integer|string $sourceState, integer|string $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

Arguments
$sourceState
integerstring
$targetState
integerstring
$action
Zend_Search_Lucene_FSMAction
Details
visibility
public
final
false
static
false

getState

getState( ) : integer|string

Get FSM state.

Output
integer|string
$state|null
Details
visibility
public
final
false
static
false

process

process( mixed $input ) :

Process an input

Arguments
$input
mixed
Details
visibility
public
final
false
static
false
throws

reset

reset( ) :
Details
visibility
public
final
false
static
false

setState

setState( integer|string $state ) :

Set FSM state.

No any action is invoked

Arguments
$state
integerstring
Details
visibility
public
final
false
static
false
throws
Documentation was generated by DocBlox.