Package org.eclipse.gef.layout.algorithms

# Class SugiyamaLayoutAlgorithm.DFSLayerProvider

java.lang.Object
org.eclipse.gef.layout.algorithms.SugiyamaLayoutAlgorithm.DFSLayerProvider

All Implemented Interfaces:
  `SugiyamaLayoutAlgorithm.LayerProvider`

Enclosing class:
  SugiyamaLayoutAlgorithm

public static class SugiyamaLayoutAlgorithm.DFSLayerProvider extends Object implements SugiyamaLayoutAlgorithm.LayerProvider
Processing the nodes based on depth first search and creating a list of layers

## Constructor Summary

Constructors
Constructor
Description
`DFSLayerProvider()`

## Method Summary

Modifier and Type
Method
Description
`void`
`addAssignedNode(org.eclipse.gef.graph.Node node, int layer)`
Assigns the given layer to the given `Node`.
`List<List<SugiyamaLayoutAlgorithm.NodeWrapper>>`
`calculateLayers(List<org.eclipse.gef.graph.Node> nodeLayouts)`
Creating layers of the nodes and makes it possible to assign layers to those nodes.
`void`
`clearAssignedNodes()`
Clears the `Map` that stores the layer assignments.
`Map<org.eclipse.gef.graph.Node,Integer>`
`getAssignedNodes()`
Returns a `Map` that stores the assignment of layers to `Node`s.
`ArrayList<org.eclipse.gef.graph.Node>`
`getRoots(List<org.eclipse.gef.graph.Node> nodes)`
Finds the root elements in the list of nodes based on their connections.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### DFSLayerProvider

public DFSLayerProvider()

## Method Details

### getRoots

public ArrayList<org.eclipse.gef.graph.Node> getRoots(List<org.eclipse.gef.graph.Node> nodes)
Finds the root elements in the list of nodes based on their connections.

Parameters:
  `nodes` - The list of `Node`s for which to find the root elements.
Returns:
  the list of root elements

### getAssignedNodes

public Map<org.eclipse.gef.graph.Node,Integer> getAssignedNodes()
Returns a `Map` that stores the assignment of layers to `Node`s.

Returns:
  A `Map` that stores the assignment of layers to `Node`s.

### addAssignedNode

public void addAssignedNode(org.eclipse.gef.graph.Node node, int layer)
Assigns the given layer to the given `Node`.

Parameters:
  `node` - The `Node` to which a layer is assigned.
  `layer` - The layer that is assigned to that `Node`.

### clearAssignedNodes

public void clearAssignedNodes()
Clears the `Map` that stores the layer assignments.

### calculateLayers

public List<List<SugiyamaLayoutAlgorithm.NodeWrapper>> calculateLayers(List<org.eclipse.gef.graph.Node> nodeLayouts)
Description copied from interface: `SugiyamaLayoutAlgorithm.LayerProvider`
Creating layers of the nodes and makes it possible to assign layers to those nodes.

Specified by:
  `calculateLayers` in interface `SugiyamaLayoutAlgorithm.LayerProvider`
Parameters:
  `nodeLayouts` - List of all the nodes that needs to be organized
Returns:
  a list of layers for the given nodes, represented each as a list of `SugiyamaLayoutAlgorithm.NodeWrapper`s