de.fhstralsund.vinets.structure
Interface NetElement

All Superinterfaces:
java.lang.Cloneable, java.io.Serializable
All Known Subinterfaces:
Block, Edge, Graph, HyperEdge, Link, Node, Port
All Known Implementing Classes:
AbstractGraph, DefaultNetElement, GraphAdapter, SimpleGraph, SimpleGraph.SimpleEdge, SimpleGraph.SimpleNode

public interface NetElement
extends java.io.Serializable, java.lang.Cloneable

The base interface of all NetElements in VinetS. Usually, a NetElement implementation class should not provide a public constructor. Instead, NetElements should be created by a factory.


Method Summary
 void clearLabels()
          Clears all labels of this NetElement.
 boolean containsLabel(java.lang.Object key)
          Returns true if the label contains a mapping for the specified key.
 boolean getBooleanLabel(java.lang.Object key)
          Returns the label value associated with the passed key as boolean value.
 java.lang.Object getData()
          Delivers application specific data stored by this NetElement which have no relation to the network algorithms.
 double getDoubleLabel(java.lang.Object key)
          Returns the label value associated with the passed key as double value.
 NetElementGeometry getGeometry()
          Delivers the NetElementGeometry instance containing the position and the size of this NetElement in the relative coordinate system of its host.
 NetElement getHost()
          Delivers the parent of this NetElement in the inclusion hierarchy.
 java.lang.Object getID()
          Delivers the identifier of this NetElement.
 int getIntLabel(java.lang.Object key)
          Returns the label value associated with the passed key as int value.
 java.lang.Object getLabel(java.lang.Object key)
          Returns the label value associated with the passed key, or null if the label Map does not contain a mapping for this key.
 java.util.Set getLabelKeySet()
          Returns a Set which contains the Keys inside the LabelMap.
 java.lang.String getName()
          Delivers a human readable name of this NetElement.
 NetElement getOriginal()
          Delivers the NetElement from which this one was copied.
 de.fhstralsund.vinets.graphics.NetElementRepresentation getRepresentation()
          Delivers the NetElementRepresentation instance containing information for rendering this NetElement.
 java.lang.Object removeLabel(java.lang.Object key)
          Removes a property stored as label from this NetElement.
 void setBooleanLabel(java.lang.Object key, boolean b)
          Adds to this NetElement a boolean value label or changes it.
 void setData(java.lang.Object info)
          Assigns new application specific data to this NetElement which have no relation to the network algorithms.
 void setDoubleLabel(java.lang.Object key, double x)
          Adds to this NetElement a double value label or changes it.
 void setGeometry(NetElementGeometry geom)
          Assigns a new NetElementGeometry instance containing the position and the size of this NetElement in the relative coordinate system of its host.
 void setIntLabel(java.lang.Object key, int i)
          Adds to this NetElement an integer value label or changes it.
 void setLabel(java.lang.Object key, java.lang.Object value)
          Adds a new property to be stored as a label of this NetElement or changes the value of an existing property.
 void setName(java.lang.String name)
          Sets a human readable name for this NetElement.
 void setRepresentation(de.fhstralsund.vinets.graphics.NetElementRepresentation pres)
          Assigns a new NetElementRepresentation instance containing information for rendering this NetElement.
 

Method Detail

getID

java.lang.Object getID()
Delivers the identifier of this NetElement. It is intended that the ID should be unique and given to this NetElement automatically during creation. There should be no public possibility to change the ID.

Returns:
the identifier.

getName

java.lang.String getName()
Delivers a human readable name of this NetElement.

Returns:
a human readable name of this NetElement.

setName

void setName(java.lang.String name)
Sets a human readable name for this NetElement.

Parameters:
name - the name.

getGeometry

NetElementGeometry getGeometry()
Delivers the NetElementGeometry instance containing the position and the size of this NetElement in the relative coordinate system of its host.

Returns:
a reference to the NetElementGeometry.

setGeometry

void setGeometry(NetElementGeometry geom)
Assigns a new NetElementGeometry instance containing the position and the size of this NetElement in the relative coordinate system of its host.

Parameters:
geom - a reference to the new NetElementGeometry.

getRepresentation

de.fhstralsund.vinets.graphics.NetElementRepresentation getRepresentation()
Delivers the NetElementRepresentation instance containing information for rendering this NetElement.

Returns:
a reference to the graphic representation of this NetElement.

setRepresentation

void setRepresentation(de.fhstralsund.vinets.graphics.NetElementRepresentation pres)
Assigns a new NetElementRepresentation instance containing information for rendering this NetElement.

Parameters:
pres - a reference to the graphic representation of this NetElement.

getData

java.lang.Object getData()
Delivers application specific data stored by this NetElement which have no relation to the network algorithms.

Returns:
a reference to the external data.

setData

