Package edu.umd.cs.findbugs.ba
Class Path
java.lang.Object
edu.umd.cs.findbugs.ba.Path
A Path is a sequence of basic blocks.
- Author:
- David Hovemeyer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
acceptVisitor
(CFG cfg, PathVisitor visitor) Accept a PathVisitor.void
acceptVisitorStartingFromLocation
(CFG cfg, PathVisitor visitor, BasicBlock startBlock, org.apache.bcel.generic.InstructionHandle startHandle) Accept a PathVisitor, starting from a given BasicBlock and InstructionHandle.void
append
(int id) Append given BasicBlock id to the path.void
Make this Path identical to the given one.Return an exact copy of this Path.boolean
int
getBlockIdAt
(int index) Get the BasicBlock id at the given index in the path.int
Get the number of components (BasicBlock ids) in the Path.boolean
hasComponent
(int blockId) Determine whether or not the id of the given BasicBlock appears anywhere in the path.int
hashCode()
boolean
isPrefixOf
(Path path) Determine whether or not given Path is a prefix of this one.toString()
-
Constructor Details
-
Path
public Path()Constructor. Creates an empty Path.
-
-
Method Details
-
append
public void append(int id) Append given BasicBlock id to the path.- Parameters:
id
- a BasicBlock id (label)
-
hasComponent
public boolean hasComponent(int blockId) Determine whether or not the id of the given BasicBlock appears anywhere in the path.- Parameters:
blockId
- the id (label) of a BasicBlock- Returns:
- true if the BasicBlock's id appears in the path, false if not
-
getBlockIdAt
public int getBlockIdAt(int index) Get the BasicBlock id at the given index in the path.- Parameters:
index
- an index in the Path (0 is the first component)- Returns:
- the id of the BasicBlock at the given index
-
getLength
public int getLength()Get the number of components (BasicBlock ids) in the Path.- Returns:
- number of components in the Path
-
duplicate
Return an exact copy of this Path.- Returns:
- an exact copy of this Path
-
copyFrom
Make this Path identical to the given one.- Parameters:
other
- a Path to which this object should be made identical
-
acceptVisitor
Accept a PathVisitor.- Parameters:
cfg
- the control flow graphvisitor
- a PathVisitor
-
acceptVisitorStartingFromLocation
public void acceptVisitorStartingFromLocation(CFG cfg, PathVisitor visitor, BasicBlock startBlock, org.apache.bcel.generic.InstructionHandle startHandle) Accept a PathVisitor, starting from a given BasicBlock and InstructionHandle.- Parameters:
cfg
- the control flow graphvisitor
- a PathVisitorstartBlock
- BasicBlock where traversal should startstartHandle
- InstructionHandle within the start block where traversal should start
-
isPrefixOf
Determine whether or not given Path is a prefix of this one.- Parameters:
path
- another Path- Returns:
- true if this Path is a prefix of the other Path, false otherwise
-
hashCode
public int hashCode() -
equals
-
toString
-