appclass.php
来自「SMC takes a state machine stored in a .s」· PHP 代码 · 共 84 行
PHP
84 行
<?php/* The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is State Machine Compiler (SMC). The Initial Developer of the Original Code is Charles W. Rapp. Portions created by Charles W. Rapp are Copyright (C) 2000 - 2003 Charles W. Rapp. All Rights Reserved. Contributor(s): Port to PHP by Toni Arnold Function Main Description This routine starts the finite state machine running. RCS ID $Id: AppClass.php,v 1.1 2008/04/22 15:58:41 fperrad Exp $ CHANGE LOG $Log: AppClass.php,v $ Revision 1.1 2008/04/22 15:58:41 fperrad - add PHP language (patch from Toni Arnold)*/require_once 'AppClass_sm.php';class AppClass { protected $_fsm; protected $_is_acceptable; public function __construct() { $this->_fsm = new AppClass_sm($this); $this->_is_acceptable = false; // Uncomment to see debug output. //$this->_fsm->setDebugFlag(true); } public function CheckString($string) { if ($string != "") { $array = str_split($string); foreach($array as $c) { if ($c == '0') { $this->_fsm->Zero(); } elseif ($c == '1') { $this->_fsm->One(); } elseif ($c == 'c' or $c == 'C') { $this->_fsm->C(); } else { $this->_fsm->Unknown(); } } } $this->_fsm->EOS(); return $this->_is_acceptable; } public function Acceptable() { $this->_is_acceptable = true; } public function Unacceptable() { $this->_is_acceptable = false; }}?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?