Pattern
[ class tree: Pattern ] [ index: Pattern ] [ all elements ]

Source for file Pattern.php

Documentation is available at Pattern.php

  1. <?php
  2. /**
  3.  * Mai_Pattern
  4.  * 
  5.  * Copyright (C) 2009  Mai (Me Artificial Intelligence)
  6.  *
  7.  * This program is free software: you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License as published by
  9.  * the Free Software Foundation, either version 3 of the License, or
  10.  * (at your option) any later version.
  11.  *
  12.  * This program is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.  * GNU General Public License for more details.
  16.  *
  17.  * You should have received a copy of the GNU General Public License
  18.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  19.  * 
  20.  * @author Wouter Bulten (wouterbulten@mai-ai.org)
  21.  * @copyright Copyright (C) 2009  Mai (Me Artificial Intelligence)
  22.  * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
  23.  * @link http://www.launchpad.net/mai
  24.  * 
  25.  * @category Mai
  26.  * @package Pattern
  27.  */
  28.  
  29. /**
  30.  * Mai_Pattern holds a pattern.
  31.  * 
  32.  * @author Wouter Bulten (wouterbulten@mai-ai.org)
  33.  * @copyright Copyright (C) 2009  Mai (Me Artificial Intelligence)
  34.  * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
  35.  * @link http://www.launchpad.net/mai
  36.  * 
  37.  * @category Mai
  38.  * @package Pattern
  39.  *  
  40.  */
  41.  
  42. {
  43.     /**
  44.      * @var array Contains an array with words.
  45.      */
  46.     protected $_wordArray = array();
  47.  
  48.     /**
  49.      * @var string Contains the pattern.
  50.      */
  51.     protected $_pattern;
  52.  
  53.     /**
  54.      * @var array Contains the pattern.
  55.      */
  56.     protected $_patternArray;
  57.     
  58.     /**
  59.      * Constructor checks if Mai has been set up.
  60.      */
  61.     public function __construct(array $wordArray$patternarray $patternArray)
  62.     {
  63.         if(!Mai::isInit())
  64.         {
  65.             trigger_error('Mai has not been setup yet. Please use Mai::init().'E_USER_ERROR);
  66.         }
  67.         
  68.         if(!isset($pattern))
  69.         {
  70.             trigger_error('Pattern cannot be empty!');
  71.         }
  72.         
  73.         $this->_pattern $pattern;
  74.         $this->_patternArray $patternArray;
  75.         $this->_wordArray $wordArray;
  76.     }
  77.  
  78.     /**
  79.      * Return the created pattern.
  80.      * @return array 
  81.      */
  82.     public function returnPattern()
  83.     {
  84.         return $this->_pattern;
  85.     }
  86. }

Documentation generated on Mon, 27 Jul 2009 19:55:10 +0200 by phpDocumentor 1.4.1