Esempio n. 1
0
 /// <summary>
 /// returns extra bracnhes to be added into branches
 /// </summary>
 /// <param name="branches"></param>
 /// <returns></returns>
 public override List <ActionBranch> OnExport(BranchList branches, List <UInt32> usedBranches)
 {
     if (usedBranches.Contains(this.BranchId))
     {
         return(null);
     }
     usedBranches.Add(this.BranchId);
     if (_jumpToActionBranch != null)
     {
         _jumpToId = _jumpToActionBranch.FirstActionId;
         List <ActionBranch> list = new List <ActionBranch>();
         List <ActionBranch> l    = _jumpToActionBranch.OnExport(branches, usedBranches);
         if (l != null && l.Count > 0)
         {
             list.AddRange(l);
         }
         if (!_jumpToActionBranch.IsMergingPoint)
         {
             list.Add(_jumpToActionBranch);
         }
         return(list);
     }
     else
     {
         _jumpToId = 0;
     }
     return(null);
 }
Esempio n. 2
0
 protected override void OnVerifyJump(BranchList branch)
 {
     if (_jumpToId == 0)
     {
         List <ActionPortOut> aos = OutPortList;
         if (aos != null && aos.Count > 0)
         {
             if (aos[0].LinkedInPort != null)
             {
                 ActionBranch ab = aos[0].LinkedInPort.PortOwner as ActionBranch;
                 if (ab != null)
                 {
                     _jumpToId           = ab.BranchId;
                     _jumpToActionBranch = ab;
                 }
             }
         }
     }
     else
     {
         if (_jumpToId == FirstActionId)
         {
             _jumpToId = 0;
         }
     }
 }
Esempio n. 3
0
 public override void InitializeBranches(BranchList branches)
 {
     if (_ifJumpToId != 0)
     {
         if (_ifActions == null)
         {
             _ifActions = branches.GetJumpToActionBranch(_ifJumpToId);
             if (_ifActions == null)
             {
                 throw new DesignerException("Action for True branch not found (id={0})", _ifJumpToId);
             }
         }
     }
     else
     {
         _ifActions = null;
     }
     if (_elseJumpToId != 0)
     {
         if (_elseActions == null)
         {
             _elseActions = branches.GetJumpToActionBranch(_elseJumpToId);
             if (_elseActions == null)
             {
                 throw new DesignerException("Action for False branch not found (id={0})", _elseJumpToId);
             }
         }
     }
     else
     {
         _elseActions = null;
     }
 }
Esempio n. 4
0
 protected override void OnVerifyJump(BranchList branch)
 {
     if (_ifJumpToId == 0)
     {
         if (OutPortList[0].LinkedInPort != null)
         {
             ActionBranch ab = OutPortList[0].LinkedInPort.PortOwner as ActionBranch;
             if (ab != null)
             {
                 _ifJumpToId = ab.BranchId;
                 _ifActions  = ab;
             }
         }
     }
     if (_elseJumpToId == 0)
     {
         if (OutPortList[1].LinkedInPort != null)
         {
             ActionBranch ab = OutPortList[1].LinkedInPort.PortOwner as ActionBranch;
             if (ab != null)
             {
                 _elseJumpToId = ab.BranchId;
                 _elseActions  = ab;
             }
         }
     }
 }
Esempio n. 5
0
 public override void RemoveOutOfGroupBranches(BranchList branches)
 {
     if (_jumpToActionBranch != null)
     {
         _jumpToActionBranch.RemoveOutOfGroupBranches(branches);
     }
     base.RemoveOutOfGroupBranches(branches);
 }
 public override void MakePortLinkForSingleThread(List <UInt32> used, BranchList branch)
 {
     if (!used.Contains(this.BranchId))
     {
         used.Add(this.BranchId);
         base.MakePortLinkForSingleThread(used, branch);
     }
 }
Esempio n. 7
0
        public override void MakePortLinkForSingleThread(List <UInt32> used, BranchList branch)
        {
            ActionBranch ai = FirstAction;

            if (ai != null)
            {
                ai.MakePortLinkForSingleThread(used, branch);
            }
        }
Esempio n. 8
0
 public override void LinkJumpedBranches(BranchList branches)
 {
     if (_list != null)
     {
         foreach (ActionBranch br in _list)
         {
             br.LinkJumpedBranches(branches);
         }
     }
 }
Esempio n. 9
0
 public override void OnBeforeLoadIntoDesigner(BranchList branches)
 {
     if (_ifActions != null)
     {
         _ifActions.IsNotForDesigner = true;
     }
     if (_elseActions != null)
     {
         _elseActions.IsNotForDesigner = true;
     }
 }
