public function testExpressionResultat() { $action = Voicing_Action::singleton(); $res = $action->resultExpression('k', 'miaq', null); $att = '_k + miaq → _gmiaq'; $this->assertEquals($att, $res, ""); }
public static function make($string) { $logger = Logger::getLogger('ActionFactory.make'); $logger->debug("\$string= '{$string}'"); $action = null; $inside = null; if ($string != null) { $match = preg_match("/^[a-z]+\\((.+)\\)\$/", $string, $matches); if ($match) { $inside = $matches[1]; } } if ($string == null || $string == '-' || $string == '0') { //*** $action = null; //new Nulle(); } elseif ($string == '?') { //*** $action = Unknown_Action::singleton(); } elseif (startsWith($string, 'i(') || startsWith($string, 'ins(')) { //*** $action = Insertion_Action::singleton($inside); } elseif ($string == 's(' || $string == 'suppr(') { //*** $action = Specific_Deletion_Action::singleton($inside); } elseif (startsWith($string, 'si(') || startsWith($string, 'sins(') || startsWith($string, 'suppri(') || startsWith($string, 'supprins(')) { //*** $action = Deletion_and_Insertion_Action::singleton($inside); } elseif ($string == 's' || $string == 'suppr') { //*** $action = Deletion_Action::singleton(); } elseif ($string == 'son' || $string == 'sonor') { //*** $action = Voicing_Action::singleton(); } elseif ($string == 'nas' || $string == 'nasal') { //*** $action = Nasalization_Action::singleton(); } elseif ($string == 'n' || $string == 'neutre') { //*** $action = Neutral_Action::singleton(); } elseif ($string == 'a' || $string == 'assim') { //*** $action = Assimilation_Action::singleton(); } elseif ($string == 'allV') { //*** $action = Vowel_Lengthening_Action::singleton(); } elseif ($string == 'decap') { //*** $action = Self_Decapitation_Action::singleton(); } // else if (chaine.startsWith("iallV(") || chaine.startsWith("insallV(")) //*** // action = new InsertionEtAllongementDeVoyelle(chaine); // else if (chaine.equals("sallV") || chaine.equals("supprallV")) //*** // action = new SuppressionEtAllongementDeVoyelle(); if ($action != null) { $action->defString($string); } return $action; }
public static function singleton() { $logger = Logger::getLogger('Voicing_Action.singleton'); if (!isset(self::$instance)) { $c = __CLASS__; self::$instance = new $c(); } $logger->debug(self::$instance); return self::$instance; }