2727
2828import java .io .IOException ;
2929import java .nio .file .Files ;
30+ import java .util .ArrayList ;
3031
3132import static org .apache .datasketches .common .TestUtil .GENERATE_JAVA_FILES ;
3233import static org .apache .datasketches .common .TestUtil .javaPath ;
@@ -86,20 +87,20 @@ public void generateReservoirLongsSketchSampling() throws IOException {
8687
8788 @ Test (groups = {GENERATE_JAVA_FILES })
8889 public void generateReservoirLongsUnionEmpty () throws IOException {
89- final int maxK = 128 ;
90- final ReservoirLongsUnion union = ReservoirLongsUnion .newInstance (maxK );
90+ int maxK = 128 ;
91+ ReservoirLongsUnion union = ReservoirLongsUnion .newInstance (maxK );
9192
9293 Files .newOutputStream (javaPath .resolve ("reservoir_longs_union_empty_maxk" + maxK + "_java.sk" ))
9394 .write (union .toByteArray ());
9495 }
9596
9697 @ Test (groups = {GENERATE_JAVA_FILES })
9798 public void generateReservoirLongsUnionExact () throws IOException {
98- final int maxK = 128 ;
99- final int [] nArr = {1 , 10 , 32 , 100 , 128 };
99+ int maxK = 128 ;
100+ int [] nArr = {1 , 10 , 32 , 100 , 128 };
100101
101102 for (final int n : nArr ) {
102- final ReservoirLongsUnion union = ReservoirLongsUnion .newInstance (maxK );
103+ ReservoirLongsUnion union = ReservoirLongsUnion .newInstance (maxK );
103104 for (int i = 0 ; i < n ; i ++) {
104105 union .update (i );
105106 }
@@ -110,23 +111,23 @@ public void generateReservoirLongsUnionExact() throws IOException {
110111
111112 @ Test (groups = {GENERATE_JAVA_FILES })
112113 public void generateReservoirLongsUnionSampling () throws IOException {
113- final int [] maxKArr = {32 , 64 , 128 };
114- final long n = 1000 ;
114+ int [] maxKArr = {32 , 64 , 128 };
115+ long n = 1000 ;
115116
116117 for (final int maxK : maxKArr ) {
117- final long [] predeterminedSamples = new long [maxK ];
118+ long [] predeterminedSamples = new long [maxK ];
118119 for (int i = 0 ; i < maxK ; i ++) {
119120 predeterminedSamples [i ] = i * 2 ;
120121 }
121122
122- final ReservoirLongsSketch sk = ReservoirLongsSketch .getInstance (
123+ ReservoirLongsSketch sk = ReservoirLongsSketch .getInstance (
123124 predeterminedSamples ,
124125 n ,
125126 ResizeFactor .X8 ,
126127 maxK
127128 );
128129
129- final ReservoirLongsUnion union = ReservoirLongsUnion .newInstance (maxK );
130+ ReservoirLongsUnion union = ReservoirLongsUnion .newInstance (maxK );
130131 union .update (sk );
131132
132133 Files .newOutputStream (javaPath .resolve ("reservoir_longs_union_sampling_n" + n + "_maxk" + maxK + "_java.sk" ))
@@ -277,20 +278,20 @@ public void generateReservoirItemsSketchStringSampling() throws IOException {
277278
278279 @ Test (groups = {GENERATE_JAVA_FILES })
279280 public void generateReservoirItemsUnionLongEmpty () throws IOException {
280- final int maxK = 128 ;
281- final ReservoirItemsUnion <Long > union = ReservoirItemsUnion .newInstance (maxK );
281+ int maxK = 128 ;
282+ ReservoirItemsUnion <Long > union = ReservoirItemsUnion .newInstance (maxK );
282283
283284 Files .newOutputStream (javaPath .resolve ("reservoir_items_union_long_empty_maxk" + maxK + "_java.sk" ))
284285 .write (union .toByteArray (new ArrayOfLongsSerDe ()));
285286 }
286287
287288 @ Test (groups = {GENERATE_JAVA_FILES })
288289 public void generateReservoirItemsUnionLongExact () throws IOException {
289- final int maxK = 128 ;
290- final int [] nArr = {1 , 10 , 32 , 100 , 128 };
290+ int maxK = 128 ;
291+ int [] nArr = {1 , 10 , 32 , 100 , 128 };
291292
292293 for (final int n : nArr ) {
293- final ReservoirItemsUnion <Long > union = ReservoirItemsUnion .newInstance (maxK );
294+ ReservoirItemsUnion <Long > union = ReservoirItemsUnion .newInstance (maxK );
294295 for (int i = 0 ; i < n ; i ++) {
295296 union .update ((long ) i );
296297 }
@@ -301,23 +302,23 @@ public void generateReservoirItemsUnionLongExact() throws IOException {
301302
302303 @ Test (groups = {GENERATE_JAVA_FILES })
303304 public void generateReservoirItemsUnionLongSampling () throws IOException {
304- final int [] maxKArr = {32 , 64 , 128 };
305- final long n = 1000 ;
305+ int [] maxKArr = {32 , 64 , 128 };
306+ long n = 1000 ;
306307
307308 for (final int maxK : maxKArr ) {
308- final java .util .ArrayList <Long > predeterminedSamples = new java .util .ArrayList <>();
309+ java .util .ArrayList <Long > predeterminedSamples = new java .util .ArrayList <>();
309310 for (int i = 0 ; i < maxK ; i ++) {
310311 predeterminedSamples .add ((long ) (i * 2 ));
311312 }
312313
313- final ReservoirItemsSketch <Long > sk = ReservoirItemsSketch .newInstance (
314+ ReservoirItemsSketch <Long > sk = ReservoirItemsSketch .newInstance (
314315 predeterminedSamples ,
315316 n ,
316317 ResizeFactor .X8 ,
317318 maxK
318319 );
319320
320- final ReservoirItemsUnion <Long > union = ReservoirItemsUnion .newInstance (maxK );
321+ ReservoirItemsUnion <Long > union = ReservoirItemsUnion .newInstance (maxK );
321322 union .update (sk );
322323
323324 Files .newOutputStream (javaPath .resolve ("reservoir_items_union_long_sampling_n" + n + "_maxk" + maxK + "_java.sk" ))
@@ -327,20 +328,20 @@ public void generateReservoirItemsUnionLongSampling() throws IOException {
327328
328329 @ Test (groups = {GENERATE_JAVA_FILES })
329330 public void generateReservoirItemsUnionDoubleEmpty () throws IOException {
330- final int maxK = 128 ;
331- final ReservoirItemsUnion <Double > union = ReservoirItemsUnion .newInstance (maxK );
331+ int maxK = 128 ;
332+ ReservoirItemsUnion <Double > union = ReservoirItemsUnion .newInstance (maxK );
332333
333334 Files .newOutputStream (javaPath .resolve ("reservoir_items_union_double_empty_maxk" + maxK + "_java.sk" ))
334335 .write (union .toByteArray (new ArrayOfDoublesSerDe ()));
335336 }
336337
337338 @ Test (groups = {GENERATE_JAVA_FILES })
338339 public void generateReservoirItemsUnionDoubleExact () throws IOException {
339- final int maxK = 128 ;
340- final int [] nArr = {1 , 10 , 32 , 100 , 128 };
340+ int maxK = 128 ;
341+ int [] nArr = {1 , 10 , 32 , 100 , 128 };
341342
342343 for (final int n : nArr ) {
343- final ReservoirItemsUnion <Double > union = ReservoirItemsUnion .newInstance (maxK );
344+ ReservoirItemsUnion <Double > union = ReservoirItemsUnion .newInstance (maxK );
344345 for (int i = 0 ; i < n ; i ++) {
345346 union .update ((double ) i );
346347 }
@@ -351,23 +352,23 @@ public void generateReservoirItemsUnionDoubleExact() throws IOException {
351352
352353 @ Test (groups = {GENERATE_JAVA_FILES })
353354 public void generateReservoirItemsUnionDoubleSampling () throws IOException {
354- final int [] maxKArr = {32 , 64 , 128 };
355- final long n = 1000 ;
355+ int [] maxKArr = {32 , 64 , 128 };
356+ long n = 1000 ;
356357
357358 for (final int maxK : maxKArr ) {
358- final java . util . ArrayList <Double > predeterminedSamples = new java .util .ArrayList <>();
359+ ArrayList <Double > predeterminedSamples = new java .util .ArrayList <>();
359360 for (int i = 0 ; i < maxK ; i ++) {
360361 predeterminedSamples .add ((double ) (i * 2 ));
361362 }
362363
363- final ReservoirItemsSketch <Double > sk = ReservoirItemsSketch .newInstance (
364+ ReservoirItemsSketch <Double > sk = ReservoirItemsSketch .newInstance (
364365 predeterminedSamples ,
365366 n ,
366367 ResizeFactor .X8 ,
367368 maxK
368369 );
369370
370- final ReservoirItemsUnion <Double > union = ReservoirItemsUnion .newInstance (maxK );
371+ ReservoirItemsUnion <Double > union = ReservoirItemsUnion .newInstance (maxK );
371372 union .update (sk );
372373
373374 Files .newOutputStream (javaPath .resolve ("reservoir_items_union_double_sampling_n" + n + "_maxk" + maxK + "_java.sk" ))
@@ -377,20 +378,20 @@ public void generateReservoirItemsUnionDoubleSampling() throws IOException {
377378
378379 @ Test (groups = {GENERATE_JAVA_FILES })
379380 public void generateReservoirItemsUnionStringEmpty () throws IOException {
380- final int maxK = 128 ;
381- final ReservoirItemsUnion <String > union = ReservoirItemsUnion .newInstance (maxK );
381+ int maxK = 128 ;
382+ ReservoirItemsUnion <String > union = ReservoirItemsUnion .newInstance (maxK );
382383
383384 Files .newOutputStream (javaPath .resolve ("reservoir_items_union_string_empty_maxk" + maxK + "_java.sk" ))
384385 .write (union .toByteArray (new ArrayOfStringsSerDe ()));
385386 }
386387
387388 @ Test (groups = {GENERATE_JAVA_FILES })
388389 public void generateReservoirItemsUnionStringExact () throws IOException {
389- final int maxK = 128 ;
390- final int [] nArr = {1 , 10 , 32 , 100 , 128 };
390+ int maxK = 128 ;
391+ int [] nArr = {1 , 10 , 32 , 100 , 128 };
391392
392393 for (final int n : nArr ) {
393- final ReservoirItemsUnion <String > union = ReservoirItemsUnion .newInstance (maxK );
394+ ReservoirItemsUnion <String > union = ReservoirItemsUnion .newInstance (maxK );
394395 for (int i = 0 ; i < n ; i ++) {
395396 union .update ("item" + i );
396397 }
@@ -401,23 +402,23 @@ public void generateReservoirItemsUnionStringExact() throws IOException {
401402
402403 @ Test (groups = {GENERATE_JAVA_FILES })
403404 public void generateReservoirItemsUnionStringSampling () throws IOException {
404- final int [] maxKArr = {32 , 64 , 128 };
405- final long n = 1000 ;
405+ int [] maxKArr = {32 , 64 , 128 };
406+ long n = 1000 ;
406407
407408 for (final int maxK : maxKArr ) {
408- final java . util . ArrayList <String > predeterminedSamples = new java .util .ArrayList <>();
409+ ArrayList <String > predeterminedSamples = new java .util .ArrayList <>();
409410 for (int i = 0 ; i < maxK ; i ++) {
410411 predeterminedSamples .add ("item" + (i * 2 ));
411412 }
412413
413- final ReservoirItemsSketch <String > sk = ReservoirItemsSketch .newInstance (
414+ ReservoirItemsSketch <String > sk = ReservoirItemsSketch .newInstance (
414415 predeterminedSamples ,
415416 n ,
416417 ResizeFactor .X8 ,
417418 maxK
418419 );
419420
420- final ReservoirItemsUnion <String > union = ReservoirItemsUnion .newInstance (maxK );
421+ ReservoirItemsUnion <String > union = ReservoirItemsUnion .newInstance (maxK );
421422 union .update (sk );
422423
423424 Files .newOutputStream (javaPath .resolve ("reservoir_items_union_string_sampling_n" + n + "_maxk" + maxK + "_java.sk" ))
0 commit comments