O - Object type (arbitrary!)public class HashMapHierarchy<O> extends java.lang.Object implements ModifiableHierarchy<O>
| Modifier and Type | Class and Description | 
|---|---|
private class  | 
HashMapHierarchy.ItrAll
Iterator over all known elements, by insertion order. 
 | 
private class  | 
HashMapHierarchy.ItrAnc
Iterator over all Ancestors. 
 | 
private class  | 
HashMapHierarchy.ItrDesc
Iterator over all descendants. 
 | 
protected static class  | 
HashMapHierarchy.Rec<O>
Hierarchy pointers for an object. 
 | 
| Modifier and Type | Field and Description | 
|---|---|
(package private) java.lang.Object[] | 
elems
All elements, in insertion order (and will not fail badly if concurrent
 insertions happen). 
 | 
private java.util.HashMap<O,HashMapHierarchy.Rec<O>> | 
graph
Reference storage. 
 | 
(package private) int | 
numelems
Number of all elements. 
 | 
| Constructor and Description | 
|---|
HashMapHierarchy()
Constructor. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
boolean | 
add(O entry)
Add an entry (initializes data structures). 
 | 
boolean | 
add(O parent,
   O child)
Add a parent-child relationship. 
 | 
boolean | 
contains(O object)
Check if an object is part of a hierarchy. 
 | 
private HashMapHierarchy.Rec<O> | 
getRec(O obj)
Get a record. 
 | 
It<O> | 
iterAll()
Iterate over all members. 
 | 
It<O> | 
iterAncestors(O obj)
Iterate ancestors (recursive parents) 
 | 
It<O> | 
iterAncestorsSelf(O obj)
Iterate ancestors (recursive parents) and self. 
 | 
It<O> | 
iterChildren(O obj)
Iterate over the (direct) children. 
 | 
It<O> | 
iterChildrenReverse(O obj)
Iterate over the (direct) children in reverse order. 
 | 
It<O> | 
iterDescendants(O obj)
Iterate descendants (recursive children) 
 | 
It<O> | 
iterDescendantsSelf(O obj)
Iterate descendants (recursive children) and self. 
 | 
It<O> | 
iterParents(O obj)
Iterate over the (direct) parents. 
 | 
It<O> | 
iterParentsReverse(O obj)
Iterate over the (direct) parents in reverse order. 
 | 
int | 
numChildren(O obj)
Get number of children 
 | 
int | 
numParents(O obj)
Get number of (direct) parents 
 | 
private void | 
putRec(O obj,
      HashMapHierarchy.Rec<O> rec)
Put a record. 
 | 
boolean | 
remove(O entry)
Remove an entry and all its parent-child relationships. 
 | 
boolean | 
remove(O parent,
      O child)
Remove a parent-child relationship. 
 | 
private void | 
removeRec(O obj)
Remove a record. 
 | 
boolean | 
removeSubtree(O entry)
Remove an entry and it's whole subtree (unless the elements are reachable
 by a different path!) 
 | 
int | 
size()
Total size - number of objects contained. 
 | 
private final java.util.HashMap<O,HashMapHierarchy.Rec<O>> graph
java.lang.Object[] elems
int numelems
public boolean contains(O object)
Hierarchypublic int size()
Hierarchypublic boolean add(O parent, O child)
ModifiableHierarchyadd in interface ModifiableHierarchy<O>parent - Parentchild - Childtrue if changedpublic boolean add(O entry)
ModifiableHierarchyadd in interface ModifiableHierarchy<O>entry - Entrytrue if changedpublic boolean remove(O parent, O child)
ModifiableHierarchyremove in interface ModifiableHierarchy<O>parent - Parentchild - Childtrue if changedpublic boolean remove(O entry)
ModifiableHierarchyremove in interface ModifiableHierarchy<O>entry - Entrytrue if changedpublic boolean removeSubtree(O entry)
ModifiableHierarchyremoveSubtree in interface ModifiableHierarchy<O>entry - Entrytrue if changedpublic int numChildren(O obj)
HierarchynumChildren in interface Hierarchy<O>obj - object to get number of children forpublic It<O> iterChildren(O obj)
HierarchyiterChildren in interface Hierarchy<O>obj - object to get children forpublic It<O> iterChildrenReverse(O obj)
HierarchyiterChildrenReverse in interface Hierarchy<O>obj - object to get children forpublic It<O> iterDescendants(O obj)
HierarchyiterDescendants in interface Hierarchy<O>obj - object to get descendants forpublic It<O> iterDescendantsSelf(O obj)
HierarchyiterDescendantsSelf in interface Hierarchy<O>obj - object to get descendants forpublic int numParents(O obj)
HierarchynumParents in interface Hierarchy<O>obj - reference objectpublic It<O> iterParents(O obj)
HierarchyiterParents in interface Hierarchy<O>obj - object to get parents forpublic It<O> iterParentsReverse(O obj)
HierarchyiterParentsReverse in interface Hierarchy<O>obj - object to get parents forpublic It<O> iterAncestors(O obj)
HierarchyiterAncestors in interface Hierarchy<O>obj - object to get ancestors forpublic It<O> iterAncestorsSelf(O obj)
HierarchyiterAncestorsSelf in interface Hierarchy<O>obj - object to get ancestors forpublic It<O> iterAll()
Hierarchyprivate HashMapHierarchy.Rec<O> getRec(O obj)
obj - Keyprivate void putRec(O obj, HashMapHierarchy.Rec<O> rec)
obj - Keyrec - Recordprivate void removeRec(O obj)
obj - KeyCopyright © 2019 ELKI Development Team. License information.