infix2postfix
Class LongOperandManager

java.lang.Object
  extended byinfix2postfix.OperandManager
      extended byinfix2postfix.NumericOperandManager
          extended byinfix2postfix.LongOperandManager

public class LongOperandManager
extends NumericOperandManager

This class represents long operand manager. It follows "long" data types for operand values as "validity criteria".

Author:
Maulin H. Vasavada

Field Summary
 
Fields inherited from class infix2postfix.NumericOperandManager
DEFAULT_RADIX, radix
 
Fields inherited from class infix2postfix.OperandManager
varHolder
 
Constructor Summary
LongOperandManager()
          No-arg constructor.
LongOperandManager(int radix)
          Constructor with 'radix' as argument.
LongOperandManager(VariableHolder varHolder)
          Constructor accepting custom "variable holder" as argument.
 
Method Summary
 java.lang.String convertForRadix(long result)
          Converts the result in decimal format to the radix system specified by radix associated with this operand manager.
 long getLongOperand(java.lang.Object operand)
          Returns operand in long format.
 boolean isOperand(java.lang.Object symbol)
          Defines the validity criteria for operands accepted by this operand manager.
 
Methods inherited from class infix2postfix.NumericOperandManager
getRadix, setRadix
 
Methods inherited from class infix2postfix.OperandManager
getDefaultVariableHolder, getVariableHolder, getVariableValue, isVariable, setVariable, setVariableHolder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LongOperandManager

public LongOperandManager()
No-arg constructor.


LongOperandManager

public LongOperandManager(int radix)
Constructor with 'radix' as argument. This radix refers to the operands' radix system.


LongOperandManager

public LongOperandManager(VariableHolder varHolder)
Constructor accepting custom "variable holder" as argument.

Method Detail

isOperand

public boolean isOperand(java.lang.Object symbol)
Defines the validity criteria for operands accepted by this operand manager. A "valid variable" is also considered to be an operand.
"Validity criteria" for this operand manager is-
All symbols of type long and all variables having long value are valid operands.

Specified by:
isOperand in class OperandManager
Returns:
boolean true if the given symbol is of "long" type;false otherwise

getLongOperand

public long getLongOperand(java.lang.Object operand)
                    throws InvalidOperandException
Returns operand in long format.

Throws:
InvalidOperandException - If the given operand doesn't satisfy "validity criteria" defined for this manager.
See Also:
isOperand(Object)

convertForRadix

public java.lang.String convertForRadix(long result)
Converts the result in decimal format to the radix system specified by radix associated with this operand manager.

Returns:
java.lang.String Appropriate radix representation of the result.