|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.mguennewig.pobjects.AbstractPObjJoin<T>
de.mguennewig.pobjects.PObjNestedSet<T>
public class PObjNestedSet<T extends Record>
Wrapper object for nested set valued joins between two tables.
Even thought the methods of this set are synchronized is there still the chance for concurrent modifications made by other database users.
Note that a nested set requires a database that supports SQL commands and
SELECT statements.
JdbcContainer| Constructor Summary | |
|---|---|
PObjNestedSet(PObject parent,
java.lang.Class<? extends Record> elementClass,
Column rightColumn)
|
|
PObjNestedSet(PObject parent,
java.lang.Class<? extends Record> elementClass,
NestedSetType nestedSetType)
Creates a new nested set. |
|
| Method Summary | |
|---|---|
T |
add(T parent,
T node)
|
T |
getAncestor(T node)
Returns the direct ancestor of the given node. |
T[] |
getChildren(T node)
Returns the direct descendants/children of the given node. |
T[] |
getDescendants(T node)
Returns all descendants (the complete subtree) of the given node. |
T[] |
getPath(T node)
Returns the path from the root to the given node. |
int |
getSubtreeSize(T node)
Returns the number of descendants for the given node. |
boolean |
isLeaf(T node)
Returns whether the given node is a leaf in the set. |
boolean |
remove(T obj)
Remove the give record obj as an element from the
nested set. |
| Methods inherited from class de.mguennewig.pobjects.AbstractPObjJoin |
|---|
clear, findAll, getContainer, getElementClass, getElementDecl, getParent, isEmpty, size |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PObjNestedSet(PObject parent,
java.lang.Class<? extends Record> elementClass,
NestedSetType nestedSetType)
public PObjNestedSet(PObject parent,
java.lang.Class<? extends Record> elementClass,
Column rightColumn)
| Method Detail |
|---|
public T add(T parent,
T node)
throws PObjConstraintException,
PObjSQLException
PObjConstraintException
PObjSQLExceptionpublic final T getAncestor(T node)
This is equivalent to use the last element of getPath(Record).
java.lang.IllegalArgumentException - if no node has been given or does not
belongs to this nested set.
PObjReadError - if any database read error occurs.public T[] getDescendants(T node)
java.lang.IllegalArgumentException - if no node has been given or does not
belongs to this nested set.
PObjReadError - if any database read error occurs.getSubtreeSize(Record)public T[] getChildren(T node)
java.lang.IllegalArgumentException - if no node has been given or does not
belongs to this nested set.
PObjReadError - if any database read error occurs.public T[] getPath(T node)
java.lang.IllegalArgumentException - if no node has been given or does not
belongs to this nested set.
PObjReadError - if any database read error occurs.public int getSubtreeSize(T node)
getDescendants(Record)public boolean isLeaf(T node)
Nodes that are not persistent are leaves.
public boolean remove(T obj)
throws PObjConstraintException,
PObjSQLException
obj as an element from the
nested set. If the element exists prior to the call, then the result is
true. The data is stored immediately in the RDBMS.
PObjConstraintException
PObjSQLException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||