Esempio n. 10
0
 public override void RemoveOutOfGroupBranches(BranchList branches)
 {
     if (_ifActions != null)
     {
         _ifActions.RemoveOutOfGroupBranches(branches);
     }
     if (_elseActions != null)
     {
         _elseActions.RemoveOutOfGroupBranches(branches);
     }
 }
Esempio n. 11
0
        public object Clone()
        {
            BranchList obj = new BranchList(_actsHolder);

            foreach (ActionBranch ab in this)
            {
                obj.Add((ActionBranch)ab.Clone());
            }
            obj.SetOwnerMethod(_method);
            obj.LinkJumpedBranches();
            return(obj);
        }
Esempio n. 12
0
 /// <summary>
 /// set NextActions and PreviousActions properties before compiling
 /// </summary>
 public override void LinkActions(BranchList branches)
 {
     if (_list != null)
     {
         for (int i = 1; i < _list.Count; i++)
         {
             MathNode.Trace("link action string [{0},{1}] <-> [{2},{3}]", _list[i - 1].BranchId, _list[i - 1].Name, _list[i].BranchId, _list[i].Name);
             _list[i - 1].SetNextAction(_list[i]);
             _list[i].SetPreviousAction(_list[i - 1]);
         }
     }
 }
Esempio n. 13
0
        /// <summary>
        /// set the branch content to the jump-to branches by matching branch IDs
        /// it is called after serialization
        /// </summary>
        /// <param name="branches"></param>
        public override void LinkJumpedBranches(BranchList branches)
        {
            InitializeBranches(branches);

            if (_ifActions != null)
            {
                _ifActions.LinkJumpedBranches(branches);
            }
            if (_elseActions != null)
            {
                _elseActions.LinkJumpedBranches(branches);
            }
        }
Esempio n. 14
0
 public override void MakePortLinkForSingleThread(List <UInt32> used, BranchList branch)
 {
     if (!used.Contains(this.BranchId))
     {
         used.Add(this.BranchId);
         base.MakePortLinkForSingleThread(used, branch);
         if (_list != null)
         {
             foreach (ActionBranch ab in _list)
             {
                 ab.MakePortLinkForSingleThread(used, branch);
             }
         }
     }
 }
Esempio n. 15
0
 public void AppendAction(ActionBranch a)
 {
     if (_list == null)
     {
         _list = new BranchList(this.ActionsHolder);
     }
     if (a.IsMergingPoint)
     {
         if (_list.Count > 0)
         {
             throw new DesignerException("Do not append a branching point to sequential actions");
         }
     }
     _list.Add(a);
 }
Esempio n. 16
0
        public void RemoveLocalVariable(ComponentIconLocal v, List <UInt32> usedBranches)
        {
            if (usedBranches.Contains(this.BranchId))
            {
                return;
            }
            usedBranches.Add(this.BranchId);
            ISubMethod af = this as ISubMethod;

            if (af != null)
            {
                af.ComponentIconList.Remove(v);
                if (v.ClassPointer != null)
                {
                    ComponentIconLocal cx = null;
                    foreach (ComponentIcon c in af.ComponentIconList)
                    {
                        ComponentIconLocal c0 = c as ComponentIconLocal;
                        if (c0 != null && c0.ClassPointer != null)
                        {
                            if (c0.ClassPointer.IsSameObjectRef(v.ClassPointer))
                            {
                                cx = c0;
                                break;
                            }
                        }
                    }
                    if (cx != null)
                    {
                        af.ComponentIconList.Remove(cx);
                    }
                }
            }
            BranchList acts = ActionList;

            if (acts != null)
            {
                foreach (ActionBranch ab in acts)
                {
                    AB_Squential abs = ab as AB_Squential;
                    if (abs != null)
                    {
                        abs.RemoveLocalVariable(v, usedBranches);
                    }
                }
            }
        }
        public override void Execute(List <ParameterClass> eventParameters)
        {
            BranchList _list = this.ActionList;

            if (_list != null)
            {
                //get the first action
                IList <ActionBranch> firstAction = getFirstAction();
                if (firstAction != null)
                {
                    foreach (ActionBranch ab in firstAction)
                    {
                        ab.Execute(eventParameters);
                    }
                }
            }
        }
Esempio n. 18
0
        /// <summary>
        /// set NextActions and PreviousActions properties before compiling
        /// </summary>
        public override void LinkActions(BranchList branches)
        {
            LinkJumpedBranches(branches);

            if (_ifActions != null)
            {
                this.SetNextAction(_ifActions);
                _ifActions.SetPreviousAction(this);
                _ifActions.LinkActions(branches);
            }
            if (_elseActions != null)
            {
                this.SetNextAction(_elseActions);
                _elseActions.SetPreviousAction(this);
                _elseActions.LinkActions(branches);
            }
        }
