public void add ( double x , double y , int k ) { sx += x * k ; sy += y * k ; sxy += x * y * k ; sx2 += x * x * k ; n += k ; if ( n < 1 ) { throw new IllegalArgumentException ( "negative count" ) ; } }
Adds a point k times . k can be negative .