Package org.jgrapht.experimental.dag
Class DirectedAcyclicGraph.TopoVertexBiMap
- java.lang.Object
-
- org.jgrapht.experimental.dag.DirectedAcyclicGraph.TopoVertexBiMap
-
- All Implemented Interfaces:
java.io.Serializable,DirectedAcyclicGraph.TopoOrderMapping<V>,DirectedAcyclicGraph.TopoOrderMappingFactory<V>
- Enclosing class:
- DirectedAcyclicGraph<V,E>
private class DirectedAcyclicGraph.TopoVertexBiMap extends java.lang.Object implements DirectedAcyclicGraph.TopoOrderMapping<V>, DirectedAcyclicGraph.TopoOrderMappingFactory<V>
a dual HashMap implementation
-
-
Field Summary
Fields Modifier and Type Field Description private static longserialVersionUIDprivate java.util.Map<java.lang.Integer,V>topoToVertexprivate java.util.Map<V,java.lang.Integer>vertexToTopo
-
Constructor Summary
Constructors Modifier Constructor Description privateTopoVertexBiMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.IntegergetTopologicalIndex(V vertex)Get the topological index of the given vertex.DirectedAcyclicGraph.TopoOrderMapping<V>getTopoOrderMapping()Create a new instance of aDirectedAcyclicGraph.TopoOrderMapping.VgetVertex(java.lang.Integer index)Get the vertex at the given topological index.voidputVertex(java.lang.Integer index, V vertex)Add a vertex at the given topological index.voidremoveAllVertices()Remove all vertices from the topological orderingjava.lang.IntegerremoveVertex(V vertex)Remove the given vertex from the topological ordering
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
topoToVertex
private final java.util.Map<java.lang.Integer,V> topoToVertex
-
vertexToTopo
private final java.util.Map<V,java.lang.Integer> vertexToTopo
-
-
Method Detail
-
putVertex
public void putVertex(java.lang.Integer index, V vertex)Description copied from interface:DirectedAcyclicGraph.TopoOrderMappingAdd a vertex at the given topological index.- Specified by:
putVertexin interfaceDirectedAcyclicGraph.TopoOrderMapping<V>- Parameters:
index- the topological indexvertex- the vertex
-
getVertex
public V getVertex(java.lang.Integer index)
Description copied from interface:DirectedAcyclicGraph.TopoOrderMappingGet the vertex at the given topological index.- Specified by:
getVertexin interfaceDirectedAcyclicGraph.TopoOrderMapping<V>- Parameters:
index- the topological index- Returns:
- vertex the vertex
-
getTopologicalIndex
public java.lang.Integer getTopologicalIndex(V vertex)
Description copied from interface:DirectedAcyclicGraph.TopoOrderMappingGet the topological index of the given vertex.- Specified by:
getTopologicalIndexin interfaceDirectedAcyclicGraph.TopoOrderMapping<V>- Parameters:
vertex- the vertex- Returns:
- the index that the vertex is at, or null if the vertex isn't in the topological ordering
-
removeVertex
public java.lang.Integer removeVertex(V vertex)
Description copied from interface:DirectedAcyclicGraph.TopoOrderMappingRemove the given vertex from the topological ordering- Specified by:
removeVertexin interfaceDirectedAcyclicGraph.TopoOrderMapping<V>- Parameters:
vertex- the vertex- Returns:
- the index that the vertex was at, or null if the vertex wasn't in the topological ordering
-
removeAllVertices
public void removeAllVertices()
Description copied from interface:DirectedAcyclicGraph.TopoOrderMappingRemove all vertices from the topological ordering- Specified by:
removeAllVerticesin interfaceDirectedAcyclicGraph.TopoOrderMapping<V>
-
getTopoOrderMapping
public DirectedAcyclicGraph.TopoOrderMapping<V> getTopoOrderMapping()
Description copied from interface:DirectedAcyclicGraph.TopoOrderMappingFactoryCreate a new instance of aDirectedAcyclicGraph.TopoOrderMapping.- Specified by:
getTopoOrderMappingin interfaceDirectedAcyclicGraph.TopoOrderMappingFactory<V>- Returns:
- a new instance of a
DirectedAcyclicGraph.TopoOrderMapping
-
-