|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.safs.SafsExpression.SafsExpression
Field Summary | |
protected boolean |
booErrors
|
protected boolean |
debugPrint
|
protected java.util.Hashtable |
hSafsVars
|
protected int |
iExpressionlength
|
protected int |
numDecimalPlaces
|
protected java.lang.String |
sExpression
|
protected java.lang.String |
strErrors
|
protected boolean |
stripLeadZero
|
protected boolean |
stripTrailingDecimalPoint
|
protected boolean |
stripTrailingZeros
|
protected java.util.Vector |
vQuoteLocs
|
protected java.util.Vector |
vSubStrings
|
protected java.util.Vector |
vVariableNames
|
Constructor Summary | |
SafsExpression(java.lang.String sText)
Method SafsExpression. |
Method Summary | |
protected java.lang.String |
dereferenceVariable(java.lang.String strText)
Method dereferenceVariable. |
java.lang.String |
evalExpression()
Method evalExpression. |
protected java.lang.String |
evalExpression(java.lang.String strExpr)
Method evalExpression. |
protected java.lang.String |
evalPrimative(java.lang.String strLeftOperand,
java.lang.String strOperator,
java.lang.String strRightOperand)
Method evalPrimative. |
protected java.lang.String |
evalSimple(java.lang.String strExpr)
Method evalSimple. |
java.lang.String |
getExpression()
Method getExpression. |
protected java.lang.String |
getLeftOperand(java.lang.String strExpr,
int iOperatorLoc)
Method getLeftOperand. |
java.util.Vector |
getQuoteLocs()
Method getQuoteLocs. |
protected java.lang.String |
getRightOperand(java.lang.String strExpr,
int iOperatorLoc)
Method getRightOperand. |
java.util.Vector |
getSubStrings()
Method getSubStrings. |
java.util.Hashtable |
getVarHash()
|
java.util.Vector |
getVariableNames()
Method getVariableNames. |
protected java.lang.String |
getVarValue(java.lang.String strVarName)
Method getVarValue. |
protected java.lang.String |
handleOperators(java.lang.String strExpr,
java.lang.String strOps)
Method handleOperators. |
protected void |
initData(java.lang.String sText)
Method initData. |
int |
numDecimalPlaces()
Method numDecimalPlaces. |
void |
numDecimalPlaces(int i)
Method numDecimalPlaces. |
void |
setExpression(java.lang.String sText)
Method setExpression. |
void |
setVarHash(java.util.Hashtable h)
|
protected void |
setVariableNames()
Method setVariableNames. |
protected void |
setVarValue(java.lang.String strVarName,
java.lang.String strVarValue)
Method setVarValue. |
boolean |
stripLeadZero()
Method stripLeadZero. |
void |
stripLeadZero(boolean b)
Method stripLeadZero. |
boolean |
stripTrailingDecimalPoint()
Method stripTrailingDecimalPoint. |
void |
stripTrailingDecimalPoint(boolean b)
Method stripTrailingDecimalPoint. |
boolean |
stripTrailingZeros()
Method stripTrailingZeros. |
void |
stripTrailingZeros(boolean b)
Method stripTrailingZeros. |
protected boolean |
validateParens()
Method validateParens. |
protected void |
validateVariableNames()
Method validateVariableNames. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.lang.String sExpression
protected int iExpressionlength
protected java.util.Vector vQuoteLocs
protected java.util.Vector vSubStrings
protected java.util.Vector vVariableNames
protected java.lang.String strErrors
protected boolean booErrors
protected boolean debugPrint
protected boolean stripLeadZero
protected boolean stripTrailingZeros
protected boolean stripTrailingDecimalPoint
protected int numDecimalPlaces
protected java.util.Hashtable hSafsVars
Constructor Detail |
public SafsExpression(java.lang.String sText) throws java.lang.Exception
sText
- The SAFS string expressionjava.lang.Exception
- Error messages such as unmatched parentheses or illegal variable namesMethod Detail |
public void setExpression(java.lang.String sText) throws java.lang.Exception
sText
- The SAFS string expressionjava.lang.Exception
- Error messages such as unmatched parentheses or illegal variable namespublic java.lang.String getExpression()
public java.util.Vector getQuoteLocs()
Integer
objects containing locations of the quotes (if any)public java.util.Vector getSubStrings()
String
objects containing quoted substrings of the expression (if any)public java.util.Vector getVariableNames()
String
objects that are the variables found within the expression sExpressionpublic void stripLeadZero(boolean b)
sets option to strip the leading zero from expression results. For example, if the expression evaluates to 0.1 and stripLeadZero is true, the result will be formatted such that the leading zero is not shown, which would be .1
b
- true or false specifying wheather or not leading zeros should be strippedpublic boolean stripLeadZero()
public void stripTrailingZeros(boolean b)
sets option to strip the trailing zeros from expression results. For example, if the expression evaluates to 1.100 and stripTrailingZeros is true, the result will be formatted such that the trailing zeros are not shown, which would be 1.1
b
- true or false specifying wheather or not trailing zeros should be strippedpublic boolean stripTrailingZeros()
public void stripTrailingDecimalPoint(boolean b)
sets option to strip the trailing decimal points from expression results. For example, if the expression evaluates to 1. and stripTrailingDecimalPoint is true, the result will be formatted such that the trailing zeros are not shown, which would be 1
b
- true or false specifying wheather or not trailing decimal points should be strippedpublic boolean stripTrailingDecimalPoint()
public void numDecimalPlaces(int i)
i
- int specifying the number of decimal places to round half up in division operationspublic int numDecimalPlaces()
public java.lang.String evalExpression()
protected void initData(java.lang.String sText) throws java.lang.Exception
sText
- The SAFS string expressionjava.lang.Exception
- Error messages such as unmatched parentheses or illegal variable namesprotected void setVariableNames()
protected boolean validateParens()
protected void validateVariableNames()
protected java.lang.String getVarValue(java.lang.String strVarName)
strVarName
- The name of the variable to retrieveprotected void setVarValue(java.lang.String strVarName, java.lang.String strVarValue)
strVarName
- The name of the variable to setstrVarValue
- The value to set the variable toprotected java.lang.String evalExpression(java.lang.String strExpr)
strExpr
- The expression to evaluateprotected java.lang.String evalSimple(java.lang.String strExpr)
strExpr
- The simple expression to evaluateprotected java.lang.String handleOperators(java.lang.String strExpr, java.lang.String strOps)
strExpr
- The expression to evaluatestrOps
- The operators to handle at the same precedence. For example "+-&" are
evaluated at the same precedence.protected java.lang.String dereferenceVariable(java.lang.String strText)
strText
- The string to check wich may or may not be a variableprotected java.lang.String getRightOperand(java.lang.String strExpr, int iOperatorLoc)
strExpr
- The expressioniOperatorLoc
- The int location of the operator within strExprprotected java.lang.String getLeftOperand(java.lang.String strExpr, int iOperatorLoc)
strExpr
- The expressioniOperatorLoc
- The int location of the operator within strExprprotected java.lang.String evalPrimative(java.lang.String strLeftOperand, java.lang.String strOperator, java.lang.String strRightOperand)
strLeftOperand
- The left operandstrOperator
- The operatorstrRightOperand
- The right operandpublic void setVarHash(java.util.Hashtable h)
public java.util.Hashtable getVarHash()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |