com.ibm.wala.util.graph.labeled
Class AbstractLabeledGraph<T,U>

java.lang.Object
  extended by com.ibm.wala.util.graph.AbstractGraph<T>
      extended by com.ibm.wala.util.graph.labeled.AbstractLabeledGraph<T,U>
All Implemented Interfaces:
EdgeManager<T>, Graph<T>, LabeledEdgeManager<T,U>, LabeledGraph<T,U>, NodeManager<T>, java.lang.Iterable<T>

public abstract class AbstractLabeledGraph<T,U>
extends AbstractGraph<T>
implements LabeledGraph<T,U>


Constructor Summary
AbstractLabeledGraph()
           
 
Method Summary
 void addEdge(T src, T dst, U label)
          adds an edge with some label
 java.util.Set<? extends U> getEdgeLabels(T src, T dst)
          Returns a set of all labeled edges between node src and node dst
protected abstract  LabeledEdgeManager<T,U> getEdgeManager()
           
 java.util.Iterator<? extends U> getPredLabels(T N)
           
 int getPredNodeCount(T N, U label)
          Return the number of immediate predecessor nodes of this Node in the Graph on edges with some label.
 java.util.Iterator<T> getPredNodes(T N, U label)
          Return an Iterator over the immediate predecessor nodes of this Node in the Graph on edges with some label.
 java.util.Iterator<? extends U> getSuccLabels(T N)
           
 int getSuccNodeCount(T N, U label)
          Return the number of immediate successor nodes of this Node in the Graph
 java.util.Iterator<? extends T> getSuccNodes(T N, U label)
          Return an Iterator over the immediate successor nodes of this Node in the Graph on edges with some label.
 boolean hasEdge(T src, T dst, U label)
           
 void removeEdge(T src, T dst, U label)
           
 
Methods inherited from class com.ibm.wala.util.graph.AbstractGraph
addEdge, addNode, containsNode, getNodeManager, getNumberOfNodes, getPredNodeCount, getPredNodes, getSuccNodeCount, getSuccNodes, hasEdge, iterator, removeAllIncidentEdges, removeEdge, removeIncomingEdges, removeNode, removeNodeAndEdges, removeOutgoingEdges, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ibm.wala.util.graph.Graph
removeNodeAndEdges
 
Methods inherited from interface com.ibm.wala.util.graph.NodeManager
addNode, containsNode, getNumberOfNodes, iterator, removeNode
 
Methods inherited from interface com.ibm.wala.util.graph.EdgeManager
addEdge, getPredNodeCount, getPredNodes, getSuccNodeCount, getSuccNodes, hasEdge, removeAllIncidentEdges, removeEdge, removeIncomingEdges, removeOutgoingEdges
 
Methods inherited from interface com.ibm.wala.util.graph.labeled.LabeledEdgeManager
getDefaultLabel
 
Methods inherited from interface com.ibm.wala.util.graph.EdgeManager
addEdge, getPredNodeCount, getPredNodes, getSuccNodeCount, getSuccNodes, hasEdge, removeAllIncidentEdges, removeEdge, removeIncomingEdges, removeOutgoingEdges
 

Constructor Detail

AbstractLabeledGraph

public AbstractLabeledGraph()
Method Detail

getEdgeManager

protected abstract LabeledEdgeManager<T,U> getEdgeManager()
Specified by:
getEdgeManager in class AbstractGraph<T>
Returns:
the object which manages edges in the graph

addEdge

public void addEdge(T src,
                    T dst,
                    U label)
Description copied from interface: LabeledEdgeManager
adds an edge with some label

Specified by:
addEdge in interface LabeledEdgeManager<T,U>

getPredLabels

public java.util.Iterator<? extends U> getPredLabels(T N)
Specified by:
getPredLabels in interface LabeledEdgeManager<T,U>
Returns:
the labels on edges whose destination is N

getPredNodeCount

public int getPredNodeCount(T N,
                            U label)
Description copied from interface: LabeledEdgeManager
Return the number of immediate predecessor nodes of this Node in the Graph on edges with some label.

Specified by:
getPredNodeCount in interface LabeledEdgeManager<T,U>
Returns:
the number of immediate predecessor Nodes of this Node in the Graph.

getPredNodes

public java.util.Iterator<T> getPredNodes(T N,
                                          U label)
Description copied from interface: LabeledEdgeManager
Return an Iterator over the immediate predecessor nodes of this Node in the Graph on edges with some label. This method never returns null.

Specified by:
getPredNodes in interface LabeledEdgeManager<T,U>
Returns:
an Iterator over the immediate predecessor nodes of this Node.

getSuccLabels

public java.util.Iterator<? extends U> getSuccLabels(T N)
Specified by:
getSuccLabels in interface LabeledEdgeManager<T,U>
Returns:
the labels on edges whose source is N

getSuccNodeCount

public int getSuccNodeCount(T N,
                            U label)
Description copied from interface: LabeledEdgeManager
Return the number of immediate successor nodes of this Node in the Graph

Specified by:
getSuccNodeCount in interface LabeledEdgeManager<T,U>
Returns:
the number of immediate successor Nodes of this Node in the Graph.

getSuccNodes

public java.util.Iterator<? extends T> getSuccNodes(T N,
                                                    U label)
Description copied from interface: LabeledEdgeManager
Return an Iterator over the immediate successor nodes of this Node in the Graph on edges with some label.

This method never returns null.

Specified by:
getSuccNodes in interface LabeledEdgeManager<T,U>
Returns:
an Iterator over the immediate successor Nodes of this Node.

hasEdge

public boolean hasEdge(T src,
                       T dst,
                       U label)
Specified by:
hasEdge in interface LabeledEdgeManager<T,U>

removeEdge

public void removeEdge(T src,
                       T dst,
                       U label)
Specified by:
removeEdge in interface LabeledEdgeManager<T,U>

getEdgeLabels

public java.util.Set<? extends U> getEdgeLabels(T src,
                                                T dst)
Description copied from interface: LabeledEdgeManager
Returns a set of all labeled edges between node src and node dst

Specified by:
getEdgeLabels in interface LabeledEdgeManager<T,U>
Parameters:
src - source node of the edge
dst - target node of the edge
Returns:
Set of edge labels