org.experlog.gencode
Class ExpParser

java.lang.Object
  extended by org.experlog.gencode.ExpParser

public class ExpParser
extends java.lang.Object


Field Summary
static int AND
           
static int CPAR
           
static int DIFF
           
static int DIV
           
static int EOL
           
static int EQUAL
           
 boolean evalexpr_
           
static int EXP
           
static int GE
           
static int GT
           
static int LE
           
static int LT
           
static int MINUS
           
static int MULT
           
static int NOT
           
static int OPAR
           
static int OR
           
static int PLUS
           
static int UMINUS
           
static int VALUE
           
 
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
 
Method Summary
 ExpOperand buildFormula(int minsize)
           
 int getPrecedence(int token)
           
 java.lang.String getRawString()
           
 int getToken()
           
 java.lang.String getWarning()
          Get and reset warning
 boolean isUnary(int operator)
           
static void main(java.lang.String[] args)
           
static java.lang.String opString(int op)
           
 ExpOperand parse()
           
 void setEvalExpr(boolean eval)
           
 void setWarning(java.lang.String w)
           
 ExpOperand toOperand(java.lang.Object o)
           
 int toOperator(java.lang.Object o)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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
Constructor Detail

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 parse
evalexpr - If false, only numeric expressions are parsed (boolean expressions are then considered as strings)
Method Detail

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