com.tensegrity.composite.util
Class CompositeHierarchy

java.lang.Object
  extended bycom.tensegrity.composite.util.CompositeHierarchy

public class CompositeHierarchy
extends java.lang.Object

This class provides useful functionalities for working with hierarchies of BaseComposite objects.

Version:
$Id: CompositeHierarchy.java,v 1.13 2006/02/07 13:35:25 MichaelKegel Exp $
Author:
MichaelKegel

Constructor Summary
CompositeHierarchy()
          Constructor for CompositeHierarchy.
 
Method Summary
 void clear()
          Clears the List containing the hierarchy.
 CompositeHierarchy eliminateChildren()
          This method removes all those paths from the hierarchy, whose parents are also part of the hierarchy.
 CompositeHierarchy eliminateNonMovable()
           
 CompositeHierarchyPath findHierarchyPath(BaseComposite bcomposite)
          Returns the CompositeHierarchyPath that is holding the given BaseComposite.
 CompositeHierarchyPath getHierarchyPathAt(int index)
          Returns the CompositeHierarchyPath at the given index of this CompositeHierarchy.
 int indexOf(CompositeHierarchyPath path)
          Returns the index of the given CompositeHierarchyPath in this CompositeHierarchy.
 boolean isEmpty()
          Indicating whether this CompositeHierarchy is empty.
 boolean isEqualTo(CompositeHierarchy other)
           
 CompositeHierarchyIterator iterator()
          Returns a CompositeHierarchyIterator for this CompositeHierarchy.
 int size()
          Returns the number of elements in this hierarchy.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompositeHierarchy

public CompositeHierarchy()
Constructor for CompositeHierarchy.

Method Detail

isEmpty

public boolean isEmpty()
Indicating whether this CompositeHierarchy is empty.

Returns:
true, if this hierarchy is empty.

isEqualTo

public boolean isEqualTo(CompositeHierarchy other)

clear

public void clear()
Clears the List containing the hierarchy.


size

public int size()
Returns the number of elements in this hierarchy.

Returns:
the number of elements in this hierarchy.

indexOf

public int indexOf(CompositeHierarchyPath path)
Returns the index of the given CompositeHierarchyPath in this CompositeHierarchy.

Parameters:
path - the CompositeHierarchyPath to return the index for.
Returns:
the index of the given CompositeHierarchyPath; -1, if it is not located in this CompositeHierarchy

getHierarchyPathAt

public CompositeHierarchyPath getHierarchyPathAt(int index)
Returns the CompositeHierarchyPath at the given index of this CompositeHierarchy.

Parameters:
index - the position of the CompositeHierarchy to retrieve.
Returns:
the CompositeHierarchyPath at the given index.

findHierarchyPath

public CompositeHierarchyPath findHierarchyPath(BaseComposite bcomposite)
Returns the CompositeHierarchyPath that is holding the given BaseComposite.

Parameters:
bcomposite - the BaseComposite to look up the CompositeHierarchyPath for.
Returns:
the CompositeHierarchyPath holding the given BaseComposite.

eliminateNonMovable

public CompositeHierarchy eliminateNonMovable()

eliminateChildren

public CompositeHierarchy eliminateChildren()
This method removes all those paths from the hierarchy, whose parents are also part of the hierarchy.
It returns another CompositeHierarchy instance that contains the CompositeHierarchyPath objects that have been removed from this CompositeHierarchy instance

Returns:
CompositeHierarchy a CompositeHierarchy instance that contains the removed children of this one

iterator

public CompositeHierarchyIterator iterator()
Returns a CompositeHierarchyIterator for this CompositeHierarchy.

Returns:
a CompositeHierarchyIterator for this CompositeHierarchy.

toString

public java.lang.String toString()


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.