//public static bool CompareState(GraphAgent a, GraphAgent b) //{ // return a.State == b.State; //} //public static CAProperty Operate(CAProperty property, CAOperator Operator, dynamic value) //{ // dynamic self = property.value; // switch(Operator) // { // case CAOperator.Equal: // self = value; // break; // case CAOperator.Addition: // self = self + value; // break; // case CAOperator.Subtraction: // self = self - value; // break; // case CAOperator.Division: // self = self / value; // break; // case CAOperator.Multiplication: // self = self * value; // break; // case CAOperator.Power: // self = Math.Pow(self, value); // break; // case CAOperator.Logarithm: // self = Math.Log(self, value); // break; // } // //CAProperty newProperty = new CAProperty(property.name, self); // return newProperty; //} //public static CAProperty Operate(dynamic value, CAOperator Operator, CAProperty otherProperty) //{ // dynamic self = value; // dynamic other = otherProperty.value; // switch (Operator) // { // case CAOperator.Equal: // self = other; // break; // case CAOperator.Addition: // self = self + other; // break; // case CAOperator.Subtraction: // self = self - other; // break; // case CAOperator.Division: // self = self / other; // break; // case CAOperator.Multiplication: // self = self * other; // break; // case CAOperator.Power: // self = Math.Pow(self, other); // break; // case CAOperator.Logarithm: // self = Math.Log(self, other); // break; // } // return self; //} public static dynamic Operate(dynamic a, CAOperator _operator, dynamic b) { switch (_operator) { case CAOperator.Equal: return(b); case CAOperator.Addition: return(a + b); case CAOperator.Subtraction: return(a - b); case CAOperator.Division: return(a / b); case CAOperator.Multiplication: return(a * b); case CAOperator.Power: return(Math.Pow(a, b)); case CAOperator.Logarithm: return(Math.Log(a, b)); default: return(0); } }
public CAThenChange(CATarget target, string property, CAOperator Operator, object value, double probability) : base(CAAction.Change, probability) { this.ChangeTarget = target; this.ChangeProperty = property; this.Operator = Operator; this.ChangeValue = value; Method = ChangeMethod.Value; }