private static SWLWorkflow <bool> traverse(SAFeSWL_OperationAnyType workflow) { switch (workflow.ItemElementName) { case SAFeSWL.ItemChoiceType.skip: return(traverse(SAFeSWL.ItemChoiceType.skip, (SAFeSWL_OperationPrimitiveType)workflow.Item)); case SAFeSWL.ItemChoiceType.@break: return(traverse(SAFeSWL.ItemChoiceType.@break, (SAFeSWL_OperationPrimitiveType)workflow.Item)); case SAFeSWL.ItemChoiceType.@continue: return(traverse(SAFeSWL.ItemChoiceType.@continue, (SAFeSWL_OperationPrimitiveType)workflow.Item)); case SAFeSWL.ItemChoiceType.start: return(traverse(SAFeSWL.ItemChoiceType.start, (SAFeSWL_OperationPrimitiveInvokeActionAsyncType)workflow.Item)); case SAFeSWL.ItemChoiceType.wait: return(traverse(SAFeSWL.ItemChoiceType.wait, (SAFeSWL_OperationPrimitiveInvokeActionAsyncType)workflow.Item)); case SAFeSWL.ItemChoiceType.invoke: return(traverse(SAFeSWL.ItemChoiceType.invoke, (SAFeSWL_OperationPrimitiveInvokeActionType)workflow.Item)); case SAFeSWL.ItemChoiceType.cancel: return(traverse(SAFeSWL.ItemChoiceType.cancel, (SAFeSWL_OperationPrimitiveInvokeActionAsyncType)workflow.Item)); case SAFeSWL.ItemChoiceType.sequence: return(traverse(SAFeSWL.ItemChoiceType.sequence, (SAFeSWL_OperationManyType)workflow.Item)); case SAFeSWL.ItemChoiceType.parallel: return(traverse(SAFeSWL.ItemChoiceType.parallel, (SAFeSWL_OperationManyType)workflow.Item)); case SAFeSWL.ItemChoiceType.choice: return(traverse(SAFeSWL.ItemChoiceType.choice, (SAFeSWL_OperationChoiceType)workflow.Item)); case SAFeSWL.ItemChoiceType.iterate: return(traverse(SAFeSWL.ItemChoiceType.iterate, (SAFeSWL_IterateType)workflow.Item)); default: return(null); } /* if (workflow.Item is SAFeSWL_OperationPrimitiveType) * { * return traverse (workflow.ItemElementName, (SAFeSWL_OperationPrimitiveType) workflow.Item); * } * else if (workflow.Item is SAFeSWL_OperationPrimitiveInvokeActionAsyncType) * { * return traverse (workflow.ItemElementName, (SAFeSWL_OperationPrimitiveInvokeActionAsyncType) workflow.Item); * } * else if (workflow.Item is SAFeSWL_OperationPrimitiveInvokeActionType) * { * return traverse (workflow.ItemElementName, (SAFeSWL_OperationPrimitiveInvokeActionType) workflow.Item); * } * else if (workflow.Item is SAFeSWL_OperationManyType) * { * return traverse (workflow.ItemElementName, (SAFeSWL_OperationManyType) workflow.Item); * } * else if (workflow.Item is SAFeSWL_OperationChoiceType) * { * return traverse (workflow.ItemElementName, (SAFeSWL_OperationChoiceType) workflow.Item); * } * else if (workflow.Item is SAFeSWL_OperationAnyType) * { * return traverse (workflow.ItemElementName, (SAFeSWL_OperationAnyType) workflow.Item); * } * else * throw new Exception ("convert_to_abstract_syntax/traverse: UNRECOGNIZED SAFeSWL constructor."); */ }
public static SWLWorkflow <bool> convertoToSWLAbstractTree(SAFeSWL_OperationAnyType workflow) { return(traverse(workflow)); }
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 !"); } }