Class Path

java.lang.Object
edu.umd.cs.findbugs.ba.Path

public class Path extends Object
A Path is a sequence of basic blocks.
Author:
David Hovemeyer
  • 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

      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 graph
      visitor - 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 graph
      visitor - a PathVisitor
      startBlock - BasicBlock where traversal should start
      startHandle - 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 class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object