Esempio n. 1
0
            protected override EBTStatus update(Agent pAgent, EBTStatus childStatus)
            {
                EBTStatus result = EBTStatus.BT_SUCCESS;

                Debug.Check(this.GetNode() is Assignment);
                Assignment pAssignmentNode = (Assignment)(this.GetNode());

                if (pAssignmentNode.m_opr_m != null)
                {
                    ParentType pt      = pAssignmentNode.m_opr_m.GetParentType();
                    Agent      pParent = pAgent;
                    if (pt == ParentType.PT_INSTANCE)
                    {
                        pParent = Agent.GetInstance(pAssignmentNode.m_opr_m.GetInstanceNameString(), pParent.GetContextId());
                        Debug.Check(pParent != null || Utils.IsStaticClass(pAssignmentNode.m_opr_m.GetInstanceNameString()));
                    }

                    object returnValue = pAssignmentNode.m_opr_m.run(pParent, pAgent);
                    if (pAssignmentNode.m_opl != null)
                    {
                        ParentType pt_opl     = pAssignmentNode.m_opl.GetParentType();
                        Agent      pParentOpl = pAgent;
                        if (pt_opl == ParentType.PT_INSTANCE)
                        {
                            pParentOpl = Agent.GetInstance(pAssignmentNode.m_opl.GetInstanceNameString(), pParentOpl.GetContextId());
                            Debug.Check(pParentOpl != null || Utils.IsStaticClass(pAssignmentNode.m_opl.GetInstanceNameString()));
                        }

                        pAssignmentNode.m_opl.SetValue(pParentOpl, returnValue);
                    }
                }
                else if (pAssignmentNode.m_opr != null && pAssignmentNode.m_opl != null)
                {
                    Agent pParentL = pAgent;
                    Agent pParentR = pAgent;

                    {
                        ParentType pt = pAssignmentNode.m_opl.GetParentType();
                        if (pt == ParentType.PT_INSTANCE)
                        {
                            pParentL = Agent.GetInstance(pAssignmentNode.m_opl.GetInstanceNameString(), pParentL.GetContextId());
                            Debug.Check(pParentL != null || Utils.IsStaticClass(pAssignmentNode.m_opl.GetInstanceNameString()));
                        }
                    }
                    {
                        ParentType pt = pAssignmentNode.m_opr.GetParentType();
                        if (pt == ParentType.PT_INSTANCE)
                        {
                            pParentR = Agent.GetInstance(pAssignmentNode.m_opr.GetInstanceNameString(), pParentR.GetContextId());

                            //it is a const
                            if (pParentR == null)
                            {
                                pParentR = pParentL;
                            }
                        }
                    }

                    pAssignmentNode.m_opl.SetFrom(pParentR, pAssignmentNode.m_opr, pParentL);
                }
                else
                {
                    result = pAssignmentNode.update_impl(pAgent, childStatus);
                }

                return(result);
            }