private static SWLWorkflow <bool> traverse(SAFeSWL.ItemChoiceType element_name, SAFeSWL_OperationPrimitiveInvokeActionAsyncType workflow) { SAFeSWL_OperationPrimitiveInvokeActionAsyncType action = (SAFeSWL_OperationPrimitiveInvokeActionAsyncType)workflow; if (element_name == SAFeSWL.ItemChoiceType.start) { string handle = action.handle_id; string port_name = action.id_port; string action_name = action.action; return(new SWLWorkflowStart <bool> (handle, port_name, action_name)); } else if (element_name == SAFeSWL.ItemChoiceType.wait) { string handle = action.handle_id; return(new SWLWorkflowWait <bool> (handle)); } else if (element_name == SAFeSWL.ItemChoiceType.cancel) { string handle = action.handle_id; return(new SWLWorkflowCancel <bool> (handle)); } else { throw new Exception("convert_to_abstract_syntax/traverse: start/wait/cancel expected !"); } }
private static SWLWorkflow <bool> traverse(SAFeSWL.ItemChoiceType element_name, SAFeSWL_OperationAnyType workflow) { SWLWorkflow <bool> action = traverse((SAFeSWL_OperationAnyType)workflow); if (element_name == SAFeSWL.ItemChoiceType.iterate) { return(new SWLWorkflowIterate <bool> (action)); } else { throw new Exception("convert_to_abstract_syntax/traverse: iterate expected !"); } }
private static SWLWorkflow <bool> traverse(SAFeSWL.ItemChoiceType element_name, SAFeSWL_OperationPrimitiveInvokeActionType workflow) { SAFeSWL_OperationPrimitiveInvokeActionType action = (SAFeSWL_OperationPrimitiveInvokeActionType)workflow; if (element_name == SAFeSWL.ItemChoiceType.invoke) { string port_name = action.id_port; string action_name = action.action; return(new SWLWorkflowInvoke <bool> (port_name, action_name)); } else { throw new Exception("convert_to_abstract_syntax/traverse: invoke expected !"); } }
private static SWLWorkflow <bool> traverse(SAFeSWL.ItemChoiceType element_name, SAFeSWL_OperationPrimitiveType workflow) { if (element_name == SAFeSWL.ItemChoiceType.skip) { return(new SWLWorkflowSkip <bool>()); } else if (element_name == SAFeSWL.ItemChoiceType.@break) { return(new SWLWorkflowBreak <bool> ()); } else if (element_name == SAFeSWL.ItemChoiceType.@continue) { return(new SWLWorkflowBreak <bool> ()); } else { throw new Exception("convert_to_abstract_syntax/traverse: wait/break/continue expected !"); } }
private static SWLWorkflow <bool> traverse(SAFeSWL.ItemChoiceType element_name, SAFeSWL_OperationManyType workflow) { SWLWorkflow <bool>[] actions = traverse((SAFeSWL_OperationManyType)workflow); if (element_name == SAFeSWL.ItemChoiceType.sequence) { Console.WriteLine("AST SEQUENCE {0}", actions.Length); return(new SWLWorkflowSequence <bool> (actions)); } else if (element_name == SAFeSWL.ItemChoiceType.parallel) { Console.WriteLine("AST PARALLEL {0}", actions.Length); return(new SWLWorkflowParallel <bool> (actions)); } else { throw new Exception("convert_to_abstract_syntax/traverse: sequence/parallel expected !"); } }
private static SWLWorkflow <bool> traverse(SAFeSWL.ItemChoiceType element_name, SAFeSWL_IterateType workflow) { SWLWorkflow <bool> action; switch (workflow.ItemElementName) { case SAFeSWL.ItemChoiceType.skip: action = traverse(SAFeSWL.ItemChoiceType.skip, (SAFeSWL_OperationPrimitiveType)workflow.Item); break; case SAFeSWL.ItemChoiceType.@break: action = traverse(SAFeSWL.ItemChoiceType.@break, (SAFeSWL_OperationPrimitiveType)workflow.Item); break; case SAFeSWL.ItemChoiceType.@continue: action = traverse(SAFeSWL.ItemChoiceType.@continue, (SAFeSWL_OperationPrimitiveType)workflow.Item); break; case SAFeSWL.ItemChoiceType.start: action = traverse(SAFeSWL.ItemChoiceType.start, (SAFeSWL_OperationPrimitiveInvokeActionAsyncType)workflow.Item); break; case SAFeSWL.ItemChoiceType.wait: action = traverse(SAFeSWL.ItemChoiceType.wait, (SAFeSWL_OperationPrimitiveInvokeActionAsyncType)workflow.Item); break; case SAFeSWL.ItemChoiceType.invoke: action = traverse(SAFeSWL.ItemChoiceType.invoke, (SAFeSWL_OperationPrimitiveInvokeActionType)workflow.Item); break; case SAFeSWL.ItemChoiceType.cancel: action = traverse(SAFeSWL.ItemChoiceType.cancel, (SAFeSWL_OperationPrimitiveInvokeActionAsyncType)workflow.Item); break; case SAFeSWL.ItemChoiceType.sequence: action = traverse(SAFeSWL.ItemChoiceType.sequence, (SAFeSWL_OperationManyType)workflow.Item); break; case SAFeSWL.ItemChoiceType.parallel: action = traverse(SAFeSWL.ItemChoiceType.parallel, (SAFeSWL_OperationManyType)workflow.Item); break; case SAFeSWL.ItemChoiceType.choice: action = traverse(SAFeSWL.ItemChoiceType.choice, (SAFeSWL_OperationChoiceType)workflow.Item); break; case SAFeSWL.ItemChoiceType.iterate: action = traverse(SAFeSWL.ItemChoiceType.iterate, (SAFeSWL_IterateType)workflow.Item); break; default: action = null; break; } if (element_name == SAFeSWL.ItemChoiceType.iterate) { return(new SWLWorkflowIterate <bool>(action, workflow.exit, workflow.enter)); } else { throw new Exception("convert_to_abstract_syntax/traverse: iterate expected !"); } }
private static SWLWorkflow <bool> traverse(SAFeSWL.ItemChoiceType element_name, SAFeSWL_OperationChoiceType workflow) { if (element_name == SAFeSWL.ItemChoiceType.choice) { IList <SWLWorkflow <bool> > action_list; IList <Tuple <string, string> > guard_list; traverse(workflow.select, out action_list, out guard_list); SWLWorkflow <bool>[] actions = new SWLWorkflow <bool> [action_list.Count]; action_list.CopyTo(actions, 0); Tuple <string, string>[] guards = new Tuple <string, string> [guard_list.Count]; guard_list.CopyTo(guards, 0); return(new SWLWorkflowChoice <bool> (actions, guards)); } else { throw new Exception("convert_to_abstract_syntax/traverse: choice expected !"); } }