|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fhstralsund.vinets.structure.DefaultNetElement
de.fhstralsund.vinets.structure.AbstractGraph
de.fhstralsund.vinets.structure.SimpleGraph
public class SimpleGraph
The standard implementation of the Graph interface. Directed, undirected or mixed graphs are supported. There cannot exist loops and parallel edges, and no hyperedges. The factory methods deliver nodes or edges with this Graph as host.
Nested Class Summary | |
---|---|
protected class |
SimpleGraph.ParallelEdgeException
|
protected class |
SimpleGraph.SimpleEdge
The standard implementation of the Edge interface. |
protected class |
SimpleGraph.SimpleNode
The standard implementation of the Node interface, an atomar Node. |
Field Summary |
---|
Fields inherited from class de.fhstralsund.vinets.structure.AbstractGraph |
---|
E, gType, V |
Fields inherited from class de.fhstralsund.vinets.structure.DefaultNetElement |
---|
host, labelMap, original |
Constructor Summary | |
---|---|
SimpleGraph()
|
|
SimpleGraph(GraphType type)
|
|
SimpleGraph(GraphType type,
java.lang.String name)
|
|
SimpleGraph(GraphType type,
java.lang.String name,
java.lang.Object data)
|
Method Summary | |
---|---|
java.lang.Object |
clone()
Creates and returns a special copy of this NetElement. |
java.lang.Object |
convert(GraphType toType)
Delivers a new SimpleGraph that is almost a copy of this one, but transformed to the given GraphType. |
protected void |
copyEdges(SimpleGraph copy,
java.util.Map nodeMap)
Supplies the copy of this SimpleGraph with a new edge set containing copies of all its Edges. |
protected java.util.HashMap |
copyNodes(SimpleGraph copy)
Clones all Nodes of this SimpleGraph into the vertex set of the parameter and supplies the assignment (oldNode, newNode) as HashSet. |
Link |
createEdge(Node start,
Node end)
Constructs and returns a new (un)directed SimpleEdge corresponding to the type of this SimpleGraph. |
Link |
createEdge(Node start,
Node end,
boolean directed)
Constructs and returns a new directed or undirected SimpleEdge. |
Link |
createEdge(Node start,
Node end,
boolean directed,
java.lang.Object data)
Constructs and returns a new directed or undirected SimpleEdge. |
Node |
createNode()
Creates and returns a new SimpleNode contained in this SimpleGraph. |
Node |
createNode(java.lang.String name)
Creates and returns a new SimpleNode contained in this SimpleGraph. |
Node |
createNode(java.lang.String name,
java.lang.Object data)
Creates and returns a new SimpleNode contained in this SimpleGraph. |
boolean |
remove(NetElement n)
Removes a SimpleNode or SimpleEdge from this SimpleGraph. |
protected boolean |
removeEdge(SimpleGraph.SimpleEdge e)
Remove an Edge from this SimpleGraph. |
protected boolean |
removeNode(SimpleGraph.SimpleNode v)
A Node is removed together with all its incident Edges. |
Methods inherited from class de.fhstralsund.vinets.structure.AbstractGraph |
---|
countEdges, countNodes, edges, edgeSet, equals, getGraphType, hashCode, isDirected, isHyperGraph, isMixed, isUndirected, nodes, nodeSet, toString |
Methods inherited from class de.fhstralsund.vinets.structure.DefaultNetElement |
---|
clearLabels, containsLabel, getBooleanLabel, getData, getDoubleLabel, getGeometry, getHost, getID, getIntLabel, getLabel, getLabelKeySet, getName, getOriginal, getRepresentation, removeLabel, setBooleanLabel, setData, setDoubleLabel, setGeometry, setIntLabel, setLabel, setName, setRepresentation |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface de.fhstralsund.vinets.structure.NetElement |
---|
clearLabels, containsLabel, getBooleanLabel, getData, getDoubleLabel, getGeometry, getHost, getID, getIntLabel, getLabel, getLabelKeySet, getName, getOriginal, getRepresentation, removeLabel, setBooleanLabel, setData, setDoubleLabel, setGeometry, setIntLabel, setLabel, setName, setRepresentation |
Constructor Detail |
---|
public SimpleGraph()
public SimpleGraph(GraphType type)
public SimpleGraph(GraphType type, java.lang.String name)
public SimpleGraph(GraphType type, java.lang.String name, java.lang.Object data)
Method Detail |
---|
public Node createNode(java.lang.String name, java.lang.Object data)
name
- a name used to identify this Node for the user.data
- external data of any kind that an application may need.
public Node createNode(java.lang.String name)
name
- a name used to identify this Node for the user.
public Node createNode()
public Link createEdge(Node start, Node end, boolean directed, java.lang.Object data)
start
- source Node.end
- target Node.directed
- true if the Edge is directed, false otherwise.data
- external data of any kind that an application may need.
java.lang.IllegalArgumentException
- if start or end have a wrong host
or the edge type is not feasible for this SimpleGraph.public Link createEdge(Node start, Node end, boolean directed)
start
- source Node.end
- target Node.directed
- true if the Edge is dirceted, false otherwise.
java.lang.IllegalArgumentException
- if start or end have a wrong host
orthe edge type is not feasible for this SimpleGraph.public Link createEdge(Node start, Node end)
start
- source Node.end
- target Node.
java.lang.IllegalArgumentException
- if start or end have a wrong host.public boolean remove(NetElement n)
n
- the NetElement to be removed.
java.lang.IllegalArgumentException
- if n has a wrong type or host.public java.lang.Object convert(GraphType toType)
toType
- the GraphType to convert to.
java.lang.IllegalArgumentException
- if trying to convert to HYPERGRAPH.clone()
public java.lang.Object clone()
DefaultNetElement
clone
in interface Graph
clone
in class DefaultNetElement
protected boolean removeEdge(SimpleGraph.SimpleEdge e)
e
- the Edge to remove.
protected boolean removeNode(SimpleGraph.SimpleNode v)
v
- the Node to remove.
protected java.util.HashMap copyNodes(SimpleGraph copy)
copy
- a skeleton copy of this SimpleGraph to which the new
Nodes should be added.
protected void copyEdges(SimpleGraph copy, java.util.Map nodeMap)
copy
- a skeleton copy of this SimpleGraph to which the new
Edges should be added.nodeMap
- the HashMap that maps the old Nodes to their copies.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |