protected void rebuild ( ) { // Checks if the number of nodes in the tree exceeds the maximum number while ( this . rootCount > this . maxNumClusterFeatures ) { // Doubles the global threshold this . T *= 2.0 ; this . root . setThreshold ( calcRSquared ( 1 ) ) ; // Adds all nodes to the ClusteringFeature tree again Queue < ClusteringTreeNode > Q = new LinkedList < ClusteringTreeNode > ( ) ; Q . addAll ( this . root . getChildren ( ) ) ; this . root . clearChildren ( ) ; this . rootCount = 0 ; while ( ! Q . isEmpty ( ) ) { ClusteringTreeNode x = Q . element ( ) ; Q . addAll ( x . getChildren ( ) ) ; x . clearChildren ( ) ; bicoCFUpdate ( x ) ; Q . remove ( ) ; } } }
If the number of ClusteringTreeNodes exceeds the maximum bound the global threshold T will be doubled and the tree will be rebuild with the new threshold .