|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.lmu.ifi.dbs.elki.utilities.datastructures.hierarchy.HierarchyHashmapList<O>
O
- Object type (arbitrary!)public class HierarchyHashmapList<O>
Centralized hierarchy implementation, using a HashMap of Lists.
Nested Class Summary | |
---|---|
private class |
HierarchyHashmapList.ItrAnc
Iterator over all Ancestors. |
private class |
HierarchyHashmapList.ItrDesc
Iterator to collect into the descendants. |
Field Summary | |
---|---|
private HashMap<O,List<O>> |
cmap
The data storage for children |
private HashMap<O,List<O>> |
pmap
The data storage for parents |
Constructor Summary | |
---|---|
HierarchyHashmapList()
Constructor |
Method Summary | |
---|---|
void |
add(O parent,
O child)
Add a parent-child relationship. |
List<O> |
getChildren(O obj)
Get children list. |
List<O> |
getParents(O obj)
Get parents list. |
IterableIterator<O> |
iterAncestors(O obj)
Iterate ancestors (recursive parents) |
IterableIterator<O> |
iterDescendants(O obj)
Iterate descendants (recursive children) |
int |
numChildren(O obj)
Get number of children |
int |
numParents(O obj)
Get number of (direct) parents |
void |
put(O obj,
List<O> parents,
List<O> children)
Put an object along with parent and child lists. |
void |
remove(O parent,
O child)
Remove a parent-child relationship. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final HashMap<O,List<O>> pmap
private final HashMap<O,List<O>> cmap
Constructor Detail |
---|
public HierarchyHashmapList()
Method Detail |
---|
public void add(O parent, O child)
ModifiableHierarchy
add
in interface ModifiableHierarchy<O>
parent
- Parentchild
- Childpublic void remove(O parent, O child)
ModifiableHierarchy
remove
in interface ModifiableHierarchy<O>
parent
- Parentchild
- Childpublic void put(O obj, List<O> parents, List<O> children)
obj
- Objectparents
- Parent listchildren
- Child listpublic int numChildren(O obj)
Hierarchy
numChildren
in interface Hierarchy<O>
obj
- object to get number of children for
public List<O> getChildren(O obj)
Hierarchy
getChildren
in interface Hierarchy<O>
obj
- object to get children for
public IterableIterator<O> iterDescendants(O obj)
Hierarchy
iterDescendants
in interface Hierarchy<O>
obj
- object to get descendants for
public int numParents(O obj)
Hierarchy
numParents
in interface Hierarchy<O>
obj
- reference object
public List<O> getParents(O obj)
Hierarchy
getParents
in interface Hierarchy<O>
obj
- object to get parents for
public IterableIterator<O> iterAncestors(O obj)
Hierarchy
iterAncestors
in interface Hierarchy<O>
obj
- object to get ancestors for
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |