|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--cug.ptree.PTree
Tree to store Person objects typical representation of organization (left to right this time): O.OU.OU.person etc. scenario: create tree, build structure, call get... root: parent == null; both leaves (all persons) and nodelist (all branches/groups) have members branch: leaves empty, no persons are added to branch group: nodelist empty, no brach or group is added to group add all persons to root, place persons in groups, structure groups in branches two or more references to each Person instance are kept: 1 in root and 1 in each group person belongs to
Field Summary | |
(package private) PTreeAtts |
atts
attributes for node |
(package private) static Category |
cat
|
protected java.lang.String |
code
unique code for this PTree; concatenation of name and parent names (cf distinguished name) |
(package private) java.util.Map |
leaves
Person instances belonging to this; only root PTree and groups have leaves |
(package private) java.lang.String |
name
name |
(package private) java.util.Map |
nodelist
branches and groups with parented by this |
(package private) PTree |
parent
parent PTree |
Constructor Summary | |
PTree(PTree p,
java.lang.String name)
|
|
PTree(java.lang.String name,
java.lang.String code)
create PTree as root |
Method Summary | |
void |
addNode(PTree n)
can only add node if leaves is empty (or this is root) after first call to addNode, this is a branch, and adding persons is no longer possible :error: cannot add node to group |
void |
addPerson(Person p)
can only add person if nodelist is empty (or root) if this method is called 'this' becomes a group, and adding nodes is no longer possible person is added to 'this' and to root (if 'this' is not root) :error: cannot add person to branch |
void |
build()
Deprecated. |
void |
connectPersonsToGroupName()
Deprecated. is really just foolish |
void |
connectPersonsToLevelName()
Deprecated. is really just foolish |
void |
connectPersonsToNextLevelName()
Deprecated. is really just foolish |
PTree |
createNode(java.lang.String s)
create sub-node |
java.util.List |
getAllNodes()
|
java.lang.String |
getAttribute(java.lang.String key)
public interface to ptree-atts |
java.lang.String |
getAttribute(java.lang.String key,
java.lang.String def)
public interface to ptree-atts |
protected PTreeAtts |
getAttributes()
|
java.lang.String |
getCode()
|
java.util.List |
getGroupNodes()
|
java.lang.String |
getName()
|
PTree |
getNode(java.lang.String s)
|
PTree |
getNodeBelow(java.lang.String s)
lookup |
PTree |
getNodeByName(java.lang.String s)
Deprecated. |
java.util.Iterator |
getNodeIt()
|
PTree |
getOrCreateNode(java.lang.String s)
useful when tree is filled on the fly |
PTree |
getParent()
|
java.lang.String |
getParentCode()
extract parentcode from code string ( ! |
java.util.List |
getParents()
Deprecated. |
Person |
getPerson(java.lang.String s)
retrieve person by personID |
Person |
getPersonBelow(java.lang.String key)
retrieve person by personID in this and all nodes below |
java.util.Iterator |
getPersonIt()
order by personID |
java.util.List |
getPersonsBelow()
|
java.util.Iterator |
getPersonsBelowIt()
natural order |
java.util.Iterator |
getPersonSortIt()
natural order of Person (names) |
java.util.Iterator |
getPersonSortIt(java.util.Comparator c)
|
(package private) PTreeAtts |
getPTreeAtts()
|
PTree |
getRoot()
|
boolean |
isBranch()
no leaves && parent <> null |
boolean |
isGroup()
no sub nodes |
boolean |
isRoot()
parent == null |
void |
removeAll()
empty nodelist and leaves; |
static void |
report(java.io.PrintWriter pw,
PTree pt)
diagnostic report print contents of PTree depth first to printwriter (simple text) |
void |
setAttribute(java.lang.String key,
java.lang.String value)
public interface to ptree-atts |
protected void |
setCode()
write once set code based on name (no whitespace, uppercase) and parent-code called in setParent to reset code |
void |
setCode(java.lang.String c)
write once; use to set code if parent is not yet known (asynchronous initialization) code is set again if parent is set |
void |
setParent(PTree pt)
write once; resets code :warn: ptree is moved if code is changed after reset :error: parent already set' |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
static Category cat
PTree parent
java.lang.String name
protected java.lang.String code
java.util.Map nodelist
java.util.Map leaves
PTreeAtts atts
Constructor Detail |
public PTree(java.lang.String name, java.lang.String code)
for asynchronous initialization
,
for code-constraints
public PTree(PTree p, java.lang.String name)
Method Detail |
public void build() throws java.lang.Exception
java.lang.Exception
public boolean isRoot()
public boolean isBranch()
public boolean isGroup()
public void removeAll()
public java.lang.String getName()
public PTree getParent()
public java.lang.String getCode()
public PTree getRoot()
public java.util.List getParents()
public void setParent(PTree pt)
:warn: ptree is moved if code is changed after reset
:error: parent already set'
public void setCode(java.lang.String c)
setParent(cug.ptree.PTree)
protected void setCode()
public java.lang.String getParentCode()
PTreeAtts getPTreeAtts()
protected PTreeAtts getAttributes()
public void setAttribute(java.lang.String key, java.lang.String value)
public java.lang.String getAttribute(java.lang.String key, java.lang.String def)
public java.lang.String getAttribute(java.lang.String key)
public PTree createNode(java.lang.String s)
public void addNode(PTree n)
:error: cannot add node to group
public PTree getNode(java.lang.String s)
public PTree getOrCreateNode(java.lang.String s)
public java.util.List getAllNodes()
public java.util.List getGroupNodes()
public PTree getNodeBelow(java.lang.String s)
public PTree getNodeByName(java.lang.String s)
public void addPerson(Person p)
:error: cannot add person to branch
public Person getPerson(java.lang.String s)
public Person getPersonBelow(java.lang.String key)
public java.util.Iterator getNodeIt()
public java.util.Iterator getPersonIt()
public java.util.Iterator getPersonSortIt()
public java.util.Iterator getPersonSortIt(java.util.Comparator c)
public java.util.List getPersonsBelow()
public java.util.Iterator getPersonsBelowIt()
public void connectPersonsToLevelName()
Person.setConnectedObject(java.lang.Object)
public void connectPersonsToNextLevelName()
Person.setConnectedObject(java.lang.Object)
public void connectPersonsToGroupName()
Person.setConnectedObject(java.lang.Object)
public static void report(java.io.PrintWriter pw, PTree pt)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |