edu.umd.cs.findbugs.ba

Class Location

public class Location extends Object implements 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

Constructor Summary
Location(InstructionHandle handle, BasicBlock basicBlock)
Constructor.
Method Summary
intcompareTo(Location other)
BasicBlockgetBasicBlock()
Get the basic block.
static LocationgetFirstLocation(BasicBlock basicBlock)
InstructionHandlegetHandle()
Get the instruction handle.
static LocationgetLastLocation(BasicBlock basicBlock)
booleanisFirstInstructionInBasicBlock()
Return whether or not the Location is positioned at the first instruction in the basic block.
booleanisLastInstructionInBasicBlock()
Return whether or not the Location is positioned at the last instruction in the basic block.

Constructor Detail

Location

public Location(InstructionHandle handle, BasicBlock basicBlock)
Constructor.

Parameters: handle the instruction basicBlock the basic block containing the instruction

Method Detail

compareTo

public int compareTo(Location other)

getBasicBlock

public BasicBlock getBasicBlock()
Get the basic block.

getFirstLocation

public static Location getFirstLocation(BasicBlock basicBlock)

getHandle

public InstructionHandle getHandle()
Get the instruction handle.

getLastLocation

public static Location getLastLocation(BasicBlock basicBlock)

isFirstInstructionInBasicBlock

public boolean isFirstInstructionInBasicBlock()
Return whether or not the Location is positioned at the first instruction in the basic block.

isLastInstructionInBasicBlock

public boolean isLastInstructionInBasicBlock()
Return whether or not the Location is positioned at the last instruction in the basic block.
FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.