public string[] RetrieveGoalList() { TaskNodeTraversalCallback nodeAction; List <string> goalList; nodeAction = null; goalList = new List <string>(); // Define lambda callback nodeAction = new TaskNodeTraversalCallback((taskNode) => { // Found a goal if (taskNode.Type == NODE_TYPE.GOAL) { goalList.Add(taskNode.Name); } // Continue traversing return(true); }); _tModel.TraverseTaskNodes(ref nodeAction); return(goalList.ToArray()); }
private TaskNodeList RetrieveAllGoalNodes() { TaskNodeTraversalCallback nodeAction; TaskNodeList goalList; nodeAction = null; goalList = new TaskNodeList(); // Define lambda callback nodeAction = new TaskNodeTraversalCallback((taskNode) => { // Found a goal if (taskNode.Type == NODE_TYPE.GOAL) { goalList.Add(taskNode); } // Continue traversing return(true); }); _tModel.TraverseTaskNodes(ref nodeAction); return(goalList); }
private bool TraverseChildNodesInternal(TaskNode taskNode, ref TaskNodeTraversalCallback nodeAction) { bool bContinueTraversing; bContinueTraversing = true; // If goal model, callback if (taskNode.Type == NODE_TYPE.GOAL) { bContinueTraversing = nodeAction(taskNode); if (bContinueTraversing) { // traverse children if (taskNode.HasChildNodes) { foreach (TaskNode node in taskNode.ChildNodes) { bContinueTraversing = TraverseChildNodesInternal(node, ref nodeAction); if (!bContinueTraversing) { break; } } } else { throw new ApplicationException("Task model definition error. Goal node must have children."); } } } return(bContinueTraversing); }
private TaskNodeList RetrieveAllGoalNodes() { TaskNodeTraversalCallback nodeAction; TaskNodeList goalList; nodeAction = null; goalList = new TaskNodeList(); // Define lambda callback nodeAction = new TaskNodeTraversalCallback((taskNode) => { // Found a goal if (taskNode.Type == NODE_TYPE.GOAL) { goalList.Add(taskNode); } // Continue traversing return true; }); _tModel.TraverseTaskNodes(ref nodeAction); return goalList; }
public void TraverseTaskNodes(ref TaskNodeTraversalCallback cbNodeAction) { TaskNode tNode; tNode = new TaskNode(RootNodes[0]); tNode.TraverseChildNodes(ref cbNodeAction); }
public void TraverseChildNodes(ref TaskNodeTraversalCallback nodeAction) { XmlNodeList nodes; TaskNode taskNode; nodes = _xmlNode.ChildNodes; foreach (XmlNode node in nodes) { // Convert to TaskNode taskNode = new TaskNode(node); if (!TraverseChildNodesInternal(taskNode, ref nodeAction)) { break; } } }
private TestOracle GenerateTestOracleByGoal(TaskNode goalNode) { TaskNodeTraversalCallback nodeAction; TaskNode goalTaskNode; MessageUnitList messagesList; goalTaskNode = null; messagesList = new MessageUnitList(); // Define lambda callback nodeAction = new TaskNodeTraversalCallback((taskNode) => { // Found the target goal if (taskNode.IsSameContent(goalNode)) { if (taskNode.HasChildNodes) { goalTaskNode = taskNode; foreach (TaskNode node in taskNode.ChildNodes) { messagesList.Add(_tAgentMapper.GetMessageUnitFromTask(node)); } } // Terminate node traversing return(false); } // Continue traversing return(true); }); _tModel.TraverseTaskNodes(ref nodeAction); // if error if (goalTaskNode == null) { throw new ApplicationException("Task node list cannot be null."); } return(new TestOracle(goalTaskNode, messagesList)); }
private COMPARISON_INFO CompareOutputInternal(string goalName, MessageUnitList actualOutput, COMPARISON_INFO comparisonInfo) { TaskNodeTraversalCallback nodeAction; bool bFoundGoal; nodeAction = null; bFoundGoal = false; comparisonInfo.Result = true; // Define lambda callback nodeAction = new TaskNodeTraversalCallback((taskNode) => { // Found the target goal if (taskNode.Name == goalName) { bFoundGoal = true; comparisonInfo = recCompareOutputInternal(actualOutput, taskNode.ChildNodes, comparisonInfo); // Terminate node traversing return false; } // Continue traversing return true; }); _tModel.TraverseTaskNodes(ref nodeAction); // if goal is not found, throw exception if (!bFoundGoal) { throw new ApplicationException(String.Format("Goal ({0}) is not found.", goalName)); } return comparisonInfo; }
private COMPARISON_INFO CompareOutputInternal(string goalName, MessageUnitList actualOutput, COMPARISON_INFO comparisonInfo) { TaskNodeTraversalCallback nodeAction; bool bFoundGoal; nodeAction = null; bFoundGoal = false; comparisonInfo.Result = true; // Define lambda callback nodeAction = new TaskNodeTraversalCallback((taskNode) => { // Found the target goal if (taskNode.Name == goalName) { bFoundGoal = true; comparisonInfo = recCompareOutputInternal(actualOutput, taskNode.ChildNodes, comparisonInfo); // Terminate node traversing return(false); } // Continue traversing return(true); }); _tModel.TraverseTaskNodes(ref nodeAction); // if goal is not found, throw exception if (!bFoundGoal) { throw new ApplicationException(String.Format("Goal ({0}) is not found.", goalName)); } return(comparisonInfo); }
private bool TraverseChildNodesInternal(TaskNode taskNode, ref TaskNodeTraversalCallback nodeAction) { bool bContinueTraversing; bContinueTraversing = true; // If goal model, callback if (taskNode.Type == NODE_TYPE.GOAL) { bContinueTraversing = nodeAction(taskNode); if (bContinueTraversing) { // traverse children if (taskNode.HasChildNodes) { foreach (TaskNode node in taskNode.ChildNodes) { bContinueTraversing = TraverseChildNodesInternal(node, ref nodeAction); if (!bContinueTraversing) { break; } } } else { throw new ApplicationException("Task model definition error. Goal node must have children."); } } } return bContinueTraversing; }
private TestOracle GenerateTestOracleByGoal(TaskNode goalNode) { TaskNodeTraversalCallback nodeAction; TaskNode goalTaskNode; MessageUnitList messagesList; goalTaskNode = null; messagesList = new MessageUnitList(); // Define lambda callback nodeAction = new TaskNodeTraversalCallback((taskNode) => { // Found the target goal if (taskNode.IsSameContent(goalNode)) { if (taskNode.HasChildNodes) { goalTaskNode = taskNode; foreach (TaskNode node in taskNode.ChildNodes) { messagesList.Add(_tAgentMapper.GetMessageUnitFromTask(node)); } } // Terminate node traversing return false; } // Continue traversing return true; }); _tModel.TraverseTaskNodes(ref nodeAction); // if error if (goalTaskNode == null) { throw new ApplicationException("Task node list cannot be null."); } return new TestOracle(goalTaskNode, messagesList); }
public string[] RetrieveGoalList() { TaskNodeTraversalCallback nodeAction; List<string> goalList; nodeAction = null; goalList = new List<string>(); // Define lambda callback nodeAction = new TaskNodeTraversalCallback((taskNode) => { // Found a goal if (taskNode.Type == NODE_TYPE.GOAL) { goalList.Add(taskNode.Name); } // Continue traversing return true; }); _tModel.TraverseTaskNodes(ref nodeAction); return goalList.ToArray(); }