infix2postfix
Class DoubleOperandManager

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

public class DoubleOperandManager
extends NumericOperandManager

This class represents double operand manager. It follows "double" data types for operand values as "validity criteria". Note that radix for double type operand can't be anything else than 10 (decimal system).

Author:
Maulin H. Vasavada

Field Summary
 
Fields inherited from class infix2postfix.NumericOperandManager
DEFAULT_RADIX, radix
 
Fields inherited from class infix2postfix.OperandManager
varHolder
 
Constructor Summary
DoubleOperandManager()
          No-arg constructor.
DoubleOperandManager(VariableHolder varHolder)
          Constructor accepting custom "variable holder" as argument.
 
Method Summary
 java.lang.String convertForRadix(double result)
          Converts the result in decimal format to the radix system specified by radix associated with this operand manager.
 double getDoubleOperand(java.lang.Object operand)
          Returns operand in double 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

DoubleOperandManager

public DoubleOperandManager()
No-arg constructor.


DoubleOperandManager

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

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

getDoubleOperand

public double getDoubleOperand(java.lang.Object operand)
                        throws InvalidOperandException
Returns operand in double 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(double result)
Converts the result in decimal format to the radix system specified by radix associated with this operand manager. As one can't specify radix other than 10 (decimal system) for double operands this method returns the argument by converting it into the string format without any coversion applied.

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