function testNodesSimple()
 {
     $node = new node('', '');
     $this->assertEqual($node->getName(), $node->name);
     $this->assertEqual($node->getData(), $node->data);
     $this->assertEqual(node::getNodeData($node), '');
 }
 function actOnJavascriptPlanActions($actionPackets)
 {
     $plansConvergence = false;
     $constraintsArray = array();
     //Setup the javascript collections
     for ($index = 0; $index < sizeof($actionPackets); $index++) {
         $constraintsArray[$index] = new javaScriptCollection();
     }
     while (!$plansConvergence) {
         //Plans have have converged to a single plan
         $actionArray = array();
         $packetCollection = array();
         for ($index = 0; $index < sizeof($actionPackets); $index++) {
             $actionNode = $actionPackets[$index]->getAction();
             $data = $actionNode->getData();
             $actionPredicate = node::getNodeData($data);
             //Find the values for this conditional action
             $predicateValues = $actionPredicate->getPredicateValues();
             //Create a new javascript constraint
             $javaScriptConstraint = new javaScriptConstraint($predicateValues[1]->toString(), $predicateValues[2]->toString(), $predicateValues);
             //Add this constraint to the associated collection
             $constraintsArray[$index]->addConstraint($javaScriptConstraint);
             //Find the next action for this action packet
             $nextActionPackets = planAction::fetchNextAction($actionPackets[$index]->getPlans());
             $nextAction = $nextActionPackets[1];
             $actionArray[$index] = $nextAction[0]->toString();
             $packetCollection = array_merge($packetCollection, $nextActionPackets[0]);
         }
         $plansConvergence = arrays::allEqual($actionArray);
         if (!$plansConvergence) {
             $actionPackets = $packetCollection;
         }
     }
     //Plans must have convereged so it does not matter which one we return!
     return array('actionPackets' => $actionPackets[0], 'constraints' => $constraintsArray);
     //return $actionPackets[0];
 }
Example #3
0
     $edgeProgressionResult = $edgeProgressionPacket['match'];
     //Retrive the selected action packet
     $selectedActionPacket = $edgeProgressionPacket['actionPacket'];
     if ($edgeProgressionResult) {
         //The edgeprogression test succeded
         //Check the chosen action packet
         if ($selectedActionPacket->atGoal()) {
             //At goal node
             $goal = true;
             planArchieving::archive($_POST['workflowID']);
             systemMessages::message("Goal node reached!");
         } else {
             //Only one action packet should be returned
             $plans = $selectedActionPacket->getPlans();
             $newPlannerProgress = planAction::fetchNextAction($plans);
             $action = node::getNodeData($newPlannerProgress[1]);
             if ($action->getPredicateName() != 'edgeProgression') {
                 $match = true;
             } else {
             }
             $plannerProgress = $newPlannerProgress;
             $newPlannerProgress = array();
         }
     }
 }
 debug::message("edge progression test :" . $edgeProgressionResult);
 if ($edgeProgressionResult) {
     if (!$goal) {
         //No point in updating plans if we have reached the goal
         planningAgent::updatePlans($plans);
     }