Errai 3.0.1-SNAPSHOT

org.jboss.errai.ioc.rebind.ioc.graph
Class SortUnit

java.lang.Object
  extended by org.jboss.errai.ioc.rebind.ioc.graph.SortUnit
All Implemented Interfaces:
Comparable<SortUnit>
Direct Known Subclasses:
ProxySortUnit

public class SortUnit
extends Object
implements Comparable<SortUnit>

A sort unit is a logical sorting element for the IOC container on which to order operations in order to correctly render the bootstrapping code. A SortUnit is essentially a node in a directed graph and may have cycles.

Author:
Mike Brock

Constructor Summary
protected SortUnit(MetaClass type, List<Object> items, Set<SortUnit> dependencies)
           
 
Method Summary
 int compareTo(SortUnit o)
           
static SortUnit create(MetaClass type, Collection<Object> items, Collection<SortUnit> dependencies)
           
 boolean equals(Object o)
           
 Set<SortUnit> getDependencies()
          Returns a list of SortUnits which are depended on by this SortUnit.
 int getDepth()
          Returns the outward graph depth of this SortUnit to the outermost leaf or cycle.
 List<Object> getItems()
          Returns the list of arbitrary items associated with this sort unit.
 MetaClass getType()
          Returns the type which this sort unit represents.
 boolean hasDependency(SortUnit unit)
          Determines whether or not the specified SortUnit is a direct or indirect dependency of this SortUnit.
 int hashCode()
           
 boolean isCyclicGraph()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SortUnit

protected SortUnit(MetaClass type,
                   List<Object> items,
                   Set<SortUnit> dependencies)
Method Detail

create

public static SortUnit create(MetaClass type,
                              Collection<Object> items,
                              Collection<SortUnit> dependencies)

getType

public MetaClass getType()
Returns the type which this sort unit represents.

Returns:

getItems

public List<Object> getItems()
Returns the list of arbitrary items associated with this sort unit. There is no contract on what this should be, although the order in which items are represented in the return List are guaranteed to be the same order in which they were added.

Typically items are units of work used by the container to orchestrate the generation of code in the correct order.

Returns:
an unmodifiable list of arbitrary items.

getDependencies

public Set<SortUnit> getDependencies()
Returns a list of SortUnits which are depended on by this SortUnit.

Returns:
an unmodifiable set of SortUnits which are depended on by this SortUnit.

hasDependency

public boolean hasDependency(SortUnit unit)
Determines whether or not the specified SortUnit is a direct or indirect dependency of this SortUnit.

Parameters:
unit - the SortUnit to check against
Returns:
true if the specified SortUnit is a direct or indirect dependency of this SortUnit.

isCyclicGraph

public boolean isCyclicGraph()

getDepth

public int getDepth()
Returns the outward graph depth of this SortUnit to the outermost leaf or cycle.

Returns:
the outward depth of the graph from this SortUnit.

equals

public boolean equals(Object o)
Overrides:
equals in class Object

compareTo

public int compareTo(SortUnit o)
Specified by:
compareTo in interface Comparable<SortUnit>

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.