void setData(java.lang.Object info)
Assigns new application specific data to this NetElement which have no relation to the network algorithms.

Parameters:
info - a reference to the external information to be stored.

getHost

NetElement getHost()
Delivers the parent of this NetElement in the inclusion hierarchy. Usually, the host is a container containing this NetElement. Moreover, the host was responsible for creating this NetElement, i.e. the host provides factory methods. The corresponding host attribute of this NetElement should not be changed.

Returns:
the NetElement containing this NetElement.

getOriginal

NetElement getOriginal()
Delivers the NetElement from which this one was copied. It can be used for maintaining the isomorphism between two instances of one Graph. The corresponding attribute of this NetElement should be set by the clone method and should not be changed afterwards.

Returns:
the NetElement from which this one had been copied.

setLabel

void setLabel(java.lang.Object key,
              java.lang.Object value)
Adds a new property to be stored as a label of this NetElement or changes the value of an existing property. The idea is that any network algorithm should be able to store the information obtained during its execution locally for further use in a Map on each NetElement. The Object used as key should not change in a manner that affects equals comparisons while used for a label. The key should not be null, but for the value this restriction does not hold.

Parameters:
key - an Object with which the specified value is to be associated.
value - an Object to be associated with the specified key.
Throws:
java.lang.IllegalArgumentException - if the key is null.

getLabel

java.lang.Object getLabel(java.lang.Object key)
Returns the label value associated with the passed key, or null if the label Map does not contain a mapping for this key. A return value of null does not necessarily indicate that the label contains no mapping for the key; it is also possible that the label explicitly maps the key to null. The containsLabel method may be used to distinguish these two cases.

Parameters:
key - the key whose associated value is to be returned.
Returns:
the value to which the label maps the specified key or null if there is no mapping for this key.
See Also:
setLabel(Object, Object)

getLabelKeySet

java.util.Set getLabelKeySet()
Returns a Set which contains the Keys inside the LabelMap.

Returns:
a Set of Keys

containsLabel

boolean containsLabel(java.lang.Object key)
Returns true if the label contains a mapping for the specified key.

Parameters:
key - the key whose presence as label is to be tested.
Returns:
true if the label contains a mapping for the specified key.
See Also:
setLabel(Object, Object)

removeLabel

java.lang.Object removeLabel(java.lang.Object key)
Removes a property stored as label from this NetElement.

Parameters:
key - the key of the property to remove.
Returns:
the previous value associated to that key or null.
See Also:
setLabel(Object, Object)

clearLabels

void clearLabels()
Clears all labels of this NetElement.


setIntLabel

void setIntLabel(java.lang.Object key,
                 int i)
Adds to this NetElement an integer value label or changes it. Convenience method - equivalent to setLabel(key, new Integer(i))}.

Parameters:
key - an Object with which the integer value is to be associated.
i - an int value to be associated with the specified key.
See Also:
setLabel(Object, Object)

getIntLabel

int getIntLabel(java.lang.Object key)
Returns the label value associated with the passed key as int value. Convenience method - equivalent to containsLabel(key) ? ((Integer)getLabel(key)).intValue()) : Integer.MAX_VALUE.

Parameters:
key - the key whose associated integer value is to be returned.
Returns:
an int to which the label maps the specified key or Integer.MAX_VALUE if there is no mapping for the key.
See Also:
getLabel(Object)

setDoubleLabel

void setDoubleLabel(java.lang.Object key,
                    double x)
Adds to this NetElement a double value label or changes it. Convenience method - equivalent to setLabel(key, new Double(x)).

Parameters:
key - an Object with which the double value is to be associated.
x - a double value to be associated with the specified key.
See Also:
setLabel(Object, Object)

getDoubleLabel

double getDoubleLabel(java.lang.Object key)
Returns the label value associated with the passed key as double value. Convenience method - equivalent to containsLabel(key) ? ((Double)getLabel(key)).doubleValue() : Double.NaN.

Parameters:
key - the key whose associated double value is to be returned.
Returns:
a double to which the label maps the specified key. or Double.NaN if there is no mapping for the key.
See Also:
getLabel(Object)

setBooleanLabel

void setBooleanLabel(java.lang.Object key,
                     boolean b)
Adds to this NetElement a boolean value label or changes it. Convenience method - equivalent to setLabel(key, new Boolean(i)).

Parameters:
key - an Object with which the boolean value is to be associated.
b - true or false to be associated with the specified key.
See Also:
setLabel(Object, Object)

getBooleanLabel

boolean getBooleanLabel(java.lang.Object key)
Returns the label value associated with the passed key as boolean value. Convenience method - equivalent to containsLabel(key) ? ((Boolean)getLabel(key)).booleanValue() : false.

Parameters:
key - the key whose associated boolean value is to be returned.
Returns:
a boolean value to which the label maps the specified key.
See Also:
getLabel(Object)