jeops.expressions
Class JavaExpr

java.lang.Object
  |
  +--jeops.expressions.JavaExpr
Direct Known Subclasses:
BinaryJavaExpr, ConstJavaExpr, ConstructorJavaExpr, FieldJavaExpr, MethodJavaExpr, UnaryJavaExpr, VarJavaExpr

public abstract class JavaExpr
extends java.lang.Object

This class models an expression of (our subset of) the java language.

Version:
0.04 23 Fev 1999 First version with the comments in English.
Author:
Carlos Figueira Filho (csff@di.ufpe.br)

Field Summary
static int BOOL
          Constant used to indicate that this expression's type is boolean.
static int INT
          Constant used to indicate that this expression's type is int.
static int OBJ
          Constant used to indicate that this expression's type is Object.
 
Constructor Summary
JavaExpr()
           
 
Method Summary
 void dump()
          Prints the tree for the expression of this precondition.
abstract  void dump(int spaces)
          Prints the tree for the expression of this precondition.
 boolean evaluateBool(SymbolicTable table)
          Returns the boolean result of this expression.
 int evaluateInt(SymbolicTable table)
          Returns the int result of this expression.
 java.lang.Object evaluateObj(SymbolicTable table)
          Returns in an object the result of the evaluation of this expression.
abstract  java.lang.Class getClasse()
          Returns an object representing the class of this expression.
 java.util.Enumeration identObjetos()
          Returns all object variable identifiers that are used in this expression.
 int numIdentObjetos()
          Returns the number of object identifiers (variables) in this expression.
 int tipo()
          Returns the type of this expression.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INT

public static final int INT
Constant used to indicate that this expression's type is int.

BOOL

public static final int BOOL
Constant used to indicate that this expression's type is boolean.

OBJ

public static final int OBJ
Constant used to indicate that this expression's type is Object. (or any of this subclasses).
Constructor Detail

JavaExpr

public JavaExpr()
Method Detail

dump

public void dump()
Prints the tree for the expression of this precondition. Useful for debugging.

dump

public abstract void dump(int spaces)
Prints the tree for the expression of this precondition. Useful for debugging.
Parameters:
spaces - the identation for the printed output.

evaluateBool

public boolean evaluateBool(SymbolicTable table)
                     throws MethodEvaluationException,
                            FieldAccessException
Returns the boolean result of this expression. If this is not a boolean expression, the value false will be returned.
Parameters:
table - the symbolic table where the values of the variables used within this rule are stored.
Throws:
MethodEvaluationException - if an exception was thrown while evaluating a method that may occur within this expression.
FieldAccessException - if an exception was thrown while accessing a field of an object that may occur in this expression.
Since:
0.03

evaluateInt

public int evaluateInt(SymbolicTable table)
                throws MethodEvaluationException,
                       FieldAccessException
Returns the int result of this expression. If this is not an integer expression, the value 0 (zero) will be returned.
Parameters:
table - the symbolic table where the values of the variables used within this rule are stored.
Throws:
MethodEvaluationException - if an exception was thrown while evaluating a method that may occur within this expression.
FieldAccessException - if an exception was thrown while accessing a field of an object that may occur in this expression.
Since:
0.03

evaluateObj

public java.lang.Object evaluateObj(SymbolicTable table)
                             throws MethodEvaluationException,
                                    FieldAccessException
Returns in an object the result of the evaluation of this expression. If needed, the result will be wrapped in one of the language wrapper classes for the primitive types.
Parameters:
table - the symbolic table where the values of the variables used within this rule are stored.
Throws:
MethodEvaluationException - if an exception was thrown while evaluating a method that may occur within this expression.
FieldAccessException - if an exception was thrown while accessing a field of an object that may occur in this expression.

getClasse

public abstract java.lang.Class getClasse()
Returns an object representing the class of this expression.

identObjetos

public java.util.Enumeration identObjetos()
Returns all object variable identifiers that are used in this expression.

numIdentObjetos

public int numIdentObjetos()
Returns the number of object identifiers (variables) in this expression.

tipo

public int tipo()
Returns the type of this expression.