|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.myra.datamining.data.ClassHierarchy
public class ClassHierarchy
This class represents a class hierarchy.
Field Summary | |
---|---|
static java.lang.String |
RELATION
Relationship separator between nodes of the hierarchy. |
Constructor Summary | |
---|---|
ClassHierarchy()
|
Method Summary | |
---|---|
Node |
add(java.lang.String label)
Adds a new node to the class hierarchy. |
Node |
add(java.lang.String label,
java.lang.String parent)
Adds a new node to the class hierarchy as a child of the specified parent node. |
ClassHierarchy |
clone()
|
boolean |
contains(java.lang.String label)
Tests if the hierarchy contains a node with the specified label. |
Node |
find(java.lang.String label)
Returns the node instance with the specified label. |
java.util.Collection<Node> |
flat()
Returns the collection of all nodes labels. |
java.util.Collection<Node> |
getLeaves()
Rerturns the collection of leaves of this class hierarchy. |
int |
getLevel(java.lang.String label)
Returns the hierarchical level of the specified node. |
int |
getLevels()
Returns the number of levels of the class hierarchy. |
Node |
getRoot()
|
int |
getSize()
Returns the number of nodes. |
boolean |
isEmpty()
Tests if the hierarchy has no nodes. |
boolean |
isTree()
Returns true if the class hierarchy is tree structured. |
java.lang.String |
leaf(java.util.Collection<java.lang.String> labels)
Returns the label corresponding to the leaf node of the specified collection of class labels. |
java.lang.String |
leaf(java.lang.String... labels)
Returns the label corresponding to the leaf node of the specified array of class labels. |
java.util.Collection<java.lang.String> |
leaves(java.util.Collection<java.lang.String> labels)
Returns the leaves label of the specified collection of class labels. |
java.util.Collection<java.lang.String> |
leaves(java.lang.String... labels)
Returns the leaves labels of the specified array of class labels. |
void |
link(Node parent,
Node child)
Links the specified parent-child nodes. |
void |
link(java.lang.String parent,
java.lang.String child)
Links the specified parent-child nodes. |
void |
remove(Node node)
Removes the specified node from the class hierarchy. |
void |
remove(java.lang.String node)
Removes the specified node from the class hierarchy. |
boolean |
shrink()
Swaps the root node for its single child node. |
net.sf.myra.framework.Graph<net.sf.myra.framework.Info.Void> |
toGraph()
Returns a Graph representation of the class hierarchy. |
java.lang.String |
toString()
|
boolean |
unique()
Checks if the class hierarchy has unique class label (i.e. |
void |
weigh()
Computes the weights of all nodes of the hierarchy. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String RELATION
Constructor Detail |
---|
public ClassHierarchy()
Method Detail |
---|
public boolean isEmpty()
true
if the hierarchy has no nodes;
false
otherwise.public Node getRoot()
public Node add(java.lang.String label)
label
- the label of the node to be added.
public Node add(java.lang.String label, java.lang.String parent)
label
- the label of the node to be added.parent
- the label of the parent node.
public boolean contains(java.lang.String label)
label
- the node label.
true
is the hierarchy contains a node with the
specified label; false
otherwise.public int getLevels()
public int getLevel(java.lang.String label)
label
- the label of the node.
public void link(java.lang.String parent, java.lang.String child)
parent
- the label of the parent node.child
- the label of the child node.public void link(Node parent, Node child)
parent
- the parent node.child
- the child node.public void remove(java.lang.String node)
node
- the label of the node to be removed.public void remove(Node node)
node
- the node to be removed.public Node find(java.lang.String label)
label
- the label of the node.
public int getSize()
public java.util.Collection<Node> flat()
public boolean shrink()
true
if the swap was performed; false
otherwise.public void weigh()
public java.lang.String leaf(java.util.Collection<java.lang.String> labels)
labels
- the collection of labels.
public java.lang.String leaf(java.lang.String... labels)
labels
- the array of labels.
public java.util.Collection<Node> getLeaves()
public java.util.Collection<java.lang.String> leaves(java.util.Collection<java.lang.String> labels)
labels
- the collection of labels.
public java.util.Collection<java.lang.String> leaves(java.lang.String... labels)
labels
- the array of labels.
public boolean unique()
true
if the class hierarchy contains unique class
labels; false
otherwise.public boolean isTree()
true
if the class hierarchy is tree structured.
true
if the class hierarchy is tree structured;
false
otherwise.public net.sf.myra.framework.Graph<net.sf.myra.framework.Info.Void> toGraph()
Graph
representation of the class hierarchy.
Graph
representation of the class hierarchy.public ClassHierarchy clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |