de.cau.cs.kieler.klay.layered.graph
Class Layer

java.lang.Object
  extended by de.cau.cs.kieler.core.properties.MapPropertyHolder
      extended by de.cau.cs.kieler.klay.layered.graph.LGraphElement
          extended by de.cau.cs.kieler.klay.layered.graph.Layer
All Implemented Interfaces:
IPropertyHolder, Comparable<LGraphElement>, Iterable<LNode>

public class Layer
extends LGraphElement
implements Iterable<LNode>

A layer in a layered graph. A layer contains a list of nodes, which are drawn in one column.

Rating red

Field Summary
 
Fields inherited from class de.cau.cs.kieler.klay.layered.graph.LGraphElement
id
 
Constructor Summary
Layer(LayeredGraph graph)
          Creates a layer for the given layered graph.
 
Method Summary
 LayeredGraph getGraph()
          Returns the layered graph that owns this layer.
 int getIndex()
          Returns the index of this layer in the global list of layers.
 List<LNode> getNodes()
          Returns the list of nodes.
 KVector getSize()
          Returns the size of the layer, that is the height of the stacked nodes and the maximal width of the nodes.
 Iterator<LNode> iterator()
          Returns an iterator over the contained nodes.
 void placeNodes(double xpos)
          Determines a horizontal placement for all nodes of this layer.
 String toString()
          
 
Methods inherited from class de.cau.cs.kieler.klay.layered.graph.LGraphElement
compareTo
 
Methods inherited from class de.cau.cs.kieler.core.properties.MapPropertyHolder
checkProperties, copyProperties, getAllProperties, getProperty, getProperty, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Layer

public Layer(LayeredGraph graph)
Creates a layer for the given layered graph. The layer is not added to the given graph yet; the graph is just saved as the layer's owner.

Parameters:
graph - the owning layered graph
Method Detail

toString

public String toString()

Overrides:
toString in class Object

getSize

public KVector getSize()
Returns the size of the layer, that is the height of the stacked nodes and the maximal width of the nodes.

Returns:
the size of the layer

getNodes

public List<LNode> getNodes()
Returns the list of nodes. The order of nodes in this list corresponds to the order in which they are drawn inside the layer: the first node is drawn topmost. This order is affected during crossing minimization.

Returns:
the nodes of the layer

iterator

public Iterator<LNode> iterator()
Returns an iterator over the contained nodes.

Specified by:
iterator in interface Iterable<LNode>
Returns:
an iterator for the nodes of this layer

getGraph

public LayeredGraph getGraph()
Returns the layered graph that owns this layer.

Returns:
the owner

getIndex

public int getIndex()
Returns the index of this layer in the global list of layers. Note that this method has linear running time in the number of layers, so use it with caution.

Returns:
the index of this layer

placeNodes

public void placeNodes(double xpos)
Determines a horizontal placement for all nodes of this layer. The size of the layer is assumed to be already set to the maximal width of the contained nodes. (usually done during node placement)

Parameters:
xpos - horizontal offset for layer placement