org.jtool.jxplatform.wrapper
Class JxDefUseExpression

java.lang.Object
  extended byorg.jtool.jxplatform.wrapper.JxElement
      extended byorg.jtool.jxplatform.wrapper.JxDefUseExpression
Direct Known Subclasses:
JxExpression, JxField, JxLocal, JxStatement

public class JxDefUseExpression
extends JxElement

An object wrapping the element for an expression that might define and/or use a variable. This wrapper is common to Expr, JxStatement, JxField, and JxLocal.

Author:
Katsuhisa Maruyama

Field Summary
protected  JxVariableList defs
          The list of variables defined in this statement.
protected  org.w3c.dom.Element[] expressions
          The elements of expressions contained in this statement.
protected  JxVariableList uses
          The list of variables used in this statement.
 
Fields inherited from class org.jtool.jxplatform.wrapper.JxElement
element
 
Constructor Summary
protected JxDefUseExpression()
          Creates a new, empty object.
protected JxDefUseExpression(org.w3c.dom.Element elem)
          Creates a new object wrapping an element for an expressin with defined and/or used variables.
 
Method Summary
 void addDefinedVariable(JxVariable jv)
          Adds a variable into a variable list of defined variables in this expression.
 void addDefinedVariableFirst(JxVariable jv)
          Adds a variable into the head of a variable list of defined variables in this expression.
 void addUsedVariable(JxVariable jv)
          Adds a variable into a variable list of used variables in this expression.
 void addUsedVariableFirst(JxVariable jv)
          Adds a variable into the head of a variable list of used variables in this expression.
 void clearDefinedVariable()
          Removes all variables in a variable list of defined variables in this expression.
 void clearUsedVariable()
          Removes all variables in a variable list of used variables in this expression.
 boolean definesVariable()
          Tests if this statement defines any variable.
 boolean equals(JxExpression jexpr)
          Tests if a given expression wrapper equals to this one.
 JxVariableList getDefinedVariables()
          Returns the list of variables defined in this statement.
 org.w3c.dom.Element[] getExpressions()
          Obtains the elements of expressions contained in this statement.
 JxVariableList getUsedVariables()
          Returns the list of variables used in this statement.
 void print()
          Displays information about this statement wrapper for debugging.
 void removeDefinedVariable(JxVariable jv)
          Removes a variable from a variable list of defined variables in this expression.
 void removeUsedVariable(JxVariable jv)
          Removes a variable from a variable list of used variables in this expression.
 boolean usesVariable()
          Tests if this statement uses any variable.
 
Methods inherited from class org.jtool.jxplatform.wrapper.JxElement
equals, existInTheSameClass, existInTheSameField, existInTheSameFile, existInTheSameMethod, existsInTheSameClass, existsInTheSameFile, existsInTheSameMethod, existsInTheSamePackage, getArrayOfElements, getChildElement, getChildElement, getChildElements, getChildElements, getChildNodes, getChildNodes, getClassElement, getDescendantElements, getDescendantElements, getDescendantElements, getDescendantElements, getElement, getElementById, getExpressionElements, getFieldElement, getFileElement, getFirstChildElement, getFirstChildElement, getId, getId, getIdentName, getIdentName, getJxClass, getJxField, getJxFile, getJxMethod, getJxStaticInit, getKeyword, getLine, getMethodElement, getStatementElement, getStaticInitElement, getTypeElement, getTypeElements, getTypeName, indexOf, indexOf, isBinary, isClass, isClassOrInterface, isConstructor, isExpression, isField, isFile, isImport, isInterface, isInTheSameField, isLocal, isMethod, isMethodOrConstructor, isPackage, isParameter, isStatement, isStaticInit, isTerminalElement, isType, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

expressions

protected org.w3c.dom.Element[] expressions
The elements of expressions contained in this statement.


defs

protected JxVariableList defs
The list of variables defined in this statement.


uses

protected JxVariableList uses
The list of variables used in this statement.

Constructor Detail

JxDefUseExpression

protected JxDefUseExpression()
Creates a new, empty object.


JxDefUseExpression

protected JxDefUseExpression(org.w3c.dom.Element elem)
                      throws JxWrapperException
Creates a new object wrapping an element for an expressin with defined and/or used variables.

Parameters:
elem - An DOM element to be wrapped.
Throws:
JxWrapperException - if the specified element is not valid.
Method Detail

getExpressions

public org.w3c.dom.Element[] getExpressions()
Obtains the elements of expressions contained in this statement.

Returns:
The elements of the contained expressions.

equals

public boolean equals(JxExpression jexpr)
Tests if a given expression wrapper equals to this one.

Parameters:
jexpr - An expression wrapper.
Returns:
true if the expression wrapper equals to this one, otherwise false.

getDefinedVariables

public JxVariableList getDefinedVariables()
                                   throws JxWrapperException
Returns the list of variables defined in this statement.

Returns:
The JxVariableList containing variables defined in this statement.
Throws:
JxWrapperException - if the collection of variables fails.

getUsedVariables

public JxVariableList getUsedVariables()
                                throws JxWrapperException
Returns the list of variables used in this statement.

Returns:
The JxVariableList containing variables used in this statement.
Throws:
JxWrapperException - if the collection of variables fails.

definesVariable

public boolean definesVariable()
                        throws JxWrapperException
Tests if this statement defines any variable.

Returns:
true if this statement defines a variable.
Throws:
JxWrapperException - if the collection of variables fails.

usesVariable

public boolean usesVariable()
                     throws JxWrapperException
Tests if this statement uses any variable.

Returns:
true if this statement uses a variable.
Throws:
JxWrapperException - if the collection of variables fails.

addDefinedVariable

public void addDefinedVariable(JxVariable jv)
Adds a variable into a variable list of defined variables in this expression.


addUsedVariable

public void addUsedVariable(JxVariable jv)
Adds a variable into a variable list of used variables in this expression.


addDefinedVariableFirst

public void addDefinedVariableFirst(JxVariable jv)
Adds a variable into the head of a variable list of defined variables in this expression.


addUsedVariableFirst

public void addUsedVariableFirst(JxVariable jv)
Adds a variable into the head of a variable list of used variables in this expression.


removeDefinedVariable

public void removeDefinedVariable(JxVariable jv)
Removes a variable from a variable list of defined variables in this expression.


removeUsedVariable

public void removeUsedVariable(JxVariable jv)
Removes a variable from a variable list of used variables in this expression.


clearDefinedVariable

public void clearDefinedVariable()
Removes all variables in a variable list of defined variables in this expression.


clearUsedVariable

public void clearUsedVariable()
Removes all variables in a variable list of used variables in this expression.


print

public void print()
Displays information about this statement wrapper for debugging.