Example #1
0
 public MinusOperator()
 {
     Minus = Utils.MakeOperator(LConstants.MINUS_OP, 1, true,
                                (values, op) =>
     {
         op.CheckParamCount(values.Length);
         MeNumber result = values[0].Get <float>() - values[1].Get <float>();
         return(result);
     }, CommonValidators.TwoNumbers, CommonParamTypes.TwoNumbers);
 }
Example #2
0
 public PowerOperator()
 {
     Power = Utils.MakeOperator(LConstants.POWER_OP, 3, true,
                                (values, op) =>
     {
         op.CheckParamCount(values.Length);
         MeNumber result = (float)Math.Pow(values[0].Get <float>(), values[1].Get <float>());
         return(result);
     }, CommonValidators.TwoNumbers, CommonParamTypes.TwoNumbers);
 }
Example #3
0
 public AbsFunction()
 {
     Abs = Utils.MakeFunction(LConstants.ABS_F,
                              (values, func) =>
     {
         func.CheckParamCount(values.Length);
         MeNumber result = (float)Math.Abs(values[0].Get <float>());
         return(result);
     }, CommonParamTypes.SingleNumber, CommonValidators.SingleNumber);
 }
Example #4
0
 public DivideOperator()
 {
     Divide = Utils.MakeOperator(LConstants.DIVIDE_OP, 2, true,
                                 (values, op) =>
     {
         op.CheckParamCount(values.Length);
         MeNumber result = values[0].Get <float>() / values[1].Get <float>();
         return(result);
     }, CommonValidators.TwoNumbers, CommonParamTypes.TwoNumbers);
 }
Example #5
0
 public MultiplyOperator()
 {
     Multiply = Utils.MakeOperator(LConstants.MULITPLY_OP, 2, true,
                                   (values, op) =>
     {
         op.CheckParamCount(values.Length);
         MeNumber result = values[0].Get <float>() * values[1].Get <float>();
         return(result);
     }, CommonValidators.TwoNumbers, CommonParamTypes.TwoNumbers);
 }
Example #6
0
 public MaxFunction()
 {
     Max = Utils.MakeFunction(LConstants.MAX_F,
                              (values, func) =>
     {
         func.CheckParamCount(values.Length);
         float[] parameters = MeArray.ToFloatArray(values);
         MeNumber maxNumber = parameters.Max();
         return(maxNumber);
     }, CommonParamTypes.SingleNumber, CommonValidators.NumberArray, false);
 }
Example #7
0
 public NonNegFunction()
 {
     NonNeg = Utils.MakeFunction(LConstants.NON_NEG_F,
                                 (values, func) =>
     {
         func.CheckParamCount(values.Length);
         float value     = values[0].Get <float>();
         MeNumber result = value > 0 ? value : 0;
         return(result);
     }, CommonParamTypes.SingleNumber, CommonValidators.SingleNumber);
 }
Example #8
0
 public MinFunction()
 {
     Min = Utils.MakeFunction(LConstants.MIN_F,
                              (values, func) =>
     {
         func.CheckParamCount(values.Length);
         float[] parameters = MeArray.ToFloatArray(values);
         MeNumber result    = parameters.Min();
         return(result);
     }, CommonParamTypes.SingleNumber, CommonValidators.NumberArray, false);
 }