org.experlog.gencode
Class ExpParser
java.lang.Object
org.experlog.gencode.ExpParser
public class ExpParser
- extends java.lang.Object
Constructor Summary |
ExpParser(java.lang.String s)
Create a new ExpParser
Parse both boolean and numeric expressions |
ExpParser(java.lang.String s,
boolean evalexpr)
Create a new ExpParser
Parse both boolean and numeric expressions, or numeric expressions only |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
evalexpr_
public boolean evalexpr_
EOL
public static final int EOL
- See Also:
- Constant Field Values
VALUE
public static final int VALUE
- See Also:
- Constant Field Values
OPAR
public static final int OPAR
- See Also:
- Constant Field Values
CPAR
public static final int CPAR
- See Also:
- Constant Field Values
EXP
public static final int EXP
- See Also:
- Constant Field Values
MULT
public static final int MULT
- See Also:
- Constant Field Values
DIV
public static final int DIV
- See Also:
- Constant Field Values
PLUS
public static final int PLUS
- See Also:
- Constant Field Values
MINUS
public static final int MINUS
- See Also:
- Constant Field Values
AND
public static final int AND
- See Also:
- Constant Field Values
OR
public static final int OR
- See Also:
- Constant Field Values
NOT
public static final int NOT
- See Also:
- Constant Field Values
EQUAL
public static final int EQUAL
- See Also:
- Constant Field Values
DIFF
public static final int DIFF
- See Also:
- Constant Field Values
GT
public static final int GT
- See Also:
- Constant Field Values
LT
public static final int LT
- See Also:
- Constant Field Values
GE
public static final int GE
- See Also:
- Constant Field Values
LE
public static final int LE
- See Also:
- Constant Field Values
UMINUS
public static final int UMINUS
- See Also:
- Constant Field Values
ExpParser
public ExpParser(java.lang.String s)
- Create a new ExpParser
Parse both boolean and numeric expressions
- Parameters:
s
- The expression to parse
ExpParser
public ExpParser(java.lang.String s,
boolean evalexpr)
- Create a new ExpParser
Parse both boolean and numeric expressions, or numeric expressions only
- Parameters:
s
- The expression to parseevalexpr
- If false, only numeric expressions are parsed
(boolean expressions are then considered as strings)
setWarning
public void setWarning(java.lang.String w)
getWarning
public java.lang.String getWarning()
- Get and reset warning
setEvalExpr
public void setEvalExpr(boolean eval)
getRawString
public java.lang.String getRawString()
buildFormula
public ExpOperand buildFormula(int minsize)
throws java.io.IOException
- Throws:
java.io.IOException
isUnary
public boolean isUnary(int operator)
getToken
public int getToken()
throws java.io.IOException
- Throws:
java.io.IOException
toOperator
public int toOperator(java.lang.Object o)
toOperand
public ExpOperand toOperand(java.lang.Object o)
getPrecedence
public int getPrecedence(int token)
opString
public static java.lang.String opString(int op)
parse
public ExpOperand parse()
throws java.io.IOException
- Throws:
java.io.IOException
main
public static void main(java.lang.String[] args)
throws java.lang.Exception
- Throws:
java.lang.Exception