Ejemplo n.º 1
0
        public override BasicObject Gte(BasicObject r)
        {
            if (!r.IsNumbre())
            {
                throw null;
            }
            switch (r.GetPower())
            {
            case 0:
                return(new Bool(Value >= r.ToNumbre <int>()));

            case 1:
                return(new Bool(Value >= r.ToNumbre <int>()));

            case 2:
                return(new Bool(Value >= r.ToNumbre <float>()));

            case 3:
                return(new Bool(Value >= r.ToNumbre <long>()));

            case 4:
                return(new Bool(Value >= r.ToNumbre <long>()));

            case 5:
                return(new Bool(Value >= r.ToNumbre <double>()));
            }
            return(new Bool(false));
        }
Ejemplo n.º 2
0
        public override BasicObject Plus(BasicObject r)
        {
            if (!r.IsNumbre())
            {
                throw null;
            }
            switch (r.GetPower())
            {
            case 0:
                return(new Real(Value + r.ToNumbre <int>()));

            case 1:
                return(new Real(Value + r.ToNumbre <int>()));

            case 2:
                return(new Real(Value + r.ToNumbre <float>()));

            case 3:
                return(new Currency(Value + r.ToNumbre <long>()));

            case 4:
                return(new Currency(Value + r.ToNumbre <long>()));

            case 5:
                return(new Currency(Value + r.ToNumbre <double>()));
            }
            return(new Int(0));
        }
Ejemplo n.º 3
0
        public override BasicObject IDiv(BasicObject r)
        {
            if (!r.IsNumbre())
            {
                throw null;
            }
            switch (r.GetPower())
            {
            case 0:
                return(new Int((int)(Value / r.ToNumbre <int>())));

            case 1:
                return(new Int((int)(Value / r.ToNumbre <int>())));

            case 2:
                return(new Int(Convert.ToInt32(Value / r.ToNumbre <float>())));

            case 3:
                return(new Int(Convert.ToInt32(Value / r.ToNumbre <long>())));

            case 4:
                return(new Int(Convert.ToInt32(Value / r.ToNumbre <long>())));

            case 5:
                return(new Int(Convert.ToInt32(Value / r.ToNumbre <double>())));
            }
            return(new Error());
        }
Ejemplo n.º 4
0
        public override BasicObject Lth(BasicObject r)
        {
            if (!r.IsNumbre())
            {
                return(this);
            }
            int i = r.ToNumbre <int>();
            var v = Value ?? "";

            i = Expression.Swap(i, 0, v.Length);
            return(new Text(v.Substring(0, i)));
        }
Ejemplo n.º 5
0
        public override BasicObject Div(BasicObject r)
        {
            if (!r.IsNumbre())
            {
                throw null;
            }
            switch (r.GetPower())
            {
            case 0:
                var c = (Bool)r;
                if (c.Value)
                {
                    return(this);
                }
                else
                {
                    return(new Real(float.PositiveInfinity));
                }

            case 1:
                return(new Real(Value / r.ToNumbre <float>()));

            case 2:
                return(new Real(Value / r.ToNumbre <float>()));

            case 3:
                return(new Currency(Value / r.ToNumbre <double>()));

            case 4:
                return(new Currency(Value / r.ToNumbre <long>()));

            case 5:
                return(new Currency(Value / r.ToNumbre <double>()));
            }
            return(new Int(0));
        }