Exemplo n.º 1
0
        public static bool EvaluteAssignment(Agent pAgent, Property opl, Property opr, behaviac.CMethodBase opr_m)
        {
            bool bValid = false;

            if (opr_m != null)
            {
                object returnValue = opr_m.Invoke(pAgent);

                Agent pParentOpl = opl.GetParentAgent(pAgent);
                opl.SetValue(pParentOpl, returnValue);

                bValid = true;
            }
            else if (opr != null && opl != null)
            {
                Agent pParentL = opl.GetParentAgent(pAgent);
                Agent pParentR = opr.GetParentAgent(pAgent);

                opl.SetFrom(pParentR, opr, pParentL);

                bValid = true;
            }
            else
            {
                //Debug.Check(false);
            }

            return(bValid);
        }
Exemplo n.º 2
0
        public static bool EvaluteAssignment(Agent pAgent, Property opl, Property opr, behaviac.CMethodBase opr_m)
        {
            bool bValid = false;

            if (opl != null)
            {
                if (opr_m != null)
                {
                    object returnValue = opr_m.Invoke(pAgent);

                    Agent pParentOpl = opl.GetParentAgent(pAgent);
                    opl.SetValue(pParentOpl, returnValue);

                    bValid = true;
                }
                else if (opr != null)
                {
                    Agent pParentL = opl.GetParentAgent(pAgent);
                    Agent pParentR = opr.GetParentAgent(pAgent);

                    opl.SetFrom(pParentR, opr, pParentL);

                    bValid = true;
                }
            }

            return bValid;
        }
Exemplo n.º 3
0
        public static bool EvaluteCompute(Agent pAgent, Property opl, Property opr1, CMethodBase opr1_m, EComputeOperator opr, Property opr2, CMethodBase opr2_m)
        {
            bool   bValid = false;
            object value1 = null;

            if (opl != null)
            {
                if (opr1_m != null)
                {
                    bValid = true;
                    value1 = opr1_m.Invoke(pAgent);
                }
                else if (opr1 != null)
                {
                    bValid = true;
                    Agent pParentR = opr1.GetParentAgent(pAgent);

                    value1 = opr1.GetValue(pParentR);
                }

                Debug.Check(value1 != null, "weird, have you modified your meta? please reexport your trees");

                if (opr2_m != null)
                {
                    bValid = true;
                    object value2 = opr2_m.Invoke(pAgent);

                    Agent  pParentOpl  = opl.GetParentAgent(pAgent);
                    object returnValue = Details.ComputeValue(value1, value2, opr);

                    opl.SetValue(pParentOpl, returnValue);
                }
                else if (opr2 != null)
                {
                    bValid = true;
                    Agent pParentL = opl.GetParentAgent(pAgent);
                    Agent pParentR = opr2.GetParentAgent(pAgent);

                    object value2 = opr2.GetValue(pParentR);

                    object returnValue = Details.ComputeValue(value1, value2, opr);

                    opl.SetValue(pParentL, returnValue);
                }
            }

            return(bValid);
        }
        public static bool EvaluteCompute(Agent pAgent, Property opl, Property opr1, CMethodBase opr1_m, EComputeOperator opr, Property opr2, CMethodBase opr2_m)
        {
            bool bValid = false;
            object value1 = null;

            if (opl != null)
            {
                if (opr1_m != null)
                {
                    bValid = true;
                    value1 = opr1_m.Invoke(pAgent);
                }
                else if (opr1 != null)
                {
                    bValid = true;
                    Agent pParentR = opr1.GetParentAgent(pAgent);

                    value1 = opr1.GetValue(pParentR);
                }

                if (opr2_m != null)
                {
                    bValid = true;
                    object value2 = opr2_m.Invoke(pAgent);

                    Agent pParentOpl = opl.GetParentAgent(pAgent);
                    object returnValue = Details.ComputeValue(value1, value2, opr);

                    opl.SetValue(pParentOpl, returnValue);
                }
                else if (opr2 != null)
                {
                    bValid = true;
                    Agent pParentL = opl.GetParentAgent(pAgent);
                    Agent pParentR = opr2.GetParentAgent(pAgent);

                    object value2 = opr2.GetValue(pParentR);

                    object returnValue = Details.ComputeValue(value1, value2, opr);

                    opl.SetValue(pParentL, returnValue);
                }
            }

            return bValid;
        }
