private int getMaximumLeafSize(Tree tree, int max) { if (tree.isLeaf()) { return Math.max(max, tree.getFrequencySum()); } else { Iterator<Edge> e = tree.childIterator(); int maximum = max; while (e.hasNext()) { Edge edge = e.next(); Tree child = edge.getChild(); maximum = Math.max(maximum, getMaximumLeafSize(child, maximum)); } return maximum; } }
@Override public String getVertexToolTip(String object) { Tree tree = vertexMap.get(object); if (tree != null) { StringBuffer result = new StringBuffer(); if (tree.isLeaf()) { String labelString = tree.getLabel(); if (labelString != null) { result.append("<html><b>Class:</b> " + labelString + "<br>"); result.append("<b>Size:</b> " + tree.getFrequencySum() + "<br>"); result.append( "<b>Class frequencies:</b> " + SwingTools.transformToolTipText(tree.getCounterMap().toString()) + "</html>"); } } else { result.append( "<html><b>Subtree Size:</b> " + tree.getSubtreeFrequencySum() + "</html>"); } return result.toString(); } else { return null; } }