de.lmu.ifi.dbs.elki.utilities.datastructures.hierarchy
Class HierarchyReferenceLists<O extends Hierarchical<O>>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.utilities.datastructures.hierarchy.HierarchyReferenceLists<O>
Type Parameters:
O - Type of objects in hierarchy
All Implemented Interfaces:
Hierarchy<O>

public class HierarchyReferenceLists<O extends Hierarchical<O>>
extends Object
implements Hierarchy<O>

Hierarchy implementation with a per-object representation.


Nested Class Summary
private  class HierarchyReferenceLists.ItrAnc
          Iterator over all Ancestors.
private  class HierarchyReferenceLists.ItrDesc
          Iterator to collect into the descendants.
 
Field Summary
protected  List<O> children
          Storage for children
protected  O owner
          Owner
protected  List<O> parents
          Storage for parents
 
Constructor Summary
HierarchyReferenceLists(O owner, List<O> children, List<O> parents)
          Constructor for hierarchy object.
 
Method Summary
 List<O> getChildren(O self)
          Get children list.
 List<O> getParents(O self)
          Return parents
 IterableIterator<O> iterAncestors(O self)
          Iterate ancestors (recursive parents)
 IterableIterator<O> iterDescendants(O self)
          Iterate descendants (recursive children)
 int numChildren(O self)
          Get number of children
 int numParents(O self)
          Get number of (direct) parents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

owner

protected O extends Hierarchical<O> owner
Owner


children

protected List<O extends Hierarchical<O>> children
Storage for children


parents

protected List<O extends Hierarchical<O>> parents
Storage for parents

Constructor Detail

HierarchyReferenceLists

public HierarchyReferenceLists(O owner,
                               List<O> children,
                               List<O> parents)
Constructor for hierarchy object.

Parameters:
owner - owning cluster.
children - child clusters. May be null.
parents - parent clusters. May be null.
Method Detail

numChildren

public int numChildren(O self)
Description copied from interface: Hierarchy
Get number of children

Specified by:
numChildren in interface Hierarchy<O extends Hierarchical<O>>
Parameters:
self - object to get number of children for
Returns:
number of children

getChildren

public List<O> getChildren(O self)
Description copied from interface: Hierarchy
Get children list. Resulting list MAY be modified. Result MAY be null, if the model is not hierarchical.

Specified by:
getChildren in interface Hierarchy<O extends Hierarchical<O>>
Parameters:
self - object to get children for
Returns:
list of children

iterDescendants

public IterableIterator<O> iterDescendants(O self)
Description copied from interface: Hierarchy
Iterate descendants (recursive children)

Specified by:
iterDescendants in interface Hierarchy<O extends Hierarchical<O>>
Parameters:
self - object to get descendants for
Returns:
iterator for descendants

numParents

public int numParents(O self)
Description copied from interface: Hierarchy
Get number of (direct) parents

Specified by:
numParents in interface Hierarchy<O extends Hierarchical<O>>
Parameters:
self - reference object
Returns:
number of parents

getParents

public List<O> getParents(O self)
Return parents

Specified by:
getParents in interface Hierarchy<O extends Hierarchical<O>>
Parameters:
self - object to get parents for
Returns:
list of parents

iterAncestors

public IterableIterator<O> iterAncestors(O self)
Description copied from interface: Hierarchy
Iterate ancestors (recursive parents)

Specified by:
iterAncestors in interface Hierarchy<O extends Hierarchical<O>>
Parameters:
self - object to get ancestors for
Returns:
iterator for ancestors

Release 0.4.0 (2011-09-20_1324)