infix2postfix
Class FloatOperandManager

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

public class FloatOperandManager
extends NumericOperandManager

This class represents float operand manager. It follows "float" data types for operand values as "validity criteria". Note that radix for float 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
FloatOperandManager()
          No-arg constructor.
FloatOperandManager(VariableHolder varHolder)
          Constructor accepting custom "variable holder" as argument.
 
Method Summary
 java.lang.String convertForRadix(float result)
          Converts the result in decimal format to the radix system specified by radix associated with this operand manager.
 float getFloatOperand(java.lang.Object operand)
          Returns operand in float 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

FloatOperandManager

public FloatOperandManager()
No-arg constructor.


FloatOperandManager

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

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

getFloatOperand

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