edu.umd.cs.findbugs.ba
Class Location

java.lang.Object
  extended by edu.umd.cs.findbugs.ba.Location
All Implemented Interfaces:
java.lang.Comparable<Location>

public class Location
extends java.lang.Object
implements java.lang.Comparable<Location>

A class representing a location in the CFG for a method. Essentially, it represents a static instruction, with the important caveat that CFGs have inlined JSR subroutines, meaning that a single InstructionHandle in a CFG may represent several static locations. To this end, a Location is comprised of both an InstructionHandle and the BasicBlock that contains it.

Location objects may be compared with each other using the equals() method, and may be used as keys in tree and hash maps and sets. Note that it is only valid to compare Locations produced from the same CFG.

Author:
David Hovemeyer
See Also:
CFG

Field Summary
private  BasicBlock basicBlock
           
private  org.apache.bcel.generic.InstructionHandle handle
           
 
Constructor Summary
Location(org.apache.bcel.generic.InstructionHandle handle, BasicBlock basicBlock)
          Constructor.
 
Method Summary
 int compareTo(Location other)
           
 boolean equals(java.lang.Object o)
           
 BasicBlock getBasicBlock()
          Get the basic block.
 org.apache.bcel.generic.InstructionHandle getHandle()
          Get the instruction handle.
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

handle

private final org.apache.bcel.generic.InstructionHandle handle

basicBlock

private final BasicBlock basicBlock
Constructor Detail

Location

public Location(org.apache.bcel.generic.InstructionHandle handle,
                BasicBlock basicBlock)
Constructor.

Parameters:
handle - the instruction
basicBlock - the basic block containing the instruction
Method Detail

getHandle

public org.apache.bcel.generic.InstructionHandle getHandle()
Get the instruction handle.


getBasicBlock

public BasicBlock getBasicBlock()
Get the basic block.


compareTo

public int compareTo(Location other)
Specified by:
compareTo in interface java.lang.Comparable<Location>

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object