Esempio n. 1
0
 public override CalculationResult Substract(StringResult second)
 {
     if (string.IsNullOrEmpty(second.Value))
     {
         return(this);
     }
     throw new Exception("Can`t substract Number and String.");
 }
Esempio n. 2
0
 public override BoolResult IsLess(StringResult second)
 {
     if (string.IsNullOrEmpty(this.Value))
     {
         return(new BoolResult(false));
     }
     return(new BoolResult(string.Compare(this.Value, second.Value) == -1));
 }
Esempio n. 3
0
 public override BoolResult IsLess(StringResult second)
 {
     if (string.IsNullOrEmpty(second.Value))
     {
         return(new BoolResult(true));
     }
     return(new BoolResult(true));
 }
Esempio n. 4
0
 public override CalculationResult Multiply(StringResult second)
 {
     if (int.TryParse(this.Value, out var res))
     {
         return(new StringResult(string.Join("", Enumerable.Repeat(second.Value, res))));
     }
     else
     {
         throw new Exception("Cant multiply number and string.");
     }
 }
 public abstract BoolResult IsLess(StringResult second);
 public abstract BoolResult IsBigger(StringResult second);
 public abstract CalculationResult Divide(StringResult second);
 public abstract CalculationResult Multiply(StringResult second);
 public abstract CalculationResult Substract(StringResult second);
Esempio n. 10
0
 public override CalculationResult Multiply(StringResult second)
 {
     throw new Exception("Can`t multiply strings.");
 }
Esempio n. 11
0
 public override CalculationResult Substract(StringResult second)
 {
     throw new Exception("Can`t substract Strings.");
 }
Esempio n. 12
0
 public override CalculationResult Add(StringResult second)
 {
     return(new StringResult(this.Value + second.Value));
 }
Esempio n. 13
0
 public override CalculationResult Divide(StringResult second)
 {
     throw new Exception("Can`t divide strings.");
 }
Esempio n. 14
0
        public override CalculationResult Divide(StringResult second)
        {
            return(new NumberResult(0));

            throw new Exception("Can`t divide strings.");
        }