@ SuppressWarnings ( "WeakerAccess" ) public void update ( int node , double centroid , int count , List < Double > data , boolean forceInPlace ) { if ( centroid == centroids [ node ] || forceInPlace ) { // we prefer to update in place so repeated values don't shuffle around and for merging centroids [ node ] = centroid ; counts [ node ] = count ; if ( datas != null ) { datas [ node ] = data ; } } else { // have to do full scale update this . centroid = centroid ; this . count = count ; this . data = data ; tree . update ( node ) ; } }
Update values associated with a node readjusting the tree if necessary .