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
category | Zend |
---|---|
package | Zend_Search_Lucene |
subpackage | Search |
copyright | Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
license | New BSD License |
inherited_from | \Zend_Search_Lucene_FSM |
__construct()
$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.
inherited_from | \Zend_Search_Lucene_FSM::__construct() |
---|
__construct(array $states= array()
, array $inputAphabet= array()
, array $rules= array()
)
$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.
array
array
array
addEntryAction(integer|string $state, \Zend_Search_Lucene_FSMAction $action)
Several entry actions are allowed. Action execution order is defined by addEntryAction() calls
integer
string
\Zend_Search_Lucene_FSMAction
addExitAction(integer|string $state, \Zend_Search_Lucene_FSMAction $action)
Several exit actions are allowed. Action execution order is defined by addEntryAction() calls
integer
string
\Zend_Search_Lucene_FSMAction
addInputAction(integer|string $state, $inputSymbol, \Zend_Search_Lucene_FSMAction $action)
Several input actions are allowed. Action execution order is defined by addInputAction() calls
integer
string
\Zend_Search_Lucene_FSMAction
addInputSymbol(integer|string $inputSymbol)
integer
string
addInputSymbols(array $inputAphabet)
array
addLexeme()
addLexemeChar()
addLexemeModifier()
addNumberLexeme()
addQuerySyntaxLexeme()
\Zend_Search_Lucene_Search_QueryParserException |
---|
addQuotedLexeme()
addRule(integer|string $sourceState, integer|string $input, integer|string $targetState, \Zend_Search_Lucene_FSMAction|null $inputAction = null
)
integer
string
integer
string
integer
string
\Zend_Search_Lucene_FSMAction
null
\Zend_Search_Exception |
---|
addRules(array $rules)
array structure: array( array(sourseState, input, targetState[, inputAction]), array(sourseState, input, targetState[, inputAction]), array(sourseState, input, targetState[, inputAction]), ... )
array
addState(integer|string $state)
integer
string
addStates(array $states)
array
addTransitionAction(integer|string $sourceState, integer|string $targetState, \Zend_Search_Lucene_FSMAction $action)
Several transition actions are allowed. Action execution order is defined by addTransitionAction() calls
integer
string
integer
string
\Zend_Search_Lucene_FSMAction
getState() : integer | string
integer
string
$state|nulllexModifierErrException()
process(mixed $input)
mixed
\Zend_Search_Exception |
---|
quoteWithinLexemeErrException()
reset()
setState(integer|string $state)
No any action is invoked
integer
string
\Zend_Search_Exception |
---|
tokenize(string $inputString, string $encoding) : array
string
string
\Zend_Search_Lucene_Search_QueryParserException |
---|
array
wrongNumberErrException()
_positionMsg() : string
string
_translateInput(string $char) : integer
string
integer
$_currentLexeme : string
$_currentState : integer | string
null
$_entryActions : array
array()
[state] => action
$_exitActions : array
array()
[state] => action
$_inputActions : array
array()
[state][input] => action
$_inputAphabet : array
array()
$_lexemes : array
$_queryString : array
$_queryStringPosition : integer
$_rules : array
array()
[sourceState][input] => targetState
$_states : array
array()
$_transitionActions : array
array()
[state1][state2] => action
IN_ASCII_DIGIT = 6
IN_CHAR = 7
IN_DECIMAL_POINT = 5
IN_ESCAPE_CHAR = 3
IN_LEXEME_MODIFIER = 2
IN_MUTABLE_CHAR = 8
IN_QUOTE = 4
IN_SYNT_CHAR = 1
IN_WHITE_SPACE = 0
QUERY_ASCIIDIGITS_CHARS = '0123456789'
QUERY_DOUBLECHARLEXEME_CHARS = '|&'
QUERY_LEXEMEMODIFIER_CHARS = '~^'
QUERY_MUTABLE_CHARS = '+-'
QUERY_SYNT_CHARS = ':()[]{}!|&'
QUERY_WHITE_SPACE_CHARS = " \n\r\t"
ST_ERROR = 9
ST_ESCAPED_CHAR = 4
ST_ESCAPED_QCHAR = 5
ST_LEXEME = 2
ST_LEXEME_MODIFIER = 6
ST_MANTISSA = 8
ST_NUMBER = 7
ST_QUOTED_LEXEME = 3
ST_SYNT_LEXEME = 1
ST_WHITE_SPACE = 0