Exemplo n.º 5
0
        public static bool EvaluteCompute(Agent pAgent, Property opl, Property opr1, CMethodBase opr1_m, EComputeOperator opr, Property opr2, CMethodBase opr2_m)
        {
            bool   bValid = false;
            object value1 = null;

            if (opl != null)
            {
                if (opr1_m != null)
                {
                    bValid = true;
                    value1 = opr1_m.Invoke(pAgent);
                }
                else if (opr1 != null)
                {
                    bValid = true;
                    Agent pParentR = opr1.GetParentAgent(pAgent);

                    value1 = opr1.GetValue(pParentR);
                }

                if (opr2_m != null)
                {
                    bValid = true;
                    object value2 = opr2_m.Invoke(pAgent);

                    Agent  pParentOpl  = opl.GetParentAgent(pAgent);
                    object returnValue = Details.ComputeValue(value1, value2, opr);

                    opl.SetValue(pParentOpl, returnValue);
                }
                else if (opr2 != null)
                {
                    bValid = true;
                    Agent pParentL = opl.GetParentAgent(pAgent);
                    Agent pParentR = opr2.GetParentAgent(pAgent);

                    object value2 = opr2.GetValue(pParentR);

                    object returnValue = Details.ComputeValue(value1, value2, opr);

                    opl.SetValue(pParentL, returnValue);
                }
            }

            return(bValid);
        }
        public static bool DoCompare(Agent pAgent, VariableComparator comparator, Property opl, CMethodBase opl_m, Property opr, CMethodBase opr_m)
        {
            bool bResult = false;
            if (opl != null)
            {
                Agent agent_left = opl.GetParentAgent(pAgent);
                Agent agent_right = opr != null ? opr.GetParentAgent(pAgent) : opr_m.GetParentAgent(pAgent);

                bResult = comparator.Execute(agent_left, agent_right);
            }
            else if (opl_m != null)
            {
                Agent agent_left = opl_m.GetParentAgent(pAgent);

                object returnValue = opl_m.Invoke(agent_left, pAgent);

                Agent agent_right = opr != null ? opr.GetParentAgent(pAgent) : opr_m.GetParentAgent(pAgent);

                bResult = comparator.Execute(returnValue, agent_left, agent_right);
            }

            return bResult;
        }
Exemplo n.º 7
0
        public static bool DoCompare(Agent pAgent, VariableComparator comparator, Property opl, CMethodBase opl_m, Property opr, CMethodBase opr_m)
        {
            bool bResult = false;

            if (opl != null)
            {
                Agent agent_left  = opl.GetParentAgent(pAgent);
                Agent agent_right = opr != null?opr.GetParentAgent(pAgent) : opr_m.GetParentAgent(pAgent);

                bResult = comparator.Execute(agent_left, agent_right);
            }
            else if (opl_m != null)
            {
                Agent agent_left = opl_m.GetParentAgent(pAgent);

                object returnValue = opl_m.Invoke(agent_left, pAgent);

                Agent agent_right = opr != null?opr.GetParentAgent(pAgent) : opr_m.GetParentAgent(pAgent);

                bResult = comparator.Execute(returnValue, agent_left, agent_right);
            }

            return(bResult);
        }
Exemplo n.º 8
0
        public static bool EvaluteCompute(Agent pAgent, Property opl, Property opr1, CMethodBase opr1_m, EComputeOperator opr, Property opr2, CMethodBase opr2_m)
        {
            bool bValid = false;
            object value1 = null;

            if (opl != null)
            {
            if (opr1_m != null)
            {
                bValid = true;
                value1 = opr1_m.Invoke(pAgent);
            }
            else if (opr1 != null)
            {
                bValid = true;
                Agent pParentR = opr1.GetParentAgent(pAgent);

                value1 = opr1.GetValue(pParentR);
            }

            Debug.Check(value1 != null, "weird, have you modified your meta? please reexport your trees");

            if (opr2_m != null)
            {
                bValid = true;
                object value2 = opr2_m.Invoke(pAgent);

                Agent pParentOpl = opl.GetParentAgent(pAgent);
                object returnValue = Details.ComputeValue(value1, value2, opr);

                opl.SetValue(pParentOpl, returnValue);
            }
            else if (opr2 != null)
            {
                bValid = true;
                Agent pParentL = opl.GetParentAgent(pAgent);
                Agent pParentR = opr2.GetParentAgent(pAgent);

                object value2 = opr2.GetValue(pParentR);

                object returnValue = Details.ComputeValue(value1, value2, opr);

                opl.SetValue(pParentL, returnValue);
            }
            }

            return bValid;
        }