Example #1
0
        public bool IsGreaterThan(eeObject obj)
        {
            switch (this.type)
            {
            case eeObjectType.NUMBER:
                return(this.AsNumber() > obj.AsNumber());

            case eeObjectType.LIST:
                return(ListMathHelpers.GreaterThan(this, obj));

            case eeObjectType.STRING:
                return(StringMathHelpers.GreaterThan(this, obj));

            case eeObjectType.BOOL:
            default:
                throw new InvalidOperationException("TO DO");
            }
        }
Example #2
0
 public eeObject Multiply(eeObject exp)
 {
     if (this.type == eeObjectType.STRING || exp.type == eeObjectType.STRING)
     {
         return(StringMathHelpers.Multiply(this, exp));
     }
     else if (this.type == eeObjectType.LIST || exp.type == eeObjectType.LIST)
     {
         return(ListMathHelpers.Multiply(this, exp));
     }
     else if (this.type == eeObjectType.NUMBER && exp.type == eeObjectType.NUMBER) // regular arithmetic
     {
         return(eeObject.newNumberObject(this.AsNumber() * exp.AsNumber()));
     }
     else
     {
         throw new InvalidOperationError("multiplication", type, exp.type);
     }
 }
Example #3
0
 public eeObject Subtract(eeObject exp)
 {
     if (this.type == eeObjectType.STRING || exp.type == eeObjectType.STRING) // string math
     {
         return(StringMathHelpers.Subtract(this, exp));
     }
     else if (this.type == eeObjectType.LIST || exp.type == eeObjectType.LIST) // list math
     {
         return(ListMathHelpers.Subtract(this, exp));
     }
     else if (this.type == eeObjectType.NUMBER && exp.type == eeObjectType.NUMBER) // regular arithmetic
     {
         return(eeObject.newNumberObject(this.AsNumber() - exp.AsNumber()));
     }
     else
     {
         throw new InvalidOperationError("subtraction", type, exp.type);
     }
 }