Package edu.umd.cs.findbugs.ba
Class Path
- java.lang.Object
-
- edu.umd.cs.findbugs.ba.Path
-
public class Path extends java.lang.ObjectA Path is a sequence of basic blocks.
-
-
Field Summary
Fields Modifier and Type Field Description private int[]blockIdListprivate intcachedHashCodeprivate static intDEFAULT_CAPACITYprivate static intINVALID_HASH_CODEprivate intlengthprivate static java.lang.StringSYMBOLS
-
Constructor Summary
Constructors Constructor Description Path()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacceptVisitor(CFG cfg, PathVisitor visitor)Accept a PathVisitor.voidacceptVisitorStartingFromLocation(CFG cfg, PathVisitor visitor, BasicBlock startBlock, org.apache.bcel.generic.InstructionHandle startHandle)Accept a PathVisitor, starting from a given BasicBlock and InstructionHandle.voidappend(int id)Append given BasicBlock id to the path.voidcopyFrom(Path other)Make this Path identical to the given one.Pathduplicate()Return an exact copy of this Path.booleanequals(java.lang.Object o)intgetBlockIdAt(int index)Get the BasicBlock id at the given index in the path.intgetLength()Get the number of components (BasicBlock ids) in the Path.private voidgrow(int index)booleanhasComponent(int blockId)Determine whether or not the id of the given BasicBlock appears anywhere in the path.inthashCode()private voidinvalidate()booleanisPrefixOf(Path path)Determine whether or not given Path is a prefix of this one.java.lang.StringtoString()
-
-
-
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:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
grow
private void grow(int index)
-
-