Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.puppycrawl.tools.checkstyle.checks.usage.transmogrify
Class Reference  view Reference download Reference.java

java.lang.Object
  extended bycom.puppycrawl.tools.checkstyle.checks.usage.transmogrify.Reference
All Implemented Interfaces:
java.lang.Comparable

public class Reference
extends java.lang.Object
implements java.lang.Comparable

represents a place where a definition is used. There are two flavors of references -- resolved (those that have a definition associated with them) and unresolved (those that don't have a definition associated). The goal of the resolution step is to get all of the references in the symbol table to fall into the resolved category.


Field Summary
private  SymTabAST _node
           
private  Occurrence _occurrence
           
 
Constructor Summary
Reference(SymTabAST node)
           
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares this object with another, and returns a numerical result based on the comparison.
 boolean equals(java.lang.Object obj)
          returns whether the References are equal
 int getColumn()
          gets the column for where the node resides
 IDefinition getDefinition()
          gets the definition associated with this reference
 java.io.File getFile()
          gets the enclosing file for the node
 int getLine()
          gets the line where the node resides
 java.lang.String getName()
          gets the name of the reference
 Occurrence getOccurrence()
          gets the occurrence of this reference
 SymTabAST getTreeNode()
          return the node that was passed in during ctor
private  void method()
           
 java.lang.String toString()
          returns a string representation of the reference.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_node

private SymTabAST _node

_occurrence

private Occurrence _occurrence
Constructor Detail

Reference

public Reference(SymTabAST node)
Method Detail

method

private void method()

getDefinition

public IDefinition getDefinition()
gets the definition associated with this reference


getTreeNode

public SymTabAST getTreeNode()
return the node that was passed in during ctor


getOccurrence

public Occurrence getOccurrence()
gets the occurrence of this reference


getLine

public int getLine()
gets the line where the node resides


getColumn

public int getColumn()
gets the column for where the node resides


getFile

public java.io.File getFile()
gets the enclosing file for the node


getName

public java.lang.String getName()
gets the name of the reference


toString

public java.lang.String toString()
returns a string representation of the reference.


equals

public boolean equals(java.lang.Object obj)
returns whether the References are equal


compareTo

public int compareTo(java.lang.Object o)
Description copied from interface: java.lang.Comparable
Compares this object with another, and returns a numerical result based on the comparison. If the result is negative, this object sorts less than the other; if 0, the two are equal, and if positive, this object sorts greater than the other. To translate this into boolean, simply perform o1.compareTo(o2) <op> 0, where op is one of <, <=, =, !=, >, or >=.

You must make sure that the comparison is mutual, ie. sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) (where sgn() is defined as -1, 0, or 1 based on the sign). This includes throwing an exception in either direction if the two are not comparable; hence, compareTo(null) should always throw an Exception.

You should also ensure transitivity, in two forms: x.compareTo(y) > 0 && y.compareTo(z) > 0 implies x.compareTo(z) > 0; and x.compareTo(y) == 0 implies x.compareTo(z) == y.compareTo(z).

Specified by:
compareTo in interface java.lang.Comparable