use of org.knime.base.node.mine.decisiontree2.model.DecisionTreeNode in project knime-core by knime.
the class DecTreeLearnerGraphView2 method recreateHiLite.
private void recreateHiLite() {
Set<RowKey> hilited = m_hiLiteHdl.getHiLitKeys();
Set<DecisionTreeNode> toHilite = new HashSet<DecisionTreeNode>();
DecisionTreeNode root = m_graph.getRootNode();
List<DecisionTreeNode> toProcess = new LinkedList<DecisionTreeNode>();
if (null != root) {
toProcess.add(0, root);
}
// Traverse the tree breadth first
while (!toProcess.isEmpty()) {
DecisionTreeNode curr = toProcess.remove(0);
// cover any pattern
if (curr.coveredPattern().isEmpty()) {
continue;
}
if (hilited.containsAll(curr.coveredPattern())) {
// hilite subtree starting from curr
toHilite.addAll(getSubtree(curr));
} else {
for (int i = 0; i < curr.getChildCount(); i++) {
toProcess.add(0, curr.getChildAt(i));
}
}
}
m_graph.hiLite(toHilite);
}
use of org.knime.base.node.mine.decisiontree2.model.DecisionTreeNode in project knime-core by knime.
the class DecTreePredictorNodeView method changeSelectedHiLite.
// /////////////////////////////
// routines for HiLite Support
// /////////////////////////////
/*
* hilite or unhilite all items that are covered by currently selected
* branches in the tree
*
* @param state if true hilite, otherwise unhilite selection
*/
private void changeSelectedHiLite(final boolean state) {
TreePath[] selectedPaths = m_jTree.getSelectionPaths();
if (selectedPaths == null) {
// nothing selected
return;
}
for (int i = 0; i < selectedPaths.length; i++) {
assert (selectedPaths[i] != null);
if (selectedPaths[i] == null) {
return;
}
TreePath path = selectedPaths[i];
Object lastNode = path.getLastPathComponent();
assert (lastNode != null);
assert (lastNode instanceof DecisionTreeNode);
Set<RowKey> covPat = ((DecisionTreeNode) lastNode).coveredPattern();
if (state) {
m_hiLiteHdl.fireHiLiteEvent(covPat);
} else {
m_hiLiteHdl.fireUnHiLiteEvent(covPat);
}
}
}
use of org.knime.base.node.mine.decisiontree2.model.DecisionTreeNode in project knime-core by knime.
the class DecTreeNodeView method changeSelectedHiLite.
// /////////////////////////////
// routines for HiLite Support
// /////////////////////////////
/*
* hilite or unhilite all items that are covered by currently selected
* branches in the tree
*
* @param state if true hilite, otherwise unhilite selection
*/
private void changeSelectedHiLite(final boolean state) {
TreePath[] selectedPaths = m_jTree.getSelectionPaths();
if (selectedPaths == null) {
// nothing selected
return;
}
for (int i = 0; i < selectedPaths.length; i++) {
assert (selectedPaths[i] != null);
if (selectedPaths[i] == null) {
return;
}
TreePath path = selectedPaths[i];
Object lastNode = path.getLastPathComponent();
assert (lastNode != null);
assert (lastNode instanceof DecisionTreeNode);
Set<RowKey> covPat = ((DecisionTreeNode) lastNode).coveredPattern();
if (state) {
m_hiLiteHdl.fireHiLiteEvent(covPat);
} else {
m_hiLiteHdl.fireUnHiLiteEvent(covPat);
}
}
}
use of org.knime.base.node.mine.decisiontree2.model.DecisionTreeNode in project knime-core by knime.
the class DecTreeLearnerGraphView method getSubtree.
private List<DecisionTreeNode> getSubtree(final DecisionTreeNode node) {
List<DecisionTreeNode> subTree = new ArrayList<DecisionTreeNode>();
List<DecisionTreeNode> toProcess = new LinkedList<DecisionTreeNode>();
toProcess.add(0, node);
// Traverse the tree breadth first
while (!toProcess.isEmpty()) {
DecisionTreeNode curr = toProcess.remove(0);
subTree.add(curr);
for (int i = 0; i < curr.getChildCount(); i++) {
toProcess.add(0, curr.getChildAt(i));
}
}
return subTree;
}
use of org.knime.base.node.mine.decisiontree2.model.DecisionTreeNode in project knime-core by knime.
the class DecTreeLearnerGraphView method recreateHiLite.
private void recreateHiLite() {
Set<RowKey> hilited = m_hiLiteHdl.getHiLitKeys();
Set<DecisionTreeNode> toHilite = new HashSet<DecisionTreeNode>();
DecisionTreeNode root = m_graph.getRootNode();
List<DecisionTreeNode> toProcess = new LinkedList<DecisionTreeNode>();
if (null != root) {
toProcess.add(0, root);
}
// Traverse the tree breadth first
while (!toProcess.isEmpty()) {
DecisionTreeNode curr = toProcess.remove(0);
// cover any pattern
if (curr.coveredPattern().isEmpty()) {
continue;
}
if (hilited.containsAll(curr.coveredPattern())) {
// hilite subtree starting from curr
toHilite.addAll(getSubtree(curr));
} else {
for (int i = 0; i < curr.getChildCount(); i++) {
toProcess.add(0, curr.getChildAt(i));
}
}
}
m_graph.hiLite(toHilite);
}
Aggregations