org.jtool.jxplatform.wrapper
Class JxExpression

java.lang.Object
  extended byorg.jtool.jxplatform.wrapper.JxElement
      extended byorg.jtool.jxplatform.wrapper.JxDefUseExpression
          extended byorg.jtool.jxplatform.wrapper.JxExpression
Direct Known Subclasses:
JxMethodCall, JxVariable

public class JxExpression
extends JxDefUseExpression

An object wrapping the Expr elment.

Author:
Katsuhisa Maruyama

Field Summary
protected  java.lang.String sort
          The sort of this expression.
 
Fields inherited from class org.jtool.jxplatform.wrapper.JxDefUseExpression
defs, expressions, uses
 
Fields inherited from class org.jtool.jxplatform.wrapper.JxElement
element
 
Constructor Summary
protected JxExpression()
          Creates a new, empty object.
protected JxExpression(org.w3c.dom.Element elem)
          Creates a new object wrapping a Expr element.
 
Method Summary
 boolean equals(JxExpression jexpr)
          Tests if a given expression wrapper equals to this one.
 java.lang.String getCastedTypeFqn()
          Returns the fully-qualified name of the casted type of this expression.
 java.lang.String getCastedTypeName()
          Returns the name of the casted type of this expression.
 org.w3c.dom.Element getDotPrefix()
          Obtains the former element if this is the child of a dot element.
 JxStatement getJavaStatement()
          Obtains a statement wrapper defining this expression.
 java.lang.String getName()
          Returns the name of an accessed variable or called method in this exprression.
 java.lang.String getSort()
          Returns the sort of this expression.
 java.lang.String getTypeFqn()
          Returns the fully-qualified name of this expression.
 boolean isArrayCreation()
          Tests if this expression is the array creation.
 boolean isAssign()
          Tests if this expression is the assignment.
 boolean isConstructorCall()
          Tests if this expression is the constructor call.
 boolean isDotOperator()
          Tests if this expression has the dot operation.
static boolean isExpression(org.w3c.dom.Element elem)
          Tests if a given element equals to Expr.
 boolean isFieldAccess()
          Tests if this expression is the field access.
 boolean isInSimpleAssignment()
          Tests if this expression exists in a simple not complex statement.
 boolean isInstanceCreation()
          Tests if this expression is the instance creation.
 boolean isMethodCall()
          Tests if this expression is the method call.
 boolean isOpAssign()
          Tests if this expression is the assignment with an operator.
 boolean isParenthesis()
          Tests if this expression is the parenthesis.
 boolean isPostAssignment()
          Tests if this expression is the post assignment.
 boolean isPostDecrement()
          Tests if this expression is the post-decrement.
 boolean isPostIncrement()
          Tests if this expression is the post-increment.
 boolean isPreAssignment()
          Tests if this expression is the pre-assignment.
 boolean isPreDecrement()
          Tests if this expression is the pre-decrement.
 boolean isPreIncement()
          Tests if this expression is the pre-increment.
 boolean isSuperConstructorCall()
          Tests if this expression is the super-constructor call.
 boolean isSuperReference()
          Tests if this expression is super.
 boolean isThisConstructorCall()
          Tests if this expression is the this-constructor call.
 boolean isThisReference()
          Tests if this expression is this.
 boolean isVariableAccess()
          Tests if this expression is the variable access.
 void print()
          Displays information about this expression wrapper for debugging.
 
Methods inherited from class org.jtool.jxplatform.wrapper.JxDefUseExpression
addDefinedVariable, addDefinedVariableFirst, addUsedVariable, addUsedVariableFirst, clearDefinedVariable, clearUsedVariable, definesVariable, getDefinedVariables, getExpressions, getUsedVariables, removeDefinedVariable, removeUsedVariable, usesVariable
 
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

sort

protected java.lang.String sort
The sort of this expression.

Constructor Detail

JxExpression

protected JxExpression()
Creates a new, empty object.


JxExpression

protected JxExpression(org.w3c.dom.Element elem)
                throws JxWrapperException
Creates a new object wrapping a Expr element.

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

getSort

public java.lang.String getSort()
Returns the sort of this expression.

Returns:
The sort string.

getJavaStatement

