Esempio n. 1
0
 function actionTest($planList, $messages, $conditionID, $conditionMode)
 {
     $IDPosition = 0;
     $modePosition = 1;
     $valuePosition = 2;
     $match = false;
     $index = -1;
     while ($index < sizeof($planList) - 1 && !$match) {
         $index++;
         $actionNode = $planList[$index]->getAction();
         $actionNodeData = $actionNode->getData();
         $edgeProgression = $actionNodeData[0];
         $edgeActionValues = $edgeProgression->getPredicateValues();
         //$condition = $edgeActionValues[sizeof($edgeActionValues)-1];
         //$conditionValues = $condition->getPredicateValues();
         $conditionValue = $edgeActionValues[$valuePosition]->toString();
         //Examine the message
         $message = planningAgent::see($messages, $conditionID);
         //Finding the matching action packet
         $match = planningAgent::doit($planList[$index], $conditionMode, $conditionValue, $messages, $message, $conditionID);
     }
     if (!$match) {
         errors::errorMessage("No progression was found!");
     } else {
         //Check the chosen action packet
         if ($planList[$index]->atGoal()) {
             //At goal node
             planArchieving::archive($_POST['workflowID']);
             systemMessages::message("Goal Node reached!");
         }
     }
     return $planList[$index];
 }