Esempio n. 19
0
 public override void InitializeBranches(BranchList branches)
 {
     if (_jumpToId != 0)
     {
         if (_jumpToActionBranch == null)
         {
             _jumpToActionBranch = branches.GetJumpToActionBranch(_jumpToId);
             if (_jumpToActionBranch == null)
             {
                 throw new DesignerException("JumpTo Action for action-list not found (id={0})", _jumpToId);
             }
         }
     }
     else
     {
         _jumpToActionBranch = null;
     }
 }
Esempio n. 20
0
 public override void RemoveOutOfGroupBranches(BranchList branches)
 {
     if (_list != null)
     {
         List <ActionBranch> l = new List <ActionBranch>();
         foreach (ActionBranch ab in _list)
         {
             if (!branches.ContainsAction(ab.BranchId))
             {
                 l.Add(ab);
             }
         }
         foreach (ActionBranch ab in l)
         {
             _list.Remove(ab);
         }
     }
 }
Esempio n. 21
0
        public override void LinkJumpedBranches(BranchList branches)
        {
            if (_jumpToId != 0)
            {
                if (_jumpToActionBranch == null || (_jumpToActionBranch.BranchId != _jumpToId && _jumpToActionBranch.FirstActionId != _jumpToId))
                {
                    _jumpToActionBranch = branches.GetJumpToActionBranch(_jumpToId);
                    if (_jumpToActionBranch == null)
                    {
                        throw new DesignerException("Invalid jump id [{0}] for branch [{1}]", _jumpToId, this.BranchId);
                    }

                    MathNode.Trace("Action string jump from [{0},{1}] to [{2},{3}]", this.BranchId, this.Name, _jumpToActionBranch.BranchId, _jumpToActionBranch.Name);
                }
                _jumpToActionBranch.SetPreviousAction(this);
                this.SetNextAction(_jumpToActionBranch);
            }
            base.LinkJumpedBranches(branches);
        }
        public override bool OnExportPhpScriptCode(ActionBranch previousAction, ActionBranch nextAction, StringCollection jsCode, StringCollection methodCode, JsMethodCompiler data)
        {
            BranchList _list = this.ActionList;

            if (_list != null)
            {
                //link both actions
                if (nextAction != null)
                {
                    if (!string.IsNullOrEmpty(OutputCodeName) && OutputType != null && !OutputType.IsVoid)
                    {
                        nextAction.InputName = OutputCodeName;
                        nextAction.InputType = OutputType;
                        nextAction.SetInputName(OutputCodeName, OutputType);
                    }
                }
                return(_list.ExportPhpScriptCode(jsCode, methodCode, data));
            }
            return(false);
        }
Esempio n. 23
0
        public void OnExport()
        {
            List <UInt32>       usedBranches = new List <uint>();
            List <ActionBranch> list         = new List <ActionBranch>();

            foreach (ActionBranch ab in this)
            {
                List <ActionBranch> l = ab.OnExport(this, usedBranches);
                if (l != null && l.Count > 0)
                {
                    list.AddRange(l);
                }
            }
            BranchList list2 = new BranchList(this._actsHolder);

            foreach (ActionBranch ab in list)
            {
                if (list2.GetBranchById(ab.BranchId) == null)
                {
                    if (list2.GetBranchById(ab.FirstActionId) == null)
                    {
                        list2.Add(ab);
                    }
                    else
                    {
                        DesignUtil.WriteToOutputWindow("Duplicated first branch {0}", ab.FirstActionId);
                    }
                }
                else
                {
                    DesignUtil.WriteToOutputWindow("Duplicated branch {0}", ab.BranchId);
                }
            }
            foreach (ActionBranch ab in list2)
            {
                if (GetBranchById(ab.BranchId) == null)
                {
                    this.Add(ab);
                }
            }
        }
        public override bool OnExportCode(ActionBranch previousAction, ActionBranch nextAction, ILimnorCodeCompiler compiler, CodeMemberMethod method, CodeStatementCollection statements)
        {
            BranchList _list = this.ActionList;

            if (_list != null)
            {
                //link both actions
                if (nextAction != null)
                {
                    if (!string.IsNullOrEmpty(OutputCodeName) && OutputType != null && !OutputType.IsVoid)
                    {
                        nextAction.InputName = OutputCodeName;
                        nextAction.InputType = OutputType;
                        nextAction.SetInputName(OutputCodeName, OutputType);
                    }
                }
                //
                CompilerUtil.ClearGroupGotoBranches(method, this.BranchId);
                bool bRet = _list.ExportCode(compiler, method, statements);
                bRet = CompilerUtil.FinishActionGroup(method, statements, this.BranchId, bRet);
                return(bRet);
            }
            return(false);
        }
 public override void LinkJumpedBranches(BranchList branches)
 {
 }