N
- L
- public class HashMutableEdgeLabelledDirectedGraph<N,L> extends java.lang.Object implements MutableEdgeLabelledDirectedGraph<N,L>
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<soot.toolkits.graph.HashMutableEdgeLabelledDirectedGraph.DGEdge<N>,java.util.List<L>> |
edgeToLabels |
protected java.util.Set<N> |
heads |
protected java.util.Map<L,java.util.List<soot.toolkits.graph.HashMutableEdgeLabelledDirectedGraph.DGEdge<N>>> |
labelToEdges |
protected java.util.Map<N,java.util.List<N>> |
nodeToPreds |
protected java.util.Map<N,java.util.List<N>> |
nodeToSuccs |
protected java.util.Set<N> |
tails |
Constructor and Description |
---|
HashMutableEdgeLabelledDirectedGraph() |
Modifier and Type | Method and Description |
---|---|
void |
addEdge(N from,
N to,
L label)
Adds an edge to the graph between 2 nodes.
|
void |
addNode(N node)
Adds a node to the graph.
|
void |
clearAll()
Removes all nodes and edges.
|
HashMutableEdgeLabelledDirectedGraph<N,L> |
clone() |
boolean |
containsAnyEdge(L label) |
boolean |
containsAnyEdge(N from,
N to) |
boolean |
containsEdge(N from,
N to,
L label) |
boolean |
containsNode(N node) |
MutableDirectedGraph<N> |
getEdgesForLabel(L label)
Returns a DirectedGraph consisting of all edges with the given label and
their nodes.
|
java.util.List<N> |
getHeads()
Returns a list of entry points for this graph.
|
java.util.List<L> |
getLabelsForEdges(N from,
N to)
Returns a list of labels for which an edge exists between from and to
|
java.util.List<N> |
getPredsOf(N s)
Returns a list of predecessors for the given node in the graph.
|
java.util.List<N> |
getSuccsOf(N s)
Returns a list of successors for the given node in the graph.
|
java.util.List<N> |
getTails()
Returns a list of exit points for this graph.
|
java.util.Iterator<N> |
iterator()
Returns an iterator for the nodes in this graph.
|
void |
printGraph() |
void |
removeAllEdges(L label)
Removes all edges with the given label in the graph.
|
void |
removeAllEdges(N from,
N to)
Removes all edges between 2 nodes in the graph.
|
void |
removeEdge(N from,
N to,
L label)
Removes an edge between 2 nodes in the graph.
|
void |
removeNode(N node)
Removes a node from the graph.
|
int |
size()
Returns the node count for this graph.
|
protected java.util.Map<soot.toolkits.graph.HashMutableEdgeLabelledDirectedGraph.DGEdge<N>,java.util.List<L>> edgeToLabels
protected java.util.Map<L,java.util.List<soot.toolkits.graph.HashMutableEdgeLabelledDirectedGraph.DGEdge<N>>> labelToEdges
protected java.util.Set<N> heads
protected java.util.Set<N> tails
public HashMutableEdgeLabelledDirectedGraph()
public void clearAll()
public HashMutableEdgeLabelledDirectedGraph<N,L> clone()
clone
in class java.lang.Object
public java.util.List<N> getHeads()
DirectedGraph
getHeads
in interface DirectedGraph<N>
public java.util.List<N> getTails()
DirectedGraph
getTails
in interface DirectedGraph<N>
public java.util.List<N> getPredsOf(N s)
DirectedGraph
getPredsOf
in interface DirectedGraph<N>
public java.util.List<N> getSuccsOf(N s)
DirectedGraph
getSuccsOf
in interface DirectedGraph<N>
public int size()
DirectedGraph
size
in interface DirectedGraph<N>
public java.util.Iterator<N> iterator()
DirectedGraph
iterator
in interface java.lang.Iterable<N>
iterator
in interface DirectedGraph<N>
public void addEdge(N from, N to, L label)
MutableEdgeLabelledDirectedGraph
addEdge
in interface MutableEdgeLabelledDirectedGraph<N,L>
from
- out node for the edge.to
- in node for the edge.label
- label for the edge.public java.util.List<L> getLabelsForEdges(N from, N to)
EdgeLabelledDirectedGraph
getLabelsForEdges
in interface EdgeLabelledDirectedGraph<N,L>
from
- out node of the edges to get labels forto
- in node of the edges to get labels forpublic MutableDirectedGraph<N> getEdgesForLabel(L label)
EdgeLabelledDirectedGraph
getEdgesForLabel
in interface EdgeLabelledDirectedGraph<N,L>
label
- edge label to use as a filter in building the subgraphpublic void removeEdge(N from, N to, L label)
MutableEdgeLabelledDirectedGraph
removeEdge
in interface MutableEdgeLabelledDirectedGraph<N,L>
from
- out node for the edges to remove.to
- in node for the edges to remove.label
- label for the edge to remove.public void removeAllEdges(N from, N to)
MutableEdgeLabelledDirectedGraph
removeAllEdges
in interface MutableEdgeLabelledDirectedGraph<N,L>
from
- out node for the edges to remove.to
- in node for the edges to remove.public void removeAllEdges(L label)
MutableEdgeLabelledDirectedGraph
removeAllEdges
in interface MutableEdgeLabelledDirectedGraph<N,L>
label
- label for the edge to remove.public boolean containsEdge(N from, N to, L label)
containsEdge
in interface EdgeLabelledDirectedGraph<N,L>
public boolean containsAnyEdge(N from, N to)
containsAnyEdge
in interface EdgeLabelledDirectedGraph<N,L>
from
- out node for the edgesto
- in node for the edgespublic boolean containsAnyEdge(L label)
containsAnyEdge
in interface EdgeLabelledDirectedGraph<N,L>
label
- label for the edgespublic boolean containsNode(N node)
containsNode
in interface EdgeLabelledDirectedGraph<N,L>
node
- node that we want to know if the graph containspublic void addNode(N node)
MutableEdgeLabelledDirectedGraph
addNode
in interface MutableEdgeLabelledDirectedGraph<N,L>
node
- a node to add to the graph.DirectedGraph.getHeads()
,
DirectedGraph.getTails()
public void removeNode(N node)
MutableEdgeLabelledDirectedGraph
removeNode
in interface MutableEdgeLabelledDirectedGraph<N,L>
node
- the node to be removed.public void printGraph()