Example #1
0
 public IOperand Divide(IOperand rhs)
 {
     if (!(rhs is LongOperand))
         throw new RPN_Exception("Argument invalid in LongOperand.Divide : rhs");
     LongOperand oprResult = new LongOperand("Result", Type.GetType("System.Int64"));
     oprResult.Value = (long)this.Value / (long)((Operand)rhs).Value;
     return oprResult;
 }
Example #2
0
 /// <summary>
 /// Factory method to create corresponding Operands.
 /// Extended this method to create newer datatypes.
 /// </summary>
 /// <param name="szVarName"></param>
 /// <param name="varType"></param>
 /// <param name="varValue"></param>
 /// <returns></returns>
 public static Operand CreateOperand(string szVarName, Type varType, object varValue)
 {
     Operand oprResult = null;
     switch (varType.ToString())
     {
         case "System.Int32":
         case "System.Int64":
             oprResult = new LongOperand(szVarName, varValue);
             return oprResult;
         //case System.Decimal:
         //case System.Single:
         //	oprResult = new DecimalOperand( szVarName, varValue );
         //	return oprResult;
         //	break;
     }
     throw new RPN_Exception("Unhandled type : " + varType.ToString());
 }