net.sourceforge.pmd.symboltable

Class NameOccurrence

public class NameOccurrence extends Object

BSD-style license; for more info see http://pmd.sourceforge.net/license.html
Constructor Summary
NameOccurrence(SimpleNode location, String image)
Method Summary
intgetArgumentCount()
StringgetImage()
SimpleNodegetLocation()
NameOccurrencegetNameForWhichThisIsAQualifier()
booleanisMethodOrConstructorInvocation()
booleanisOnLeftHandSide()

A handy method to assert if the name is on the right hand side or the left hand side of an expression.

booleanisOnRightHandSide()
booleanisPartOfQualifiedName()
booleanisSelfAssignment()
Assert it the occurrence is a self assignment such as: i += 3;
booleanisThisOrSuper()
Simply return true is the image is equal to keyword 'this' or 'super'.
voidsetArgumentCount(int count)
voidsetIsMethodOrConstructorInvocation()
voidsetNameWhichThisQualifies(NameOccurrence qualifiedName)
booleanuseThisOrSuper()
Simply return if the image start with keyword 'this' or 'super'.

Constructor Detail

NameOccurrence

public NameOccurrence(SimpleNode location, String image)

Method Detail

getArgumentCount

public int getArgumentCount()

getImage

public String getImage()

getLocation

public SimpleNode getLocation()

getNameForWhichThisIsAQualifier

public NameOccurrence getNameForWhichThisIsAQualifier()

isMethodOrConstructorInvocation

public boolean isMethodOrConstructorInvocation()

isOnLeftHandSide

public boolean isOnLeftHandSide()

A handy method to assert if the name is on the right hand side or the left hand side of an expression. One basic example: obj.getMethod(); // Name "getMethod()" returns false, "obj" returns true

Returns:

isOnRightHandSide

public boolean isOnRightHandSide()

isPartOfQualifiedName

public boolean isPartOfQualifiedName()

isSelfAssignment

public boolean isSelfAssignment()
Assert it the occurrence is a self assignment such as: i += 3;

Returns: true, if the occurrence is self-assignment, false, otherwise.

isThisOrSuper

public boolean isThisOrSuper()
Simply return true is the image is equal to keyword 'this' or 'super'.

Returns: return true if image equal to 'this' or 'super'.

setArgumentCount

public void setArgumentCount(int count)

setIsMethodOrConstructorInvocation

public void setIsMethodOrConstructorInvocation()

setNameWhichThisQualifies

public void setNameWhichThisQualifies(NameOccurrence qualifiedName)

useThisOrSuper

public boolean useThisOrSuper()
Simply return if the image start with keyword 'this' or 'super'.

Returns: true, if keyword is used, false otherwise.