|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.partnersoft.data.PathedTree<T>
public class PathedTree<T>
A Path-based tree structure that can contain data. There is no container; nodes are trees and the head of a tree is a node without a parent.
Copyright 2009 Partner Software, Inc.
| Constructor Summary | |
|---|---|
PathedTree()
|
|
PathedTree(PathedTree<T> parent,
java.lang.String name,
T data)
|
|
| Method Summary | |
|---|---|
PathedTree<T> |
childNamed(java.lang.String name)
Returns the child node with the given name. |
java.util.List<PathedTree<T>> |
getChildren()
Return an immutable list of the children of this node. |
T |
getData()
Returns the data associated with this node. |
java.lang.String |
getName()
Returns the name of this node. |
PathedTree<T> |
getParent()
Return the parent of this node, or null if this is a root node with no parent. |
Path |
getPath()
Returns the path to this node from the root. |
boolean |
hasData()
Returns true if this node has data. |
boolean |
isLeaf()
Returns true if this node has no children. |
boolean |
isRoot()
Returns true if this node has no parent. |
java.util.Iterator<PathedTree<T>> |
iterator()
|
java.util.List<PathedTree<T>> |
listAncestors()
Returns a freshly-created, mutable list of all ancestors of this node. |
java.util.List<PathedTree<T>> |
listChildren()
Returns a freshly-created, mutable list of the children of this node. |
java.util.List<PathedTree<T>> |
listDescendents()
Returns a freshly-created, mutable list of all descendents of this node. |
Naming<PathedTree<T>> |
nameChildren()
Returns a freshly-created Naming of the children of this node. |
PathedTree<T> |
nodeFor(Path path)
Returns the node corresponding to the given relative or absolute path. |
PathedTree<T> |
nodeFor(java.lang.String pathString)
Returns the node corresponding to the given relative or absolute path string. |
PathedTree<T> |
removeChildNamed(java.lang.String name)
|
void |
setData(T newData)
Sets the data associated with this node. |
void |
setName(java.lang.String newName)
Sets the name of this node. |
void |
setParent(PathedTree<T> newParent)
Sets the parent of this node, while symmetrically setting this as a child of the parent. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PathedTree(PathedTree<T> parent,
java.lang.String name,
T data)
public PathedTree()
| Method Detail |
|---|
public PathedTree<T> getParent()
public void setParent(PathedTree<T> newParent)
public java.util.List<PathedTree<T>> getChildren()
public boolean isRoot()
public boolean isLeaf()
public boolean hasData()
public java.util.List<PathedTree<T>> listChildren()
public Naming<PathedTree<T>> nameChildren()
public java.util.List<PathedTree<T>> listAncestors()
public java.util.List<PathedTree<T>> listDescendents()
public java.lang.String getName()
public void setName(java.lang.String newName)
public T getData()
public void setData(T newData)
public Path getPath()
public PathedTree<T> nodeFor(Path path)
public PathedTree<T> nodeFor(java.lang.String pathString)
public PathedTree<T> childNamed(java.lang.String name)
public PathedTree<T> removeChildNamed(java.lang.String name)
public java.util.Iterator<PathedTree<T>> iterator()
iterator in interface java.lang.Iterable<PathedTree<T>>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||