Skip to content
Permalink
Browse files
Cleanup Imports mostly
  • Loading branch information
leerho committed Oct 23, 2021
1 parent 8ad0494 commit 35bdf643e6c077b65077cafaed777bc2d1a63f95
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 17 deletions.
@@ -48,6 +48,7 @@
private S[] summaryArr_;

private enum FlagsLegacy { IS_BIG_ENDIAN, IS_EMPTY, HAS_ENTRIES, IS_THETA_INCLUDED }

private enum Flags { IS_BIG_ENDIAN, IS_READ_ONLY, IS_EMPTY, IS_COMPACT, IS_ORDERED }

/**
@@ -146,7 +147,8 @@ private enum Flags { IS_BIG_ENDIAN, IS_READ_ONLY, IS_EMPTY, IS_COMPACT, IS_ORDER
}

@SuppressWarnings({"unchecked"})
private int readSummary(final Memory mem, final int offset, final int i, final int count, final SummaryDeserializer<S> deserializer) {
private int readSummary(final Memory mem, final int offset, final int i, final int count,
final SummaryDeserializer<S> deserializer) {
final Memory memRegion = mem.region(offset, mem.getCapacity() - offset);
final DeserializeResult<S> result = deserializer.heapifySummary(memRegion);
final S summary = result.getObject();
@@ -189,11 +191,11 @@ public int getCountLessThanThetaLong(final long thetaLong) {
@SuppressWarnings("null")
@Override
public byte[] toByteArray() {
final int count = getRetainedEntries();
final int count = getRetainedEntries();
final boolean isSingleItem = count == 1 && !isEstimationMode();
final int preambleLongs = isEmpty() || isSingleItem ? 1 : isEstimationMode() ? 3 : 2;

int summariesSizeBytes = 0;
int summariesSizeBytes = 0;
byte[][] summariesBytes = null;
if (count > 0) {
summariesBytes = new byte[count][];
@@ -203,7 +205,7 @@ public byte[] toByteArray() {
}
}

int sizeBytes = Long.BYTES * preambleLongs + Long.BYTES * count + summariesSizeBytes;
final int sizeBytes = Long.BYTES * preambleLongs + Long.BYTES * count + summariesSizeBytes;
final byte[] bytes = new byte[sizeBytes];
int offset = 0;
bytes[offset++] = (byte) preambleLongs;
@@ -224,8 +226,8 @@ public byte[] toByteArray() {
offset += Integer.BYTES;
offset += 4; // unused
if (isEstimationMode()) {
ByteArrayUtil.putLongLE(bytes, offset, thetaLong_);
offset += Long.BYTES;
ByteArrayUtil.putLongLE(bytes, offset, thetaLong_);
offset += Long.BYTES;
}
}
}
@@ -21,8 +21,6 @@

import org.apache.datasketches.ByteArrayUtil;
import org.apache.datasketches.memory.Memory;
import org.apache.datasketches.tuple.DeserializeResult;
import org.apache.datasketches.tuple.UpdatableSummary;

/**
* Summary for generic tuple sketches of type Integer.
@@ -20,8 +20,6 @@
package org.apache.datasketches.tuple;

import org.apache.datasketches.memory.Memory;
import org.apache.datasketches.tuple.DeserializeResult;
import org.apache.datasketches.tuple.SummaryDeserializer;

public class IntegerSummaryDeserializer implements SummaryDeserializer<IntegerSummary> {

@@ -19,9 +19,6 @@

package org.apache.datasketches.tuple;

import org.apache.datasketches.tuple.IntegerSummary;
import org.apache.datasketches.tuple.SummaryFactory;

/**
* Factory for IntegerSummary.
*/
@@ -19,13 +19,11 @@

package org.apache.datasketches.tuple;

import org.testng.Assert;
import org.testng.annotations.Test;

import static org.apache.datasketches.Util.getResourceBytes;

import org.apache.datasketches.memory.Memory;
import org.apache.datasketches.tuple.IntegerSummary;
import org.testng.Assert;
import org.testng.annotations.Test;

@SuppressWarnings("javadoc")
public class SerialVersion3Test {

0 comments on commit 35bdf64

Please sign in to comment.