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.- Author:
- David Hovemeyer
-
-
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.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.java.lang.String
toString()
-
-
-
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
-
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
-
-