de.cau.cs.kieler.klodd.hierarchical.structures
Class Layer

java.lang.Object
  extended by de.cau.cs.kieler.klodd.hierarchical.structures.Layer

public class Layer
extends Object

A single Layer used in a layered graph.

Rating proposed yellow
(2009-12-11) msp

Field Summary
static int UNDEF_HEIGHT
          value to use if the height is undefined.
static int UNDEF_RANK
          value to use if the rank is undefined.
 
Constructor Summary
Layer(int therank, int theheight, LayeredGraph thelayeredGraph)
          Creates a new layer with given rank and height.
 
Method Summary
 void calcElemRanks()
          Calculates the element rank of each element in this layer.
 float getCrosswiseDim()
          Returns the crosswiseDim.
 List<LayerElement> getElements()
          Gets the elements of this layer.
 int getHeight()
          Returns the height.
 LayeredGraph getLayeredGraph()
          Gets the layered graph.
 float getLengthwiseDim()
          Returns the lengthwiseDim.
 float getLengthwisePos()
          Returns the lengthwisePos.
 Layer getNext()
          Returns the next.
 int getRank()
          Returns the rank.
 void layoutElements(float layerPos, float minDist)
          Sets the lengthwise position of this layer and all layer elements.
 LayerElement put(KGraphElement obj, KSlimNode kNode)
          Puts an object into this layer.
 void setCrosswiseDim(float thecrosswiseDim)
          Sets the crosswiseDim.
 void setHeight(int theheight)
          Sets the height.
 void setLengthwiseDim(float thelengthwiseDim)
          Sets the lengthwiseDim.
 void setLengthwisePos(float thelengthwisePos)
          Sets the lengthwisePos.
 void setNext(Layer thenext)
          Sets the next.
 void setRank(int therank)
          Sets the rank.
 void sortByPorts(boolean newRanks)
          Sorts the elements in this layer and assigns them new rank values based on the ranks of contained ports.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNDEF_RANK

public static final int UNDEF_RANK
value to use if the rank is undefined.

See Also:
Constant Field Values

UNDEF_HEIGHT

public static final int UNDEF_HEIGHT
value to use if the height is undefined.

See Also:
Constant Field Values
Constructor Detail

Layer

public Layer(int therank,
             int theheight,
             LayeredGraph thelayeredGraph)
Creates a new layer with given rank and height.

Parameters:
therank - the rank, may be UNDEF_RANK
theheight - the height, may be UNDEF_HEIGHT
thelayeredGraph - layered graph in which the layer is created
Method Detail

toString

public String toString()

Overrides:
toString in class Object

put

public LayerElement put(KGraphElement obj,
                        KSlimNode kNode)
Puts an object into this layer.

Parameters:
obj - the element object
kNode - the corresponding node in the acyclic KIELER graph
Returns:
the new layer element

layoutElements

public void layoutElements(float layerPos,
                           float minDist)
Sets the lengthwise position of this layer and all layer elements.

Parameters:
layerPos - starting lengthwise position of this layer
minDist - minimal distance between nodes and connections

getElements

public List<LayerElement> getElements()
Gets the elements of this layer.

Returns:
the layer elements

getLayeredGraph

public LayeredGraph getLayeredGraph()
Gets the layered graph.

Returns:
the layeredGraph

sortByPorts

public void sortByPorts(boolean newRanks)
Sorts the elements in this layer and assigns them new rank values based on the ranks of contained ports. This method may only be called on external ports layers with either rank == 0 or height == 0.

Parameters:
newRanks - if true new port ranks are determined for the contained ports

calcElemRanks

public void calcElemRanks()
Calculates the element rank of each element in this layer. The rank is induced by the order of elements in the internal list and the rank width of each element.


setRank

public void setRank(int therank)
Sets the rank.

Parameters:
therank - the rank to set

getRank

public int getRank()
Returns the rank.

Returns:
the rank

setHeight

public void setHeight(int theheight)
Sets the height.

Parameters:
theheight - the height to set

getHeight

public int getHeight()
Returns the height.

Returns:
the height

setLengthwisePos

public void setLengthwisePos(float thelengthwisePos)
Sets the lengthwisePos.

Parameters:
thelengthwisePos - the lengthwisePos to set

getLengthwisePos

public float getLengthwisePos()
Returns the lengthwisePos.

Returns:
the lengthwisePos

setCrosswiseDim

public void setCrosswiseDim(float thecrosswiseDim)
Sets the crosswiseDim.

Parameters:
thecrosswiseDim - the crosswiseDim to set

getCrosswiseDim

public float getCrosswiseDim()
Returns the crosswiseDim.

Returns:
the crosswiseDim

setLengthwiseDim

public void setLengthwiseDim(float thelengthwiseDim)
Sets the lengthwiseDim.

Parameters:
thelengthwiseDim - the lengthwiseDim to set

getLengthwiseDim

public float getLengthwiseDim()
Returns the lengthwiseDim.

Returns:
the lengthwiseDim

setNext

public void setNext(Layer thenext)
Sets the next.

Parameters:
thenext - the next to set

getNext

public Layer getNext()
Returns the next.

Returns:
the next