|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object infix2postfix.Infix2PostfixClient infix2postfix.MathClient
This class represents client interface for Infix to postfix conversion and
postfix evaluation for mathematical expressions.
This math client supports operators like,
1. + 2. - 3. unary - 4. * 5. / 6. max (function operator)
1. int 2. long 3. float 4. double
Character.MIN_RADIX
and Character.MAX_RADIX
.
Nested Class Summary | |
static class |
MathClient.OperandManagers
Operand Manager's Enumeration. |
Field Summary | |
private static NumericOperandManager |
defaultOperandManager
Default operand manager for this math client |
static java.lang.Object |
NULL_OPERAND
DUMMY operand for this client used in unary operator calculations |
Fields inherited from class infix2postfix.Infix2PostfixClient |
operandManager |
Constructor Summary | |
MathClient()
No-arg constructor. |
|
MathClient(NumericOperandManager operandManager)
Constructs this object with given type of numeric operand manager. |
Method Summary | |
protected void |
addDefaultOperators()
Adds default supported operators to the "valid operators" list. |
java.lang.String |
convertForRadix(double result)
Converts double result to specific radix for the associated operand manager with this client. |
java.lang.String |
convertForRadix(float result)
Converts float result to specific radix for the associated operand manager with this client. |
java.lang.String |
convertForRadix(int result)
Converts int result to specific radix for the associated operand manager with this client. |
java.lang.String |
convertForRadix(long result)
Converts long result to specific radix for the associated operand manager with this client. |
protected static NumericOperandManager |
getDefaultOperandManager()
Returns default numeric operand manager. |
double |
getDoubleOperand(java.lang.Object operand)
Returns operand in double format. |
float |
getFloatOperand(java.lang.Object operand)
Returns operand in float format. |
int |
getIntegerOperand(java.lang.Object operand)
Returns operand in int format. |
long |
getLongOperand(java.lang.Object operand)
Returns operand in long format. |
int |
getRadix()
Returns the radix for the numeric operands associated with this client. |
void |
setRadix(int radix)
Sets the radix for the numeric operands. |
Methods inherited from class infix2postfix.Infix2PostfixClient |
addOperator, evaluate, getDefaultVariableHolder, getOperandManager, getVariableValue, removeOperator, setVariable |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.Object NULL_OPERAND
private static NumericOperandManager defaultOperandManager
Constructor Detail |
public MathClient()
getDefaultOperandManager
method.
getDefaultOperandManager()
public MathClient(NumericOperandManager operandManager)
Method Detail |
protected static NumericOperandManager getDefaultOperandManager()
OperandManagers#DOUBLE_OP_MANAGER
MathClient.OperandManagers.DOUBLE_OP_MANAGER
public java.lang.String convertForRadix(int result)
IntegerOperandManager.convertForRadix(int)
public int getIntegerOperand(java.lang.Object operand) throws InvalidOperandException
InvalidOperandException
IntegerOperandManager.getIntegerOperand(Object)
public java.lang.String convertForRadix(long result)
LongOperandManager.convertForRadix(long)
public long getLongOperand(java.lang.Object operand) throws InvalidOperandException
InvalidOperandException
LongOperandManager.getLongOperand(Object)
public java.lang.String convertForRadix(float result)
FloatOperandManager.convertForRadix(float)
public float getFloatOperand(java.lang.Object operand) throws InvalidOperandException
InvalidOperandException
FloatOperandManager.getFloatOperand(Object)
public java.lang.String convertForRadix(double result)
DoubleOperandManager.convertForRadix(double)
public double getDoubleOperand(java.lang.Object operand) throws InvalidOperandException
InvalidOperandException
DoubleOperandManager.getDoubleOperand(Object)
protected void addDefaultOperators()
addDefaultOperators
in class Infix2PostfixClient
addDefaultOperators()
,
BooleanClient.addDefaultOperators()
public void setRadix(int radix)
NumericOperandManager.setRadix(int)
public int getRadix()
NumericOperandManager.getRadix()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |