infix2postfix
Class IntegerOperandManager

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

public class IntegerOperandManager
extends NumericOperandManager

This class represents integer operand manager. It follows "int" 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
IntegerOperandManager()
          No-arg constructor.
IntegerOperandManager(int radix)
          Constructor with 'radix' as argument.
IntegerOperandManager(VariableHolder varHolder)
          Constructor accepting custom "variable holder" as argument.
 
Method Summary
 java.lang.String convertForRadix(int result)
          Converts the result in decimal format to the radix system specified by radix associated with this operand manager.
 int getIntegerOperand(java.lang.Object operand)
          Returns operand in int 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

IntegerOperandManager

public IntegerOperandManager()
No-arg constructor.


IntegerOperandManager

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


IntegerOperandManager

public IntegerOperandManager(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 int and all variables having int value are valid operands.

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

getIntegerOperand

public int getIntegerOperand(java.lang.Object operand)
                      throws InvalidOperandException
Returns operand in int 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(int 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.