Exemplo n.º 1
0
        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 !");
            }
        }
Exemplo n.º 2
0
        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 !");
            }
        }
Exemplo n.º 3
0
        private static SWLWorkflow <bool>[] traverse(SAFeSWL_OperationManyType workflow)
        {
            IList <SWLWorkflow <bool> > action_list = new List <SWLWorkflow <bool> > ();

            SAFeSWL_OperationManyType action = (SAFeSWL_OperationManyType)workflow;

            for (int i = 0; i < workflow.ItemsElementName.Length; i++)
            {
                switch (workflow.ItemsElementName [i])
                {
                case SAFeSWL.ItemsChoiceType.skip:
                    action_list.Add(traverse(SAFeSWL.ItemChoiceType.skip, (SAFeSWL_OperationPrimitiveType)workflow.Items[i]));
                    break;

                case SAFeSWL.ItemsChoiceType.@break:
                    action_list.Add(traverse(SAFeSWL.ItemChoiceType.@break, (SAFeSWL_OperationPrimitiveType)workflow.Items[i]));
                    break;

                case SAFeSWL.ItemsChoiceType.@continue:
                    action_list.Add(traverse(SAFeSWL.ItemChoiceType.@continue, (SAFeSWL_OperationPrimitiveType)workflow.Items[i]));
                    break;

                case SAFeSWL.ItemsChoiceType.start:
                    action_list.Add(traverse(SAFeSWL.ItemChoiceType.start, (SAFeSWL_OperationPrimitiveInvokeActionAsyncType)workflow.Items[i]));
                    break;

                case SAFeSWL.ItemsChoiceType.wait:
                    action_list.Add(traverse(SAFeSWL.ItemChoiceType.wait, (SAFeSWL_OperationPrimitiveInvokeActionAsyncType)workflow.Items[i]));
                    break;

                case SAFeSWL.ItemsChoiceType.invoke:
                    action_list.Add(traverse(SAFeSWL.ItemChoiceType.invoke, (SAFeSWL_OperationPrimitiveInvokeActionType)workflow.Items[i]));
                    break;

                case SAFeSWL.ItemsChoiceType.cancel:
                    action_list.Add(traverse(SAFeSWL.ItemChoiceType.cancel, (SAFeSWL_OperationPrimitiveInvokeActionAsyncType)workflow.Items[i]));
                    break;

                case SAFeSWL.ItemsChoiceType.sequence:
                    action_list.Add(traverse(SAFeSWL.ItemChoiceType.sequence, (SAFeSWL_OperationManyType)workflow.Items[i]));
                    break;

                case SAFeSWL.ItemsChoiceType.parallel:
                    action_list.Add(traverse(SAFeSWL.ItemChoiceType.parallel, (SAFeSWL_OperationManyType)workflow.Items[i]));
                    break;

                case SAFeSWL.ItemsChoiceType.choice:
                    action_list.Add(traverse(SAFeSWL.ItemChoiceType.choice, (SAFeSWL_OperationChoiceType)workflow.Items[i]));
                    break;

                case SAFeSWL.ItemsChoiceType.iterate:
                    action_list.Add(traverse(SAFeSWL.ItemChoiceType.iterate, (SAFeSWL_IterateType)workflow.Items[i]));
                    break;
                }
            }

            SWLWorkflow <bool>[] actions = new SWLWorkflow <bool> [action_list.Count];
            action_list.CopyTo(actions, 0);

            return(actions);
        }
Exemplo n.º 4
0
 public SWLWorkflowIterate(SWLWorkflow <T> iterate_action)
 {
     this.iterate_action = iterate_action;
 }
Exemplo n.º 5
0
 public SWLWorkflowIterate(SWLWorkflow <T> iterate_action, SAFeSWL.SAFeSWL_OperationPrimitiveInvokeActionType[] exit_clause, SAFeSWL.SAFeSWL_OperationPrimitiveInvokeActionType[] enter_clause)
 {
     this.iterate_action = iterate_action;
     this.exit_clause    = exit_clause;
     this.enter_clause   = enter_clause;
 }