import v1.1.0_beta1 | 2009-08-21
This commit is contained in:
@ -18,14 +18,9 @@
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Search_Lucene_FSMAction */
|
||||
require_once 'Zend/Search/Lucene/FSMAction.php';
|
||||
|
||||
/** Zend_Search_Exception */
|
||||
require_once 'Zend/Search/Exception.php';
|
||||
|
||||
|
||||
/**
|
||||
* Abstract Finite State Machine
|
||||
*
|
||||
@ -181,6 +176,7 @@ abstract class Zend_Search_Lucene_FSM
|
||||
public function setState($state)
|
||||
{
|
||||
if (!isset($this->_states[$state])) {
|
||||
require_once 'Zend/Search/Exception.php';
|
||||
throw new Zend_Search_Exception('State \'' . $state . '\' is not on of the possible FSM states.');
|
||||
}
|
||||
|
||||
@ -251,12 +247,15 @@ abstract class Zend_Search_Lucene_FSM
|
||||
public function addRule($sourceState, $input, $targetState, $inputAction = null)
|
||||
{
|
||||
if (!isset($this->_states[$sourceState])) {
|
||||
require_once 'Zend/Search/Exception.php';
|
||||
throw new Zend_Search_Exception('Undefined source state (' . $sourceState . ').');
|
||||
}
|
||||
if (!isset($this->_states[$targetState])) {
|
||||
require_once 'Zend/Search/Exception.php';
|
||||
throw new Zend_Search_Exception('Undefined target state (' . $targetState . ').');
|
||||
}
|
||||
if (!isset($this->_inputAphabet[$input])) {
|
||||
require_once 'Zend/Search/Exception.php';
|
||||
throw new Zend_Search_Exception('Undefined input symbol (' . $input . ').');
|
||||
}
|
||||
|
||||
@ -264,6 +263,7 @@ abstract class Zend_Search_Lucene_FSM
|
||||
$this->_rules[$sourceState] = array();
|
||||
}
|
||||
if (isset($this->_rules[$sourceState][$input])) {
|
||||
require_once 'Zend/Search/Exception.php';
|
||||
throw new Zend_Search_Exception('Rule for {state,input} pair (' . $sourceState . ', '. $input . ') is already defined.');
|
||||
}
|
||||
|
||||
@ -287,6 +287,7 @@ abstract class Zend_Search_Lucene_FSM
|
||||
public function addEntryAction($state, Zend_Search_Lucene_FSMAction $action)
|
||||
{
|
||||
if (!isset($this->_states[$state])) {
|
||||
require_once 'Zend/Search/Exception.php';
|
||||
throw new Zend_Search_Exception('Undefined state (' . $state. ').');
|
||||
}
|
||||
|
||||
@ -308,6 +309,7 @@ abstract class Zend_Search_Lucene_FSM
|
||||
public function addExitAction($state, Zend_Search_Lucene_FSMAction $action)
|
||||
{
|
||||
if (!isset($this->_states[$state])) {
|
||||
require_once 'Zend/Search/Exception.php';
|
||||
throw new Zend_Search_Exception('Undefined state (' . $state. ').');
|
||||
}
|
||||
|
||||
@ -330,9 +332,11 @@ abstract class Zend_Search_Lucene_FSM
|
||||
public function addInputAction($state, $inputSymbol, Zend_Search_Lucene_FSMAction $action)
|
||||
{
|
||||
if (!isset($this->_states[$state])) {
|
||||
require_once 'Zend/Search/Exception.php';
|
||||
throw new Zend_Search_Exception('Undefined state (' . $state. ').');
|
||||
}
|
||||
if (!isset($this->_inputAphabet[$inputSymbol])) {
|
||||
require_once 'Zend/Search/Exception.php';
|
||||
throw new Zend_Search_Exception('Undefined input symbol (' . $inputSymbol. ').');
|
||||
}
|
||||
|
||||
@ -358,9 +362,11 @@ abstract class Zend_Search_Lucene_FSM
|
||||
public function addTransitionAction($sourceState, $targetState, Zend_Search_Lucene_FSMAction $action)
|
||||
{
|
||||
if (!isset($this->_states[$sourceState])) {
|
||||
require_once 'Zend/Search/Exception.php';
|
||||
throw new Zend_Search_Exception('Undefined source state (' . $sourceState. ').');
|
||||
}
|
||||
if (!isset($this->_states[$targetState])) {
|
||||
require_once 'Zend/Search/Exception.php';
|
||||
throw new Zend_Search_Exception('Undefined source state (' . $targetState. ').');
|
||||
}
|
||||
|
||||
@ -384,9 +390,11 @@ abstract class Zend_Search_Lucene_FSM
|
||||
public function process($input)
|
||||
{
|
||||
if (!isset($this->_rules[$this->_currentState])) {
|
||||
require_once 'Zend/Search/Exception.php';
|
||||
throw new Zend_Search_Exception('There is no any rule for current state (' . $this->_currentState . ').');
|
||||
}
|
||||
if (!isset($this->_rules[$this->_currentState][$input])) {
|
||||
require_once 'Zend/Search/Exception.php';
|
||||
throw new Zend_Search_Exception('There is no any rule for {current state, input} pair (' . $this->_currentState . ', ' . $input . ').');
|
||||
}
|
||||
|
||||
@ -424,6 +432,7 @@ abstract class Zend_Search_Lucene_FSM
|
||||
public function reset()
|
||||
{
|
||||
if (count($this->_states) == 0) {
|
||||
require_once 'Zend/Search/Exception.php';
|
||||
throw new Zend_Search_Exception('There is no any state defined for FSM.');
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user