de.fhstralsund.vinets.structure
Class SimpleGraph.SimpleEdge

java.lang.Object
  extended by de.fhstralsund.vinets.structure.DefaultNetElement
      extended by de.fhstralsund.vinets.structure.SimpleGraph.SimpleEdge
All Implemented Interfaces:
Edge, Link, NetElement, java.io.Serializable, java.lang.Cloneable
Enclosing class:
SimpleGraph

protected class SimpleGraph.SimpleEdge
extends DefaultNetElement
implements Edge

The standard implementation of the Edge interface.

See Also:
Serialized Form

Field Summary
protected  SimpleGraph.SimpleNode source
           
protected  SimpleGraph.SimpleNode target
           
 
Fields inherited from class de.fhstralsund.vinets.structure.DefaultNetElement
host, labelMap, original
 
Constructor Summary
protected SimpleGraph.SimpleEdge(Node start, Node end, boolean directed, java.lang.Object data)
          Constructs a new SimpleEdge with this SimpleGraph as host.
 
Method Summary
 java.lang.Object clone()
          Delivers only a copy of the NetElement.
protected  void connect()
          Inserts the Edge into the incidence lists of its end nodes.
 boolean equals(java.lang.Object obj)
           
 NodePair getEnds()
          Delivers both end Nodes of this Edge.
 Node getOtherEnd(Node v)
          Delivers the end Node of an Edge different from the given one.
 Node getSource()
          Returns one of the two ends of this Edge.
 Node getTarget()
          Returns one of the two ends of this Edge.
 int hashCode()
           
 java.util.Iterator incidentNodes()
          Returns an iterator over the Nodes to which this Link is incident.
 boolean isDirected()
          Indicates whether this Link is a directed Edge.
 boolean isUndirected()
          Indicates whether this Link is an undirected Edge.
protected  void setDirected(boolean dir)
           
 java.lang.String toString()
          Returns a string representation of this NetElement.
 
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
 

Field Detail

source

protected SimpleGraph.SimpleNode source

target

protected SimpleGraph.SimpleNode target
Constructor Detail

SimpleGraph.SimpleEdge

protected SimpleGraph.SimpleEdge(Node start,
                                 Node end,
                                 boolean directed,
                                 java.lang.Object data)
Constructs a new SimpleEdge with this SimpleGraph as host. If the edge is undirected, one of the two end vertices is called "source" the other "target" (arbitrarily).

Parameters:
start - source Node
end - target Node
directed - true if the edge is directed, false otherwise
data - external data of any kind
Throws:
java.lang.IllegalArgumentException - if source or target have a wrong host or the edge type is not feasible for this SimpleGraph
Method Detail

getSource

public Node getSource()
Returns one of the two ends of this Edge. If the Edge is directed, the source Node is delivered.

Specified by:
getSource in interface Edge
Returns:
the source Node of this Edge.

getTarget

public Node getTarget()
Returns one of the two ends of this Edge. If the Edge is directed, the target Node is delivered.

Specified by:
getTarget in interface Edge
Returns:
the target Node of this Edge.

getEnds

public NodePair getEnds()
Description copied from interface: Edge
Delivers both end Nodes of this Edge.

Specified by:
getEnds in interface Edge
Returns:
the two ends of this Edge encapsulated in a NodePair

getOtherEnd

public Node getOtherEnd(Node v)
Description copied from interface: Edge
Delivers the end Node of an Edge different from the given one.

Specified by:
getOtherEnd in interface Edge
Parameters:
v - one of the end Nodes of this Edge
Returns:
the opposite end Node of this Edge
Throws:
java.lang.IllegalArgumentException - if v is not incident to this Edge

incidentNodes

public java.util.Iterator incidentNodes()
Description copied from interface: Link
Returns an iterator over the Nodes to which this Link is incident. Notice, that it is not specified, how this method should be implemented for HyperEdges, i.e. how to handle duplicate Nodes (An HyperEdge may be connected to one Node via more than one Port.) and whether the host of an HyperEdge should be delivered or not. (An HyperEdge may enter its own host from inside.)

Specified by:
incidentNodes in interface Link
Returns:
an iterator over the Nodes to which this Link is incident.

isDirected

public boolean isDirected()
Description copied from interface: Link
Indicates whether this Link is a directed Edge.

Specified by:
isDirected in interface Link
Returns:
true if the Edge is directed

isUndirected

public boolean isUndirected()
Description copied from interface: Link
Indicates whether this Link is an undirected Edge.

Specified by:
isUndirected in interface Link
Returns:
true if the Edge is undirected

clone

public java.lang.Object clone()
Delivers only a copy of the NetElement. The clone is an edge without source and target. The method is used internally when cloning a Graph.

Overrides:
clone in class DefaultNetElement
Returns:
a new DefaultNetElement instance equal to this one.

toString

public java.lang.String toString()
Description copied from class: DefaultNetElement
Returns a string representation of this NetElement.

Overrides:
toString in class DefaultNetElement
Returns:
the name of this NetElement.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

setDirected

protected void setDirected(boolean dir)

connect

protected void connect()
Inserts the Edge into the incidence lists of its end nodes. The method is called when creating or cloning an Edge in a Graph.