Package com.macrofocus.hierarchy
Class SimpleHierarchy<T>
- java.lang.Object
-
- com.macrofocus.hierarchy.AbstractHierarchy<T>
-
- com.macrofocus.hierarchy.SimpleHierarchy<T>
-
- All Implemented Interfaces:
Hierarchy<T>
,MutableHierarchy<T>
,java.io.Serializable
,java.lang.Cloneable
public class SimpleHierarchy<T> extends AbstractHierarchy<T> implements MutableHierarchy<T>, java.lang.Cloneable
A simple mutable hierarchy implementation.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SimpleHierarchy(Hierarchy<T> hierarchy)
SimpleHierarchy(T root)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
addChild(T parent, T child)
void
addChildren(T parent, java.util.List<T> children)
boolean
containsChild(T child)
boolean
containsChild(T parent, T child)
T
getChild(T parent, int index)
int
getChildCount(T parent)
java.util.List<T>
getChildList(T parent)
java.lang.Iterable<T>
getChildren(T parent)
int
getIndexOfChild(T parent, T child)
T
getParent(T child)
T
getRoot()
boolean
hasChild(T parent)
void
insertChild(T parent, int index, T child)
void
moveChild(T oldParent, T newParent, int insertionPoint, T child)
void
removeAll()
void
removeChild(T parent, T child)
void
removeChildren(java.util.List<T> children)
void
setChildren(T parent, java.util.List<T> children)
-
Methods inherited from class com.macrofocus.hierarchy.AbstractHierarchy
addHierarchyListener, addWeakHierarchyListener, breadthFirstIterator, breadthFirstIterator, depthFirstIterator, depthFirstIterator, getChildAfter, getChildBefore, getDepth, getFirstChild, getFirstLeaf, getLastChild, getLastLeaf, getLeafCount, getLevel, getListeners, getNextLeaf, getNextSibling, getPath, getPathToRoot, getPathToRoot, getPreviousLeaf, getPreviousSibling, isAncestor, isLeaf, isNodeChild, isNodeSibling, isRoot, leavesIterator, leavesIterator, notifyHierarchyNodeChanged, notifyHierarchyNodeInserted, notifyHierarchyNodeRemoved, notifyHierarchyStructureChanged, preorderIterator, preorderIterator, removeHierarchyListener, removeHierarchyListeners, setNotifyListeners, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.macrofocus.hierarchy.Hierarchy
addHierarchyListener, addWeakHierarchyListener, breadthFirstIterator, breadthFirstIterator, depthFirstIterator, depthFirstIterator, getDepth, getFirstLeaf, getLastLeaf, getLeafCount, getLevel, getListeners, getNextLeaf, getPath, getPathToRoot, getPreviousLeaf, isLeaf, isRoot, leavesIterator, leavesIterator, notifyHierarchyNodeChanged, preorderIterator, preorderIterator, removeHierarchyListener, removeHierarchyListeners, setNotifyListeners
-
-
-
-
Method Detail
-
getChildren
public java.lang.Iterable<T> getChildren(T parent)
- Specified by:
getChildren
in interfaceHierarchy<T>
-
getChildCount
public int getChildCount(T parent)
- Specified by:
getChildCount
in interfaceHierarchy<T>
-
getIndexOfChild
public int getIndexOfChild(T parent, T child)
- Specified by:
getIndexOfChild
in interfaceHierarchy<T>
-
containsChild
public boolean containsChild(T parent, T child)
- Specified by:
containsChild
in interfaceHierarchy<T>
-
containsChild
public boolean containsChild(T child)
- Specified by:
containsChild
in interfaceHierarchy<T>
-
getChildList
public java.util.List<T> getChildList(T parent)
- Specified by:
getChildList
in interfaceHierarchy<T>
-
addChild
public T addChild(T parent, T child)
- Specified by:
addChild
in interfaceMutableHierarchy<T>
-
setChildren
public void setChildren(T parent, java.util.List<T> children)
- Specified by:
setChildren
in interfaceMutableHierarchy<T>
-
addChildren
public void addChildren(T parent, java.util.List<T> children)
- Specified by:
addChildren
in interfaceMutableHierarchy<T>
-
removeChildren
public void removeChildren(java.util.List<T> children)
- Specified by:
removeChildren
in interfaceMutableHierarchy<T>
-
insertChild
public void insertChild(T parent, int index, T child)
- Specified by:
insertChild
in interfaceMutableHierarchy<T>
-
removeAll
public void removeAll()
- Specified by:
removeAll
in interfaceMutableHierarchy<T>
-
removeChild
public void removeChild(T parent, T child)
- Specified by:
removeChild
in interfaceMutableHierarchy<T>
-
-