public boolean isLeaf() { return getChildren().size() == 0; }
public boolean contains(Cluster cluster) { return getChildren().contains(cluster); }
public void addChild(Cluster cluster) { getChildren().add(cluster); }
public void addChild(Cluster cluster) { getChildren().add(cluster); }
public boolean isLeaf() { return getChildren().size() == 0; }
public boolean contains(Cluster cluster) { return getChildren().contains(cluster); }
public boolean contains(Cluster cluster) { return getChildren().contains(cluster); }
public void addChild(Cluster cluster) { getChildren().add(cluster); }
public boolean isLeaf() { return getChildren().size() == 0; }
private ArrayList<String[]> findCluster(Cluster cluster, double cutDist, int minPatternPerCls) { ArrayList<String[]> clusterTSIdx = new ArrayList<String[]>(); if (cluster.getDistance() != null) { // if (cluster.getDistance() > cutDist) { if (cluster.getDistanceValue() > cutDist) { if (cluster.getChildren().size() > 0) { clusterTSIdx.addAll(findCluster(cluster.getChildren().get(0), cutDist, minPatternPerCls)); clusterTSIdx.addAll(findCluster(cluster.getChildren().get(1), cutDist, minPatternPerCls)); } } else { // String[] idxes = cluster.getName().split("&"); ArrayList<String> itemsInCluster = getNameInCluster(cluster); String[] idxes = itemsInCluster.toArray(new String[itemsInCluster.size()]); if (idxes.length > minPatternPerCls) { clusterTSIdx.add(idxes); } } } return clusterTSIdx; }
public void toConsole(int indent) { for (int i = 0; i < indent; i++) { System.out.print(" "); } String name = getName() + (isLeaf() ? " (leaf)" : "") + (distance != null ? " distance: " + distance : ""); System.out.println(name); for (Cluster child : getChildren()) { child.toConsole(indent + 1); } }
public int countLeafs(Cluster node, int count) { if (node.isLeaf()) count++; for (Cluster child : node.getChildren()) { count += child.countLeafs(); } return count; }
public int countLeafs(Cluster node, int count) { if (node.isLeaf()) count++; for (Cluster child : node.getChildren()) { count += child.countLeafs(); } return count; }
public int countLeafs(Cluster<T> node, int count) { if (node.isLeaf()) count++; for (Cluster child : node.getChildren()) { count += child.countLeafs(); } return count; }
public double getTotalDistance() { double dist = getDistance() == null ? 0 : getDistance(); if (getChildren().size() > 0) { dist += children.get(0).getTotalDistance(); } return dist; }
public void toConsole(int indent) { for (int i = 0; i < indent; i++) { System.out.print(" "); } String name = getName() + (isLeaf() ? " (leaf)" : "") + (distance != null ? " distance: " + distance : ""); System.out.println(name); for (Cluster child : getChildren()) { child.toConsole(indent + 1); } }
public void toConsole(int indent) { for (int i = 0; i < indent; i++) { System.out.print(" "); } String name = getName() + (isLeaf() ? " (leaf)" : "") + (distance != null ? " distance: " + distance : ""); System.out.println(name); for (Cluster child : getChildren()) { child.toConsole(indent + 1); } }
private ArrayList<String> getNameInCluster(Cluster cluster) { ArrayList<String> itemsInCluster = new ArrayList<String>(); String nodeName; if (cluster.isLeaf()) { nodeName = cluster.getName(); itemsInCluster.add(nodeName); } else { // String[] clusterName = cluster.getName().split("#"); // nodeName = clusterName[1]; } for (Cluster child : cluster.getChildren()) { ArrayList<String> childrenNames = getNameInCluster(child); itemsInCluster.addAll(childrenNames); } return itemsInCluster; }
public double getTotalDistance() { Double dist = getDistance() == null ? 0 : getDistance().getDistance(); if (getChildren().size() > 0) { dist += children.get(0).getTotalDistance(); } return dist; }
public double getTotalDistance() { Double dist = getDistance() == null ? 0 : getDistance().getDistance(); if (getChildren().size() > 0) { dist += children.get(0).getTotalDistance(); } return dist; }