Operand corresponding to the Long (Int32/Int64) datatypes.
Inheritance: Operand, IArithmeticOperations, IComparisonOperations
Example #1
0
        public IOperand Modulo(IOperand rhs)
        {
            if (!(rhs is LongOperand))
            {
                throw new RPN_Exception("Argument invalid in LongOperand.Modulo : 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>
        static public 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());
        }
Example #3
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());
 }
Example #4
0
 /// IArithmeticOperations methods.  Return of these methods is again a LongOperand
 public IOperand Plus( IOperand rhs )
 {
     if( !(rhs is LongOperand) )
         throw new RPN_Exception("Argument invalid in LongOperand.Plus : rhs" );
     LongOperand oprResult = new LongOperand("Result", Type.GetType("System.Int64") );
     oprResult.Value = (long)this.Value + (long)((Operand)rhs).Value;
     return oprResult;
 }