ibis.satin.impl.syncrewriter.controlflow
Class Path

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<BasicBlock>
              extended by ibis.satin.impl.syncrewriter.controlflow.Path
All Implemented Interfaces:
Serializable, Cloneable, Iterable<BasicBlock>, Collection<BasicBlock>, List<BasicBlock>, RandomAccess
Direct Known Subclasses:
StoreLoadPath

public class Path
extends ArrayList<BasicBlock>

A Path is a sequence of BasicBlock's. The basic blocks are in order and each basic block targets the following basic block, except for the last basic block.

See Also:
Serialized Form

Constructor Summary
Path()
          Constructs an empty path.
Path(Path path)
          Constructs a path from a path.
 
Method Summary
 boolean containsBefore(BasicBlock basicBlock, BasicBlock endPoint)
          Tests whether a basicblock is before another basic block in the path.
 Path getCommonSubPathFromEnd(Path path)
          Returns a common subpath between this and another path from the end.
 Path getCommonSubPathFromStart(Path path)
          Returns a common subpath between this and another path from the start.
 BasicBlock getLastBasicBlock()
          Returns the last basic block.
static Path getLatestCommonSubPath(Path[] paths)
          Returns a common subpath between this and multiple other paths from the end.
 Path getSubPathIncluding(int idBasicBlock)
          Returns a subpath from the beginning to a basic block which has id idBasicBlock.
 void removeLast(BasicBlock basicBlock)
          Removes the last occurence of a basic block.
 String toString()
          Returns a string representation of the path.
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

Path

public Path()
Constructs an empty path.


Path

public Path(Path path)
Constructs a path from a path. It creates a shallow copy of the path.

Method Detail

getLastBasicBlock

public BasicBlock getLastBasicBlock()
Returns the last basic block.

Returns:
the last basic block

getSubPathIncluding

public Path getSubPathIncluding(int idBasicBlock)
Returns a subpath from the beginning to a basic block which has id idBasicBlock. Note that this is not the index of the basic block in the path (given by get(index), but the index of the basic block in the method. The last basic block will be the basic block with index indexBasicBlock.

Parameters:
idBasicBlock - the id of the basic block.
Returns:
a path from the first basic block until and including the basic block which has an id equal to idBasicBlock.

getCommonSubPathFromEnd

public Path getCommonSubPathFromEnd(Path path)
Returns a common subpath between this and another path from the end. The returned path may be empty. Then there is no common subpath.

Parameters:
path - the path with which this path may have common subpath
Returns:
the common subpath from the end

getLatestCommonSubPath

public static Path getLatestCommonSubPath(Path[] paths)
Returns a common subpath between this and multiple other paths from the end. The returned path may be empty. Then there is no common subpath.

Parameters:
paths - the paths with which this path may have common subpath
Returns:
the common subpath from the end

getCommonSubPathFromStart

public Path getCommonSubPathFromStart(Path path)
Returns a common subpath between this and another path from the start. The returned path may be empty. Then there is no common subpath.

Parameters:
path - the path with which this path may have common subpath
Returns:
the common subpath from the start

toString

public String toString()
Returns a string representation of the path.

Overrides:
toString in class AbstractCollection<BasicBlock>

removeLast

public void removeLast(BasicBlock basicBlock)
Removes the last occurence of a basic block.

Parameters:
basicBlock - the basic block that is being removed.

containsBefore

public boolean containsBefore(BasicBlock basicBlock,
                              BasicBlock endPoint)
Tests whether a basicblock is before another basic block in the path.

Parameters:
basicBlock - The basicBlock that is to be tested to be in front of endPoint
endPoint - The basicBlock before which basicBlock should be.
Returns:
true if basicBlock is in front of endPoint; false otherwise.


The Ibis project