Package edu.umd.cs.findbugs.ba
Class Path
- java.lang.Object
-
- edu.umd.cs.findbugs.ba.Path
-
public class Path extends java.lang.Object
A Path is a sequence of basic blocks.
-
-
Field Summary
Fields Modifier and Type Field Description private int[]
blockIdList
private int
cachedHashCode
private static int
DEFAULT_CAPACITY
private static int
INVALID_HASH_CODE
private int
length
private static java.lang.String
SYMBOLS
-
Constructor Summary
Constructors Constructor Description Path()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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
copyFrom(Path other)
Make this Path identical to the given one.Path
duplicate()
Return an exact copy of this Path.boolean
equals(java.lang.Object o)
int
getBlockIdAt(int index)
Get the BasicBlock id at the given index in the path.int
getLength()
Get the number of components (BasicBlock ids) in the Path.private void
grow(int index)
boolean
hasComponent(int blockId)
Determine whether or not the id of the given BasicBlock appears anywhere in the path.int
hashCode()
private void
invalidate()
boolean
isPrefixOf(Path path)
Determine whether or not given Path is a prefix of this one.java.lang.String
toString()
-
-
-
Field Detail
-
DEFAULT_CAPACITY
private static final int DEFAULT_CAPACITY
- See Also:
- Constant Field Values
-
INVALID_HASH_CODE
private static final int INVALID_HASH_CODE
- See Also:
- Constant Field Values
-
blockIdList
private int[] blockIdList
-
length
private int length
-
cachedHashCode
private int cachedHashCode
-
SYMBOLS
private static final java.lang.String SYMBOLS
- See Also:
- Constant Field Values
-
-
Method Detail
-
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
public Path duplicate()
Return an exact copy of this Path.- Returns:
- an exact copy of this Path
-
copyFrom
public void copyFrom(Path other)
Make this Path identical to the given one.- Parameters:
other
- a Path to which this object should be made identical
-
acceptVisitor
public void acceptVisitor(CFG cfg, PathVisitor visitor)
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
public boolean isPrefixOf(Path path)
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
-
invalidate
private void invalidate()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
grow
private void grow(int index)
-
-