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

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

public class LayeredGraph
extends Object

This structure manages the layering of an acyclic directed graph.

Rating proposed yellow
(2009-12-11) msp

Constructor Summary
LayeredGraph(KNode theparentNode)
          Creates a new layered graph.
 
Method Summary
 void applyLayout()
          Applies the layout of this layered graph to the contained layout graph.
 void createConnections(KSlimGraph kGraph)
          Creates connections between layer elements and creates long edges.
 float getCrosswiseDim()
          Returns the crosswise dimension, that is the height for horizontal layout or the width for vertical layout.
 PortConstraints getExternalPortConstraints()
          Returns the port constraints for external ports.
 LayerElement getLayerElement(Object obj)
          Gets the layer element that holds the given object.
 List<Layer> getLayers()
          Gets the list of layers.
 Direction getLayoutDirection()
          Gets the layout direction: RIGHT or DOWN.
 float getLengthwiseDim()
          Returns the lengthwise dimension, that is the width for horizontal layout or the height for vertical layout.
 List<LinearSegment> getLinearSegments()
          Gets the list of linear segments of this layered graph.
 KNode getParentNode()
          Gets the parent layout node.
 KPoint getPosition()
          Gets the current layout position of this layered graph.
 void putBack(KGraphElement obj, int height, KSlimNode kNode)
          Put the given object into a layer with specified height.
 void putFront(KGraphElement obj, int rank, KSlimNode kNode)
          Put the given object into a layer with specified rank.
 void setCrosswiseDim(float thecrosswiseDim)
          Sets the crosswise dimension, that is the height for horizontal layout or the width for vertical layout.
 void setLengthwiseDim(float thelengthwiseDim)
          Sets the lengthwise dimension, that is the width for horizontal layout or the height for vertical layout.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LayeredGraph

public LayeredGraph(KNode theparentNode)
Creates a new layered graph.

Parameters:
theparentNode - parent layout node
Method Detail

toString

public String toString()

Overrides:
toString in class Object

putFront

public void putFront(KGraphElement obj,
                     int rank,
                     KSlimNode kNode)
Put the given object into a layer with specified rank. The search for the right layer begins at the front of the internal list.

Parameters:
obj - object to put
rank - rank of the object
kNode - the corresponding node in the acyclic KIELER graph

putBack

public void putBack(KGraphElement obj,
                    int height,
                    KSlimNode kNode)
Put the given object into a layer with specified height. The search for the right layer begins at the back of the internal list.

Parameters:
obj - object to put
height - height of the object
kNode - the corresponding node in the acyclic KIELER graph

getLayerElement

public LayerElement getLayerElement(Object obj)
Gets the layer element that holds the given object.

Parameters:
obj - the object
Returns:
the corresponding layer element, or null if none exists

getLayers

public List<Layer> getLayers()
Gets the list of layers.

Returns:
the layers

getParentNode

public KNode getParentNode()
Gets the parent layout node.

Returns:
the parent node

createConnections

public void createConnections(KSlimGraph kGraph)
Creates connections between layer elements and creates long edges. This method should be called after all nodes and ports have been put into the layered graph.

Parameters:
kGraph - acyclic version of the graph

applyLayout

public void applyLayout()
Applies the layout of this layered graph to the contained layout graph.


getLayoutDirection

public Direction getLayoutDirection()
Gets the layout direction: RIGHT or DOWN.

Returns:
the layout direction

getExternalPortConstraints

public PortConstraints getExternalPortConstraints()
Returns the port constraints for external ports.

Returns:
the port constraints for external ports

getLinearSegments

public List<LinearSegment> getLinearSegments()
Gets the list of linear segments of this layered graph. Each real node is assigned a unique linear segment of size 1.

Returns:
list of linear segments

getPosition

public KPoint getPosition()
Gets the current layout position of this layered graph.

Returns:
the position

setCrosswiseDim

public void setCrosswiseDim(float thecrosswiseDim)
Sets the crosswise dimension, that is the height for horizontal layout or the width for vertical layout.

Parameters:
thecrosswiseDim - the crosswise dimension to set

getCrosswiseDim

public float getCrosswiseDim()
Returns the crosswise dimension, that is the height for horizontal layout or the width for vertical layout.

Returns:
the crosswise dimension

setLengthwiseDim

public void setLengthwiseDim(float thelengthwiseDim)
Sets the lengthwise dimension, that is the width for horizontal layout or the height for vertical layout.

Parameters:
thelengthwiseDim - the lengthwise dimension to set

getLengthwiseDim

public float getLengthwiseDim()
Returns the lengthwise dimension, that is the width for horizontal layout or the height for vertical layout.

Returns:
the lengthwise dimension