@@ -218,6 +218,10 @@ public boolean hasMemory() {
218
218
return (wmem != null );
219
219
}
220
220
221
+ /**
222
+ * Returns true if this sketch is in a Compact Memory Format.
223
+ * @return true if this sketch is in a Compact Memory Format.
224
+ */
221
225
public boolean isCompactMemoryFormat () {
222
226
return hasMemory () && sketchStructure != UPDATABLE ;
223
227
}
@@ -488,9 +492,18 @@ final void setLevelsArrayAt(final int index, final int idxVal) {
488
492
* Used to define the variable type of the current instance of this class.
489
493
*/
490
494
public enum SketchType {
491
- DOUBLES_SKETCH (Double .BYTES , "DoublesSketch" ),
492
- FLOATS_SKETCH (Float .BYTES , "FloatsSketch" ),
493
- ITEMS_SKETCH (0 , "ItemsSketch" );
495
+ /**
496
+ * KllDoublesSketch
497
+ */
498
+ DOUBLES_SKETCH (Double .BYTES , "KllDoublesSketch" ),
499
+ /**
500
+ * KllFloatsSketch
501
+ */
502
+ FLOATS_SKETCH (Float .BYTES , "KllFloatsSketch" ),
503
+ /**
504
+ * KllItemsSketch
505
+ */
506
+ ITEMS_SKETCH (0 , "KllItemsSketch" );
494
507
495
508
private int typeBytes ;
496
509
private String name ;
@@ -500,18 +513,30 @@ private SketchType(final int typeBytes, final String name) {
500
513
this .name = name ;
501
514
}
502
515
516
+ /**
517
+ * Gets the item size in bytes. If the item is generic, this returns zero.
518
+ * @return the item size in bytes
519
+ */
503
520
public int getBytes () { return typeBytes ; }
504
521
522
+ /**
523
+ * Get the name of the associated sketch
524
+ * @return the name of the associated sketch
525
+ */
505
526
public String getName () { return name ; }
506
527
}
507
528
508
529
/**
509
530
* Used primarily to define the structure of the serialized sketch. Also used by the Heap Sketch.
510
531
*/
511
532
public enum SketchStructure {
533
+ /** Compact Empty Structure */
512
534
COMPACT_EMPTY (PREAMBLE_INTS_EMPTY_SINGLE , SERIAL_VERSION_EMPTY_FULL ),
535
+ /** Compact Single Item Structure */
513
536
COMPACT_SINGLE (PREAMBLE_INTS_EMPTY_SINGLE , SERIAL_VERSION_SINGLE ),
537
+ /** Compact Full Preamble Structure */
514
538
COMPACT_FULL (PREAMBLE_INTS_FULL , SERIAL_VERSION_EMPTY_FULL ),
539
+ /** Updatable Preamble Structure */
515
540
UPDATABLE (PREAMBLE_INTS_FULL , SERIAL_VERSION_UPDATABLE ); //also used by the heap sketch.
516
541
517
542
private int preInts ;
@@ -522,10 +547,24 @@ private SketchStructure(final int preInts, final int serVer) {
522
547
this .serVer = serVer ;
523
548
}
524
549
550
+ /**
551
+ * gets the Preamble Integers for this Structure.
552
+ * @return the Preamble Integers for this Structure
553
+ */
525
554
public int getPreInts () { return preInts ; }
526
555
556
+ /**
557
+ * gets the Serialization Version for this Structure.
558
+ * @return the Serialization Version for this Structure.
559
+ */
527
560
public int getSerVer () { return serVer ; }
528
561
562
+ /**
563
+ * gets the SketchStructure given preInts and serVer.
564
+ * @param preInts the given preamble size in integers
565
+ * @param serVer the given Serialization Version
566
+ * @return the SketchStructure given preInts and serVer.
567
+ */
529
568
public static SketchStructure getSketchStructure (final int preInts , final int serVer ) {
530
569
final SketchStructure [] ssArr = SketchStructure .values ();
531
570
for (int i = 0 ; i < ssArr .length ; i ++) {
0 commit comments