public override ISimpleOperation Evaluate(ISimpleOperation next) { // Compare against types. if (next.Value.HasValue) { if (Value.HasValue) { if (next.Value.Value == 0.0) throw new DivideByZeroException(); next.StoreValue(Value.Value / next.Value.Value); return next; } //else if (!string.IsNullOrWhiteSpace(String)) // next.StoreString(String.Replace(next.Value.ToString(CultureInfo.InvariantCulture), "")); } else if(next.Boolean.HasValue) throw new ArgumentException("Can't divide two booleans together."); //else if (!string.IsNullOrEmpty(next.String)) //{ // if (!double.IsNaN(Value)) // next.StoreString(Value.ToString(CultureInfo.InvariantCulture).Replace(next.String, "")); // else if (!string.IsNullOrWhiteSpace(String)) // next.StoreString(String.Replace(next.String, "")); //} return next; }
public override ISimpleOperation Evaluate(ISimpleOperation next) { // Compare against types. if (next.Value.HasValue) { if (Value.HasValue) { next.StoreValue(Value.Value % next.Value.Value); return next; } } return base.Evaluate(next); }
public override ISimpleOperation Evaluate(ISimpleOperation next) { // Compare against types. if (next.Value.HasValue) { if (Value.HasValue) { next.StoreValue(Value.Value + next.Value.Value); return next; } if (String != null) { next.StoreValue(String + next.Value.Value); return next; } if (Boolean.HasValue) throw new ArgumentException("Can't add two booleans together."); } else if (next.String != null) { if (Value.HasValue) { next.StoreValue(Value.Value + next.String); return next; } if (String != null) { next.StoreValue(String + next.String); return next; } if (Boolean.HasValue) throw new ArgumentException("Can't add two booleans together."); } else if (next.Boolean.HasValue) throw new ArgumentException("Can't add two booleans together."); return base.Evaluate(next); }
public override ISimpleOperation Evaluate(ISimpleOperation next) { // Compare against types. if (next.Value.HasValue) { if (Value.HasValue) { next.StoreValue(Value.Value - next.Value.Value); return next; } if (String != null) { next.StoreValue(String.Replace(next.Value.Value.ToString(CultureInfo.InvariantCulture), "")); return next; } if (Boolean.HasValue) throw new ArgumentException("Can't subtract two booleans together."); } else if (next.String != null) { if (Value.HasValue) { next.StoreValue(Value.Value.ToString(CultureInfo.InvariantCulture).Replace(next.String, "")); return next; } if (String != null) { next.StoreValue(String.Replace(next.String, "")); return next; } if (Boolean.HasValue) throw new ArgumentException("Can't subtract two booleans together."); } else if (next.Boolean.HasValue) throw new ArgumentException("Can't subtract two booleans together."); return base.Evaluate(next); }