soot.toolkits.graph
Class HashReversibleGraph

java.lang.Object
  extended by soot.toolkits.graph.HashMutableDirectedGraph
      extended by soot.toolkits.graph.HashReversibleGraph
All Implemented Interfaces:
Iterable, DirectedGraph, MutableDirectedGraph, ReversibleGraph

public class HashReversibleGraph
extends HashMutableDirectedGraph
implements ReversibleGraph

A reversible version of HashMutableDirectedGraph

Author:
Navindra Umanee

Field Summary
protected  boolean reversed
           
 
Fields inherited from class soot.toolkits.graph.HashMutableDirectedGraph
heads, nodeToPreds, nodeToSuccs, tails
 
Constructor Summary
HashReversibleGraph()
           
HashReversibleGraph(DirectedGraph dg)
           
 
Method Summary
 void addEdge(Object from, Object to)
          Adds an edge to the graph between 2 nodes.
 boolean containsEdge(Object from, Object to)
           
 List getHeads()
          Returns a list of entry points for this graph.
 List getPredsOf(Object s)
          Returns a list of predecessors for the given node in the graph.
 List getSuccsOf(Object s)
          Returns a list of successors for the given node in the graph.
 List getTails()
          Returns a list of exit points for this graph.
 boolean isReversed()
          Returns true if the graph is now reversed from its original state at creation.
 void removeEdge(Object from, Object to)
          Removes an edge between 2 nodes in the graph.
 ReversibleGraph reverse()
          Reverse the edges of the current graph and swap head and tail nodes.
 
Methods inherited from class soot.toolkits.graph.HashMutableDirectedGraph
addNode, clearAll, clone, containsNode, getNodes, getPredsOfAsSet, getSuccsOfAsSet, iterator, printGraph, removeNode, size
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface soot.toolkits.graph.MutableDirectedGraph
addNode, containsNode, getNodes, removeNode
 
Methods inherited from interface soot.toolkits.graph.DirectedGraph
iterator, size
 

Field Detail

reversed

protected boolean reversed
Constructor Detail

HashReversibleGraph

public HashReversibleGraph(DirectedGraph dg)

HashReversibleGraph

public HashReversibleGraph()
Method Detail

isReversed

public boolean isReversed()
Description copied from interface: ReversibleGraph
Returns true if the graph is now reversed from its original state at creation.

Specified by:
isReversed in interface ReversibleGraph

reverse

public ReversibleGraph reverse()
Description copied from interface: ReversibleGraph
Reverse the edges of the current graph and swap head and tail nodes. Returns self.

Specified by:
reverse in interface ReversibleGraph

addEdge

public void addEdge(Object from,
                    Object to)
Description copied from interface: MutableDirectedGraph
Adds an edge to the graph between 2 nodes. If the edge is already present no change is made.

Specified by:
addEdge in interface MutableDirectedGraph
Overrides:
addEdge in class HashMutableDirectedGraph
Parameters:
from - out node for the edge.
to - in node for the edge.

removeEdge

public void removeEdge(Object from,
                       Object to)
Description copied from interface: MutableDirectedGraph
Removes an edge between 2 nodes in the graph. If the edge is not present no change is made.

Specified by:
removeEdge in interface MutableDirectedGraph
Overrides:
removeEdge in class HashMutableDirectedGraph
Parameters:
from - out node for the edge to remove.
to - in node for the edge to remove.

containsEdge

public boolean containsEdge(Object from,
                            Object to)
Specified by:
containsEdge in interface MutableDirectedGraph
Overrides:
containsEdge in class HashMutableDirectedGraph
Returns:
true if the graph contains an edge the 2 nodes false otherwise.

getHeads

public List getHeads()
Description copied from interface: DirectedGraph
Returns a list of entry points for this graph.

Specified by:
getHeads in interface DirectedGraph
Overrides:
getHeads in class HashMutableDirectedGraph

getTails

public List getTails()
Description copied from interface: DirectedGraph
Returns a list of exit points for this graph.

Specified by:
getTails in interface DirectedGraph
Overrides:
getTails in class HashMutableDirectedGraph

getPredsOf

public List getPredsOf(Object s)
Description copied from interface: DirectedGraph
Returns a list of predecessors for the given node in the graph.

Specified by:
getPredsOf in interface DirectedGraph
Overrides:
getPredsOf in class HashMutableDirectedGraph

getSuccsOf

public List getSuccsOf(Object s)
Description copied from interface: DirectedGraph
Returns a list of successors for the given node in the graph.

Specified by:
getSuccsOf in interface DirectedGraph
Overrides:
getSuccsOf in class HashMutableDirectedGraph