public JxStatement getJavaStatement()
                             throws JxWrapperException
Obtains a statement wrapper defining this expression.

Returns:
The JavaStaement wrapper defining this expression.
Throws:
JxWrapperException - the creation of the wrapper fails.

isExpression

public static boolean isExpression(org.w3c.dom.Element elem)
Tests if a given element equals to Expr.

Parameters:
elem - An element of the DOM.
Returns:
true if the element equals to Expr.

equals

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

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

getName

public java.lang.String getName()
Returns the name of an accessed variable or called method in this exprression.

Returns:
The name string.

isAssign

public boolean isAssign()
Tests if this expression is the assignment.

Returns:
true> if this expression is the assignment.

isOpAssign

public boolean isOpAssign()
Tests if this expression is the assignment with an operator.

Returns:
true> if this expression is the assignment with an operator.

isPreAssignment

public boolean isPreAssignment()
Tests if this expression is the pre-assignment.

Returns:
true> if this expression is the pre-assignment.

isPreIncement

public boolean isPreIncement()
Tests if this expression is the pre-increment.

Returns:
true> if this expression is the pre-increment.

isPreDecrement

public boolean isPreDecrement()
Tests if this expression is the pre-decrement.

Returns:
true> if this expression is the pre-decrement.

isPostAssignment

public boolean isPostAssignment()
Tests if this expression is the post assignment.

Returns:
true> if this expression is the post assignment.

isPostIncrement

public boolean isPostIncrement()
Tests if this expression is the post-increment.

Returns:
true> if this expression is the post-increment.

isPostDecrement

public boolean isPostDecrement()
Tests if this expression is the post-decrement.

Returns:
true> if this expression is the post-decrement.

isVariableAccess

public boolean isVariableAccess()
Tests if this expression is the variable access.

Returns:
true> if this expression is the variable access.

isFieldAccess

public boolean isFieldAccess()
Tests if this expression is the field access.

Returns:
true> if this expression is the field access.

isDotOperator

public boolean isDotOperator()
Tests if this expression has the dot operation.

Returns:
true> if this expression has the dot operation.

isParenthesis

public boolean isParenthesis()
Tests if this expression is the parenthesis.

Returns:
true> if this expression is the parenthesis.

isConstructorCall

public boolean isConstructorCall()
Tests if this expression is the constructor call.

Returns:
true> if this expression is the canstructor call.

isThisConstructorCall

public boolean isThisConstructorCall()
Tests if this expression is the this-constructor call.

Returns:
true> if this expression is the super-constructor call.

isSuperConstructorCall

public boolean isSuperConstructorCall()
Tests if this expression is the super-constructor call.

Returns:
true> if this expression is the super-constructor call.

isMethodCall

public boolean isMethodCall()
Tests if this expression is the method call.

Returns:
true> if this expression is the methodcall.

isInstanceCreation

public boolean isInstanceCreation()
Tests if this expression is the instance creation.

Returns:
true> if this expression is the instance creation.

isArrayCreation

public boolean isArrayCreation()
Tests if this expression is the array creation.

Returns:
true> if this expression is the array creation.

isThisReference

public boolean isThisReference()
Tests if this expression is this.

Returns:
true> if this expression is this.

isSuperReference

public boolean isSuperReference()
Tests if this expression is super.

Returns:
true> if this expression is super.

getCastedTypeName

public java.lang.String getCastedTypeName()
Returns the name of the casted type of this expression.

Returns:
The name string of the casted type.

getCastedTypeFqn

public java.lang.String getCastedTypeFqn()
Returns the fully-qualified name of the casted type of this expression.

Returns:
The fuly-qualified name string of the casted type.

getDotPrefix

public org.w3c.dom.Element getDotPrefix()
Obtains the former element if this is the child of a dot element.

Returns:
The former element, null if this is not the child of a dot element.

getTypeFqn

public java.lang.String getTypeFqn()
Returns the fully-qualified name of this expression.

Returns:
The fully-qualified name string.

isInSimpleAssignment

public boolean isInSimpleAssignment()
Tests if this expression exists in a simple not complex statement.

Returns:
true if expression is in a simple statement.

print

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

Overrides:
print in class JxDefUseExpression