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))); }
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)); }
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)); }
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()); }
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)); }
public override BasicObject Plus(BasicObject r) { return(new Int(ToNumbre <int>() + r.ToNumbre <int>())); }
public override BasicObject Mul(BasicObject r) { return(new Bool(Value & r.ToNumbre <bool>())); }
public override BasicObject Like(BasicObject r) { var v = r.ToNumbre <bool>(); return(new Bool(Value == v)); }
public override BasicObject Lte(BasicObject r) { var v = r.ToNumbre <bool>(); return(new Bool(Value & v || !Value & v)); }
public override BasicObject Equal(BasicObject r) { return(new Bool(Value == r.ToNumbre <bool>())); }