net.sf.mmm.util.collection.base
Class NodeCycle<V>

java.lang.Object
  extended by net.sf.mmm.util.collection.base.NodeCycle<V>
Type Parameters:
V - is the generic type of the nodes.

public class NodeCycle<V>
extends Object

This class is used to detect and represent a cyclic dependency of nodes.

Since:
2.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Field Summary
private  SimpleValueConverter<V,String> formatter
           
private  List<V> inverseCycle
           
private  V startNode
           
 
Constructor Summary
NodeCycle(V startNode)
          The constructor.
NodeCycle(V startNode, SimpleValueConverter<V,String> formatter)
          The constructor.
 
Method Summary
 List<V> getInverseCycle()
          This method gets the List of nodes that build a cycle.
 V getStartNode()
          This method gets the start node where the detected cycle begins.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

inverseCycle

private List<V> inverseCycle
See Also:
getInverseCycle()

startNode

private V startNode
See Also:
getStartNode()

formatter

private final SimpleValueConverter<V,String> formatter
See Also:
toString()
Constructor Detail

NodeCycle

public NodeCycle(V startNode)
The constructor.

Parameters:
startNode - is the start-node.

NodeCycle

public NodeCycle(V startNode,
                 SimpleValueConverter<V,String> formatter)
The constructor.

Parameters:
startNode - is the start-node.
formatter - is the SimpleValueConverter used to get a custom string-representation of the nodes. If null Object.toString() is used as fallback.
Method Detail

getInverseCycle

public List<V> getInverseCycle()
This method gets the List of nodes that build a cycle. It is stored in reverse order so the last node is the start of the cycle from top-level. The first node will be the same node as the last one.

Returns:
the inverse cycle of nodes.

getStartNode

public V getStartNode()
This method gets the start node where the detected cycle begins.

Returns:
the start node.

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2001-2010 mmm-Team. All Rights Reserved.