You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by le...@apache.org on 2021/08/10 02:17:11 UTC
[datasketches-memory] 01/01: Performs some cleanup: remove trailing
spaces, organize imports, etc.
This is an automated email from the ASF dual-hosted git repository.
leerho pushed a commit to branch CleanUp
in repository https://gitbox.apache.org/repos/asf/datasketches-memory.git
commit ba50c727cc7f8293862e332d89f6034d199600b6
Author: Lee Rhodes <le...@users.noreply.github.com>
AuthorDate: Mon Aug 9 19:16:49 2021 -0700
Performs some cleanup: remove trailing spaces, organize imports, etc.
No Code changes. Merge after DS-javaIssue358
---
.../memory/test/AllocateDirectMemoryTest.java | 6 +--
.../test/AllocateDirectWritableMapMemoryTest.java | 12 ++---
.../datasketches/memory/test/BaseStateTest.java | 6 +--
.../test/ExampleMemoryRequestServerTest.java | 2 +-
.../datasketches/memory/test/LeafImplTest.java | 54 ++++++++++-----------
.../datasketches/memory/test/MemoryTest.java | 10 ++--
.../datasketches/memory/test/NioBitsTest.java | 2 +-
.../datasketches/memory/test/ReflectUtil.java | 50 +++++++++----------
.../org/apache/datasketches/memory/BaseBuffer.java | 20 ++++----
.../org/apache/datasketches/memory/BaseState.java | 56 +++++++++++-----------
.../org/apache/datasketches/memory/Buffer.java | 3 +-
.../org/apache/datasketches/memory/MapHandle.java | 2 +-
.../org/apache/datasketches/memory/Memory.java | 42 ++++++++--------
.../datasketches/memory/MemoryCloseException.java | 8 ++--
.../datasketches/memory/MemoryException.java | 8 ++--
.../apache/datasketches/memory/MurmurHash3v2.java | 8 ++--
.../org/apache/datasketches/memory/XxHash.java | 32 ++++++++-----
.../memory/internal/AllocateDirect.java | 2 +-
.../memory/internal/AllocateDirectMap.java | 10 ++--
.../memory/internal/AllocateDirectWritableMap.java | 2 +-
.../memory/internal/BaseWritableMemoryImpl.java | 2 +-
.../memory/internal/DirectWritableMemoryImpl.java | 2 +-
.../internal/HeapNonNativeWritableBufferImpl.java | 2 +-
.../internal/HeapNonNativeWritableMemoryImpl.java | 4 +-
.../memory/internal/HeapWritableBufferImpl.java | 2 +-
.../memory/internal/HeapWritableMemoryImpl.java | 2 +-
.../apache/datasketches/memory/internal/Ints.java | 2 +-
.../internal/MapNonNativeWritableBufferImpl.java | 2 +-
.../internal/MapNonNativeWritableMemoryImpl.java | 4 +-
.../memory/internal/MapWritableBufferImpl.java | 2 +-
.../memory/internal/MapWritableMemoryImpl.java | 4 +-
.../datasketches/memory/internal/NioBits.java | 2 +-
.../apache/datasketches/memory/internal/Util.java | 10 ++--
.../memory/internal/VirtualMachineMemory.java | 4 +-
.../memory/internal/WritableDirectHandleImpl.java | 4 +-
.../memory/internal/WritableMapHandleImpl.java | 2 +-
.../datasketches/memory/internal/XxHash64.java | 6 +--
37 files changed, 198 insertions(+), 193 deletions(-)
diff --git a/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/AllocateDirectMemoryTest.java b/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/AllocateDirectMemoryTest.java
index c64679c..99d03e7 100644
--- a/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/AllocateDirectMemoryTest.java
+++ b/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/AllocateDirectMemoryTest.java
@@ -34,7 +34,7 @@ import org.testng.annotations.Test;
@SuppressWarnings("javadoc")
public class AllocateDirectMemoryTest {
-
+
@Test
public void simpleAllocateDirect() throws Exception {
int longs = 32;
@@ -48,7 +48,7 @@ public class AllocateDirectMemoryTest {
//inside the TWR block the memory should be valid
ReflectUtil.checkValid(wMem);
//OK
- }
+ }
//The TWR block has exited, so the memory should be invalid
try {
ReflectUtil.checkValid(wMem);
@@ -100,7 +100,7 @@ public class AllocateDirectMemoryTest {
WritableMemory wmem = h.getWritable();
wmem.putChar(0, (char) 1);
assertEquals(wmem.getByte(1), (byte) 1);
- }
+ }
}
@Test
diff --git a/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/AllocateDirectWritableMapMemoryTest.java b/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/AllocateDirectWritableMapMemoryTest.java
index 40c4ef3..8bd42ed 100644
--- a/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/AllocateDirectWritableMapMemoryTest.java
+++ b/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/AllocateDirectWritableMapMemoryTest.java
@@ -55,20 +55,20 @@ public class AllocateDirectWritableMapMemoryTest {
private static final String LS = System.getProperty("line.separator");
static final Method IS_FILE_READ_ONLY;
-
+
static {
IS_FILE_READ_ONLY =
ReflectUtil.getMethod(ReflectUtil.ALLOCATE_DIRECT_MAP, "isFileReadOnly", File.class);
}
-
+
private static boolean isFileReadOnly(final File file) {
try {
return (boolean) IS_FILE_READ_ONLY.invoke(null, file);
- } catch (final IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
- throw new RuntimeException(e);
+ } catch (final IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ throw new RuntimeException(e);
}
}
-
+
@BeforeClass
public void setReadOnly() {
UtilTest.setGettysburgAddressFileToReadOnly();
@@ -247,7 +247,7 @@ public class AllocateDirectWritableMapMemoryTest {
println(""+count);
fail();
}
- }
+ }
@Test
public void printlnTest() {
diff --git a/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/BaseStateTest.java b/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/BaseStateTest.java
index 550e378..980ff65 100644
--- a/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/BaseStateTest.java
+++ b/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/BaseStateTest.java
@@ -29,16 +29,16 @@ import java.nio.ByteOrder;
import org.apache.datasketches.memory.Buffer;
import org.apache.datasketches.memory.Memory;
+import org.apache.datasketches.memory.WritableBuffer;
+import org.apache.datasketches.memory.WritableMemory;
import org.apache.datasketches.memory.internal.Prim;
import org.apache.datasketches.memory.internal.StepBoolean;
import org.apache.datasketches.memory.internal.Util;
-import org.apache.datasketches.memory.WritableBuffer;
-import org.apache.datasketches.memory.WritableMemory;
import org.testng.annotations.Test;
@SuppressWarnings("javadoc")
public class BaseStateTest {
-
+
@Test
public void checkPrimOffset() {
int off = (int)Prim.BYTE.off();
diff --git a/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/ExampleMemoryRequestServerTest.java b/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/ExampleMemoryRequestServerTest.java
index e1a4bd9..08cd551 100644
--- a/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/ExampleMemoryRequestServerTest.java
+++ b/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/ExampleMemoryRequestServerTest.java
@@ -56,7 +56,7 @@ public class ExampleMemoryRequestServerTest {
* by the MemoryClient when it is done with the new memory allocations.
* The initial allocation stays open until the end where it is closed at the end of the
* TWR scope.
- * @throws Exception
+ * @throws Exception
*/
@Test
public void checkExampleMemoryRequestServer2() throws Exception {
diff --git a/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/LeafImplTest.java b/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/LeafImplTest.java
index df17041..c3974f2 100644
--- a/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/LeafImplTest.java
+++ b/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/LeafImplTest.java
@@ -47,16 +47,16 @@ public class LeafImplTest {
private static final ByteOrder NO = nativeByteOrder;
private static final ByteOrder NNO = nonNativeByteOrder;
private static final MemoryRequestServer dummyMemReqSvr = new DummyMemoryRequestServer();
-
- private static ByteOrder otherOrder(ByteOrder order) { return (order == NO) ? NNO : NO; }
-
+
+ private static ByteOrder otherOrder(ByteOrder order) { return (order == NO) ? NNO : NO; }
+
static class DummyMemoryRequestServer implements MemoryRequestServer {
@Override
public WritableMemory request(long capacityBytes) { return null; }
@Override
public void requestClose(WritableMemory memToClose, WritableMemory newMemory) { }
}
-
+
@Test
public void checkDirectLeafs() throws Exception {
long off = 0;
@@ -78,7 +78,7 @@ public class LeafImplTest {
checkCombinations(memNNO, off, cap, memNNO.isDirect(), NNO, false, true);
}
}
-
+
@Test
public void checkByteBufferLeafs() {
long off = 0;
@@ -90,8 +90,8 @@ public class LeafImplTest {
WritableMemory mem = WritableMemory.writableWrap(bb, NO, dummyMemReqSvr);
assertEquals(bb.isDirect(), mem.isDirect());
assertNotNull(ReflectUtil.getUnsafeObject(mem));
- checkCombinations(mem, off, cap, mem.isDirect(), mem.getTypeByteOrder(), true, true);
-
+ checkCombinations(mem, off, cap, mem.isDirect(), mem.getTypeByteOrder(), true, true);
+
//BB off heap, native order, has ByteBuffer, has MemReqSvr
ByteBuffer dbb = ByteBuffer.allocateDirect((int)cap);
dbb.order(NO);
@@ -100,7 +100,7 @@ public class LeafImplTest {
assertEquals(dbb.isDirect(), mem.isDirect());
assertNull(ReflectUtil.getUnsafeObject(mem));
checkCombinations(mem, off, cap, mem.isDirect(), mem.getTypeByteOrder(), true, true);
-
+
//BB on heap, non native order, has ByteBuffer, has MemReqSvr
bb = ByteBuffer.allocate((int)cap);
bb.order(NNO);
@@ -109,7 +109,7 @@ public class LeafImplTest {
assertEquals(bb.isDirect(), mem.isDirect());
assertNotNull(ReflectUtil.getUnsafeObject(mem));
checkCombinations(mem, off, cap, mem.isDirect(), mem.getTypeByteOrder(), true, true);
-
+
//BB off heap, non native order, has ByteBuffer, has MemReqSvr
dbb = ByteBuffer.allocateDirect((int)cap);
dbb.order(NNO);
@@ -153,7 +153,7 @@ public class LeafImplTest {
checkCombinations(memNNO, off, cap, memNNO.isDirect(), NNO, false, false);
}
}
-
+
@Test
public void checkHeapLeafs() {
long off = 0;
@@ -172,13 +172,13 @@ public class LeafImplTest {
checkCombinations(memNNO, off, cap, memNNO.isDirect(), NNO, false, false);
}
- private static void checkCombinations(WritableMemory mem, long off, long cap,
+ private static void checkCombinations(WritableMemory mem, long off, long cap,
boolean direct, ByteOrder bo, boolean hasByteBuffer, boolean hasMemReqSvr) {
ByteOrder oo = otherOrder(bo);
-
+
assertEquals(mem.writableRegion(off, cap, bo).getShort(0), 1);
assertEquals(mem.writableRegion(off, cap, oo).getShort(0), 256);
-
+
assertEquals(mem.asWritableBuffer(bo).getShort(0), 1);
assertEquals(mem.asWritableBuffer(oo).getShort(0), 256);
@@ -186,9 +186,9 @@ public class LeafImplTest {
assertTrue( hasByteBuffer ? bb != null : bb == null);
assertTrue(mem.getTypeByteOrder() == bo);
-
+
if (hasMemReqSvr) { assertTrue(mem.getMemoryRequestServer() instanceof DummyMemoryRequestServer); }
-
+
Object obj = ReflectUtil.getUnsafeObject(mem);
if (direct) {
assertTrue(mem.isDirect());
@@ -197,7 +197,7 @@ public class LeafImplTest {
assertFalse(mem.isDirect());
assertNotNull(obj);
}
-
+
assertTrue(mem.isValid() == true);
WritableBuffer buf = mem.asWritableBuffer();
@@ -209,9 +209,9 @@ public class LeafImplTest {
bb = buf.getByteBuffer();
assertTrue(hasByteBuffer ? bb != null : bb == null);
-
+
assertTrue(buf.getTypeByteOrder() == bo);
-
+
if (hasMemReqSvr) { assertTrue(buf.getMemoryRequestServer() instanceof DummyMemoryRequestServer); }
obj = ReflectUtil.getUnsafeObject(buf);
@@ -222,7 +222,7 @@ public class LeafImplTest {
assertFalse(buf.isDirect());
assertNotNull(obj);
}
-
+
assertTrue(buf.isValid() == true);
WritableMemory nnMem = mem.writableRegion(off, cap, oo);
@@ -234,11 +234,11 @@ public class LeafImplTest {
bb = nnMem.getByteBuffer();
assertTrue( hasByteBuffer ? bb != null : bb == null);
-
+
assertTrue(nnMem.getTypeByteOrder() == oo);
-
+
if (hasMemReqSvr) { assertTrue(nnMem.getMemoryRequestServer() instanceof DummyMemoryRequestServer); }
-
+
obj = ReflectUtil.getUnsafeObject(nnMem);
if (direct) {
assertTrue(nnMem.isDirect());
@@ -247,7 +247,7 @@ public class LeafImplTest {
assertFalse(nnMem.isDirect());
assertNotNull(obj);
}
-
+
assertTrue(nnMem.isValid() == true);
WritableBuffer nnBuf = mem.asWritableBuffer(oo);
@@ -259,9 +259,9 @@ public class LeafImplTest {
bb = nnBuf.getByteBuffer();
assertTrue( hasByteBuffer ? bb != null : bb == null);
-
+
assertTrue(nnBuf.getTypeByteOrder() == oo);
-
+
if (hasMemReqSvr) { assertTrue(nnBuf.getMemoryRequestServer() instanceof DummyMemoryRequestServer); }
obj = ReflectUtil.getUnsafeObject(nnBuf);
@@ -272,8 +272,8 @@ public class LeafImplTest {
assertFalse(nnBuf.isDirect());
assertNotNull(obj);
}
-
+
assertTrue(nnBuf.isValid() == true);
}
-
+
}
diff --git a/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/MemoryTest.java b/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/MemoryTest.java
index 08c4629..6cd91a0 100644
--- a/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/MemoryTest.java
+++ b/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/MemoryTest.java
@@ -23,7 +23,7 @@
package org.apache.datasketches.memory.test;
-import static org.apache.datasketches.memory.internal.Util.*;
+import static org.apache.datasketches.memory.internal.Util.getResourceFile;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotNull;
@@ -37,10 +37,10 @@ import java.util.List;
import org.apache.datasketches.memory.BaseState;
import org.apache.datasketches.memory.MapHandle;
-import org.apache.datasketches.memory.WritableHandle;
import org.apache.datasketches.memory.Memory;
-import org.apache.datasketches.memory.internal.Util;
+import org.apache.datasketches.memory.WritableHandle;
import org.apache.datasketches.memory.WritableMemory;
+import org.apache.datasketches.memory.internal.Util;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -49,7 +49,7 @@ import org.testng.collections.Lists;
@SuppressWarnings("javadoc")
public class MemoryTest {
private static final String LS = System.getProperty("line.separator");
-
+
@BeforeClass
public void setReadOnly() {
UtilTest.setGettysburgAddressFileToReadOnly();
@@ -411,7 +411,7 @@ public class MemoryTest {
MapHandle mmh1 = Memory.map(file);
MapHandle mmh2 = Memory.map(file);
-
+
assertEquals(BaseState.getCurrentDirectMemoryMapAllocations(), 2L);
assertEquals(BaseState.getCurrentDirectMemoryMapAllocated(), 2 * bytes);
diff --git a/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/NioBitsTest.java b/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/NioBitsTest.java
index 152f666..9e45535 100644
--- a/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/NioBitsTest.java
+++ b/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/NioBitsTest.java
@@ -35,7 +35,7 @@ public class NioBitsTest {
println("Page Aligned: " + ReflectUtil.isPageAligned());
println("Page Size: " + ReflectUtil.pageSize());
}
-
+
@Test
public void checkGetAtomicFields() {
//testing this beyond 2GB may not work on JVMs < 8GB.
diff --git a/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/ReflectUtil.java b/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/ReflectUtil.java
index 1999586..8892454 100644
--- a/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/ReflectUtil.java
+++ b/datasketches-memory-java8-tests/src/test/java/org/apache/datasketches/memory/test/ReflectUtil.java
@@ -31,13 +31,13 @@ import org.apache.datasketches.memory.MemoryRequestServer;
public final class ReflectUtil {
private ReflectUtil() {}
-
+
static final Class<?> BASE_STATE;
static final Class<?> BASE_WRITABLE_MEMORY_IMPL;
static final Class<?> ALLOCATE_DIRECT_MAP;
static final Class<?> NIO_BITS;
-
- static final Method CHECK_VALID; //BaseStateImpl
+
+ static final Method CHECK_VALID; //BaseStateImpl
static final Method GET_DIRECT_ALLOCATIONS_COUNT; //NioBits
static final Method GET_MAX_DIRECT_BYTE_BUFFER_MEMORY; //NioBits
static final Method GET_NATIVE_BASE_OFFSET; //BaseStateImpl
@@ -60,15 +60,15 @@ public final class ReflectUtil {
static final Method RESERVE_MEMORY; //NioBits
static final Method UNRESERVE_MEMORY; //NioBits
static final Method WRAP_DIRECT; //BaseWritableMemoryImpl
-
+
static {
- BASE_STATE =
+ BASE_STATE =
getClass("org.apache.datasketches.memory.internal.BaseStateImpl");
- BASE_WRITABLE_MEMORY_IMPL =
+ BASE_WRITABLE_MEMORY_IMPL =
getClass("org.apache.datasketches.memory.internal.BaseWritableMemoryImpl");
- ALLOCATE_DIRECT_MAP =
+ ALLOCATE_DIRECT_MAP =
getClass("org.apache.datasketches.memory.internal.AllocateDirectMap");
- NIO_BITS =
+ NIO_BITS =
getClass("org.apache.datasketches.memory.internal.NioBits");
CHECK_VALID =
@@ -83,7 +83,7 @@ public final class ReflectUtil {
getMethod(NIO_BITS, "getReservedMemory", (Class<?>[])null); //static
GET_TOTAL_CAPACITY =
getMethod(NIO_BITS, "getTotalCapacity", (Class<?>[])null); //static
- GET_UNSAFE_OBJECT =
+ GET_UNSAFE_OBJECT =
getMethod(BASE_STATE, "getUnsafeObject", (Class<?>[])null); //not static
IS_BB_TYPE =
getMethod(BASE_STATE, "isBBType", (Class<?>[])null); //not static
@@ -116,13 +116,13 @@ public final class ReflectUtil {
UNRESERVE_MEMORY =
getMethod(NIO_BITS, "unreserveMemory", long.class, long.class); //static
WRAP_DIRECT =
- getMethod(BASE_WRITABLE_MEMORY_IMPL,
+ getMethod(BASE_WRITABLE_MEMORY_IMPL,
"wrapDirect", long.class, ByteOrder.class, MemoryRequestServer.class); //static method
}
-
+
/**
- * Gets a Class reference to the given class loaded by the SystemClassLoader.
- * This will work for private, package-private and abstract classes.
+ * Gets a Class reference to the given class loaded by the SystemClassLoader.
+ * This will work for private, package-private and abstract classes.
* @param fullyQualifiedBinaryName the binary name is the name of the class file on disk. This does not instantiate
* a concrete class, but allows access to constructors, static fields and static methods.
* @return the Class object of the given class.
@@ -162,17 +162,17 @@ public final class ReflectUtil {
try {
constructor.setAccessible(true);
return constructor.newInstance(initargs);
- } catch (final InstantiationException | IllegalAccessException | IllegalArgumentException
+ } catch (final InstantiationException | IllegalAccessException | IllegalArgumentException
| InvocationTargetException | SecurityException e) {
throw new RuntimeException(e);
}
}
-
+
/**
* Gets a declared field of the given the loaded owner class and field name. The accessible flag will be set true.
* @param ownerClass the Class<?> object of the class loaded by the SystemClassLoader.
* @param fieldName the desired field name
- * @return the desired field.
+ * @return the desired field.
*/
public static Field getField(final Class<?> ownerClass, final String fieldName) {
try {
@@ -183,7 +183,7 @@ public final class ReflectUtil {
throw new RuntimeException(e);
}
}
-
+
/**
* Gets a field value given the loaded owner class and the Field. The accessible flag will be set true.
* @param ownerClass the loaded class owning the field
@@ -198,11 +198,11 @@ public final class ReflectUtil {
throw new RuntimeException(e);
}
}
-
+
/**
- * Gets a declared method of the given the loaded owning class, method name and parameter types.
- * The accessible flag will be set true.
- * @param ownerClass the given
+ * Gets a declared method of the given the loaded owning class, method name and parameter types.
+ * The accessible flag will be set true.
+ * @param ownerClass the given
* @param methodName the given method name
* @param parameterTypes the list of parameter types
* @return the desired method.
@@ -210,7 +210,7 @@ public final class ReflectUtil {
public static Method getMethod(
final Class<?> ownerClass, final String methodName, final Class<?>... parameterTypes ) {
try {
- final Method method = (parameterTypes == null)
+ final Method method = (parameterTypes == null)
? ownerClass.getDeclaredMethod(methodName)
: ownerClass.getDeclaredMethod(methodName, parameterTypes);
method.setAccessible(true);
@@ -219,7 +219,7 @@ public final class ReflectUtil {
throw new RuntimeException(e);
}
}
-
+
static void checkValid(final Object target) {
try {
CHECK_VALID.invoke(target);
@@ -231,8 +231,8 @@ public final class ReflectUtil {
static long getDirectAllocationsCount() {
try {
return (long) GET_DIRECT_ALLOCATIONS_COUNT.invoke(null);
- } catch (final IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
- throw new RuntimeException(e);
+ } catch (final IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ throw new RuntimeException(e);
}
}
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/BaseBuffer.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/BaseBuffer.java
index 220092d..fd14737 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/BaseBuffer.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/BaseBuffer.java
@@ -29,7 +29,7 @@ public interface BaseBuffer extends BaseState {
* @return BaseBuffer
*/
BaseBuffer incrementPosition(long increment);
-
+
/**
* Increments the current position by the given increment.
* Checks that the resource is valid and that the positional invariants are not violated,
@@ -38,7 +38,7 @@ public interface BaseBuffer extends BaseState {
* @return BaseBuffer
*/
BaseBuffer incrementAndCheckPosition(final long increment);
-
+
/**
* Gets the end position
* @return the end position
@@ -115,12 +115,12 @@ public interface BaseBuffer extends BaseState {
* @return BaseBuffer
*/
BaseBuffer setAndCheckStartPositionEnd(long start, long position, long end);
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
}
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/BaseState.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/BaseState.java
index c3728dd..47b2249 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/BaseState.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/BaseState.java
@@ -35,14 +35,14 @@ public interface BaseState {
static final MemoryRequestServer defaultMemReqSvr = new DefaultMemoryRequestServer();
//Byte Order Related
-
+
/**
* Gets the current Type ByteOrder.
* This may be different from the ByteOrder of the backing resource and of the Native Byte Order.
* @return the current Type ByteOrder.
*/
ByteOrder getTypeByteOrder();
-
+
/**
* Returns true if the Native ByteOrder is the same as the ByteOrder of the
* current Buffer or Memory and the same ByteOrder as the given byteOrder.
@@ -51,7 +51,7 @@ public interface BaseState {
* current Buffer or Memory and the same ByteOrder as the given byteOrder.
*/
boolean isByteOrderCompatible(ByteOrder byteOrder);
-
+
/**
* Returns true if the given object is an instance of this class and has equal data contents.
* @param that the given object
@@ -59,7 +59,7 @@ public interface BaseState {
*/
@Override
boolean equals(Object that);
-
+
/**
* Returns true if the given object is an instance of this class and has equal contents to
* this object in the given range of bytes. This will also check two distinct ranges within the
@@ -73,19 +73,19 @@ public interface BaseState {
*/
boolean equalTo(long thisOffsetBytes, Object that,
long thatOffsetBytes, long lengthBytes);
-
+
/**
* Gets the backing ByteBuffer if it exists, otherwise returns null.
* @return the backing ByteBuffer if it exists, otherwise returns null.
*/
ByteBuffer getByteBuffer();
-
+
/**
* Gets the capacity of this object in bytes
* @return the capacity of this object in bytes
*/
long getCapacity();
-
+
/**
* Gets the cumulative offset in bytes of this object from the backing resource.
* This offset may also include other offset components such as the native off-heap
@@ -94,7 +94,7 @@ public interface BaseState {
* @return the cumulative offset in bytes of this object from the backing resource.
*/
long getCumulativeOffset();
-
+
/**
* Gets the cumulative offset in bytes of this object from the backing resource including the given
* offsetBytes. This offset may also include other offset components such as the native off-heap
@@ -105,7 +105,7 @@ public interface BaseState {
* given offsetBytes.
*/
long getCumulativeOffset(long offsetBytes);
-
+
/**
* Returns the offset of address zero of this object relative to the address zero of the
* backing resource but not including the size of any Java object header.
@@ -113,7 +113,7 @@ public interface BaseState {
* backing resource but not including the size of any Java object header.
*/
long getRegionOffset();
-
+
/**
* Returns the offset of address zero of this object relative to the address zero of the
* backing resource plus the given offsetBytes but not including the size of any Java object
@@ -124,13 +124,13 @@ public interface BaseState {
* header.
*/
long getRegionOffset(long offsetBytes);
-
+
/**
* Returns true if this object is backed by an on-heap primitive array
* @return true if this object is backed by an on-heap primitive array
*/
boolean hasArray();
-
+
/**
* Returns the hashCode of this object.
*
@@ -145,7 +145,7 @@ public interface BaseState {
*/
@Override
int hashCode();
-
+
/**
* Returns the 64-bit hash of the sequence of bytes in this object specified by
* <i>offsetBytes</i>, <i>lengthBytes</i> and a <i>seed</i>. Note that the sequence of bytes is
@@ -158,7 +158,7 @@ public interface BaseState {
* <i>offsetBytes</i> and <i>lengthBytes</i>.
*/
long xxHash64(long offsetBytes, long lengthBytes, long seed);
-
+
/**
* Returns a 64-bit hash from a single long. This method has been optimized for speed when only
* a single hash of a long is required.
@@ -167,26 +167,26 @@ public interface BaseState {
* @return the hash.
*/
long xxHash64(long in, long seed);
-
+
/**
* Returns true if this Memory is backed by a ByteBuffer.
* @return true if this Memory is backed by a ByteBuffer.
*/
boolean hasByteBuffer();
-
+
/**
* Returns true if the backing resource is direct (off-heap) memory.
* This is the case for allocated direct memory, memory mapped files,
* @return true if the backing resource is direct (off-heap) memory.
*/
boolean isDirect();
-
+
/**
* Returns true if this object or the backing resource is read-only.
* @return true if this object or the backing resource is read-only.
*/
boolean isReadOnly();
-
+
/**
* Returns true if the backing resource of <i>this</i> is identical with the backing resource
* of <i>that</i>. The capacities must be the same. If <i>this</i> is a region,
@@ -196,14 +196,14 @@ public interface BaseState {
* of <i>that</i>.
*/
boolean isSameResource(Object that);
-
+
/**
* Returns true if this object is valid and has not been closed.
* This is relevant only for direct (off-heap) memory and Mapped Files.
* @return true if this object is valid and has not been closed.
*/
boolean isValid();
-
+
/**
* Checks that the specified range of bytes is within bounds of this object, throws
* {@link IllegalArgumentException} if it's not: i. e. if offsetBytes < 0, or length < 0,
@@ -212,9 +212,9 @@ public interface BaseState {
* @param lengthBytes the given length in bytes of this object
*/
void checkValidAndBounds(long offsetBytes, long lengthBytes);
-
+
//Monitoring
-
+
/**
* Gets the current number of active direct memory allocations.
* @return the current number of active direct memory allocations.
@@ -222,7 +222,7 @@ public interface BaseState {
static long getCurrentDirectMemoryAllocations() {
return BaseStateImpl.getCurrentDirectMemoryAllocations();
}
-
+
/**
* Gets the current size of active direct memory allocated.
* @return the current size of active direct memory allocated.
@@ -230,7 +230,7 @@ public interface BaseState {
static long getCurrentDirectMemoryAllocated() {
return BaseStateImpl.getCurrentDirectMemoryAllocated();
}
-
+
/**
* Gets the current number of active direct memory map allocations.
* @return the current number of active direct memory map allocations.
@@ -238,7 +238,7 @@ public interface BaseState {
static long getCurrentDirectMemoryMapAllocations() {
return BaseStateImpl.getCurrentDirectMemoryMapAllocations();
}
-
+
/**
* Gets the current size of active direct memory map allocated.
* @return the current size of active direct memory map allocated.
@@ -246,9 +246,9 @@ public interface BaseState {
static long getCurrentDirectMemoryMapAllocated() {
return BaseStateImpl.getCurrentDirectMemoryMapAllocated();
}
-
+
//TO STRING
-
+
/**
* Returns a formatted hex string of a range of this object.
* Used primarily for testing.
@@ -258,5 +258,5 @@ public interface BaseState {
* @return a formatted hex string in a human readable array
*/
String toHexString(String header, long offsetBytes, int lengthBytes);
-
+
}
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Buffer.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Buffer.java
index c3389bf..41b5224 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Buffer.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Buffer.java
@@ -17,7 +17,6 @@
* under the License.
*/
-
package org.apache.datasketches.memory;
import java.nio.ByteBuffer;
@@ -52,7 +51,7 @@ public interface Buffer extends BaseBuffer {
static Buffer wrap(ByteBuffer byteBuf, ByteOrder byteOrder) {
return BufferImpl.wrap(byteBuf, byteOrder);
}
-
+
//DUPLICATES
/**
* Returns a read-only duplicate view of this Buffer with the same but independent values of
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MapHandle.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MapHandle.java
index aa7fcb9..d0c498e 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MapHandle.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MapHandle.java
@@ -22,7 +22,7 @@ package org.apache.datasketches.memory;
/**
* A Handle for a memory-mapped, read-only file resource. This
* joins a Read-only Handle with an AutoCloseable Map resource.
- * Please read Javadocs for {@link Handle}.
+ * Please read Javadocs for {@link Handle}.
*
* @author Lee Rhodes
* @author Roman Leventov
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Memory.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Memory.java
index e9ca86c..1f50f3a 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Memory.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Memory.java
@@ -32,7 +32,7 @@ import org.apache.datasketches.memory.internal.Util;
public interface Memory extends BaseState {
//BYTE BUFFER
-
+
/**
* Accesses the given ByteBuffer for read-only operations. The returned <i>Memory</i> object has
* the same byte order, as the given ByteBuffer, unless the capacity of the given ByteBuffer is
@@ -47,7 +47,7 @@ public interface Memory extends BaseState {
static Memory wrap(ByteBuffer byteBuf) {
return MemoryImpl.wrap(byteBuf);
}
-
+
/**
* Accesses the given ByteBuffer for read-only operations. The returned <i>Memory</i> object has
* the given byte order, ignoring the byte order of the given ByteBuffer. If the capacity of the
@@ -64,7 +64,7 @@ public interface Memory extends BaseState {
static Memory wrap(ByteBuffer byteBuf, ByteOrder byteOrder) {
return MemoryImpl.wrap(byteBuf, byteOrder);
}
-
+
//MAP
/**
* Maps the entire given file into native-ordered Memory for read operations
@@ -81,7 +81,7 @@ public interface Memory extends BaseState {
static MapHandle map(File file) {
return MemoryImpl.map(file, 0, file.length(), ByteOrder.nativeOrder());
}
-
+
/**
* Maps the specified portion of the given file into Memory for read operations
* (including those > 2GB).
@@ -98,7 +98,7 @@ public interface Memory extends BaseState {
static MapHandle map(File file, long fileOffsetBytes, long capacityBytes, ByteOrder byteOrder) {
return MemoryImpl.map(file, fileOffsetBytes, capacityBytes, byteOrder);
}
-
+
//REGIONS
/**
* A region is a read-only view of this object.
@@ -114,7 +114,7 @@ public interface Memory extends BaseState {
* offsetBytes and capacityBytes.
*/
Memory region(long offsetBytes, long capacityBytes);
-
+
/**
* A region is a read-only view of this object.
* <ul>
@@ -131,7 +131,7 @@ public interface Memory extends BaseState {
* offsetBytes, capacityBytes and byteOrder.
*/
Memory region(long offsetBytes, long capacityBytes, ByteOrder byteOrder);
-
+
//AS BUFFER
/**
* Returns a new <i>Buffer</i> view of this object.
@@ -148,7 +148,7 @@ public interface Memory extends BaseState {
* @return a new <i>Buffer</i>
*/
Buffer asBuffer();
-
+
/**
* Returns a new <i>Buffer</i> view of this object, with the given
* byte order.
@@ -166,7 +166,7 @@ public interface Memory extends BaseState {
* @return a new <i>Buffer</i> with the given byteOrder.
*/
Buffer asBuffer(ByteOrder byteOrder);
-
+
//UNSAFE BYTE BUFFER VIEW
/**
* Returns the specified region of this Memory object as a new read-only {@link ByteBuffer}
@@ -191,7 +191,7 @@ public interface Memory extends BaseState {
* when it wraps a non-byte Java array.
*/
ByteBuffer unsafeByteBufferView(long offsetBytes, int capacityBytes);
-
+
//ACCESS PRIMITIVE HEAP ARRAYS for readOnly
/**
* Wraps the given primitive array for read operations assuming native byte order. If the array
@@ -206,7 +206,7 @@ public interface Memory extends BaseState {
static Memory wrap(boolean[] arr) {
return MemoryImpl.wrap(arr);
}
-
+
/**
* Wraps the given primitive array for read operations assuming native byte order. If the array
* size is zero, backing storage and byte order of the returned <i>Memory</i> object are
@@ -220,7 +220,7 @@ public interface Memory extends BaseState {
static Memory wrap(byte[] arr) {
return MemoryImpl.wrap(arr, 0, arr.length, Util.nativeByteOrder);
}
-
+
/**
* Wraps the given primitive array for read operations with the given byte order. If the array
* size is zero, backing storage and byte order of the returned <i>Memory</i> object are
@@ -235,7 +235,7 @@ public interface Memory extends BaseState {
static Memory wrap(byte[] arr, ByteOrder byteOrder) {
return MemoryImpl.wrap(arr, 0, arr.length, byteOrder);
}
-
+
/**
* Wraps the given primitive array for read operations with the given byte order. If the given
* lengthBytes is zero, backing storage and byte order of the returned <i>Memory</i> object are
@@ -253,7 +253,7 @@ public interface Memory extends BaseState {
ByteOrder byteOrder) {
return MemoryImpl.wrap(arr, offsetBytes, lengthBytes, byteOrder);
}
-
+
/**
* Wraps the given primitive array for read operations assuming native byte order. If the array
* size is zero, backing storage and byte order of the returned <i>Memory</i> object are unspecified.
@@ -266,7 +266,7 @@ public interface Memory extends BaseState {
static Memory wrap(char[] arr) {
return MemoryImpl.wrap(arr);
}
-
+
/**
* Wraps the given primitive array for read operations assuming native byte order. If the array
* size is zero, backing storage and byte order of the returned <i>Memory</i> object are unspecified.
@@ -279,7 +279,7 @@ public interface Memory extends BaseState {
static Memory wrap(short[] arr) {
return MemoryImpl.wrap(arr);
}
-
+
/**
* Wraps the given primitive array for read operations assuming native byte order. If the array
* size is zero, backing storage and byte order of the returned <i>Memory</i> object are unspecified.
@@ -292,7 +292,7 @@ public interface Memory extends BaseState {
static Memory wrap(int[] arr) {
return MemoryImpl.wrap(arr);
}
-
+
/**
* Wraps the given primitive array for read operations assuming native byte order. If the array
* size is zero, backing storage and byte order of the returned <i>Memory</i> object are
@@ -306,7 +306,7 @@ public interface Memory extends BaseState {
static Memory wrap(long[] arr) {
return MemoryImpl.wrap(arr);
}
-
+
/**
* Wraps the given primitive array for read operations assuming native byte order. If the array
* size is zero, backing storage and byte order of the returned <i>Memory</i> object are
@@ -320,7 +320,7 @@ public interface Memory extends BaseState {
static Memory wrap(float[] arr) {
return MemoryImpl.wrap(arr);
}
-
+
/**
* Wraps the given primitive array for read operations assuming native byte order. If the array
* size is zero, backing storage and byte order of the returned <i>Memory</i> object are
@@ -334,7 +334,7 @@ public interface Memory extends BaseState {
static Memory wrap(double[] arr) {
return MemoryImpl.wrap(arr);
}
-
+
//PRIMITIVE getX() and getXArray()
/**
* Gets the boolean value at the given offset
@@ -418,7 +418,7 @@ public interface Memory extends BaseState {
* @return the number of characters decoded.
* @throws Utf8CodingException in case of malformed or illegal UTF-8 input
*/
- int getCharsFromUtf8(long offsetBytes, int utf8LengthBytes, StringBuilder dst)
+ int getCharsFromUtf8(long offsetBytes, int utf8LengthBytes, StringBuilder dst)
throws Utf8CodingException;
/**
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MemoryCloseException.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MemoryCloseException.java
index b6260a5..072067f 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MemoryCloseException.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MemoryCloseException.java
@@ -20,18 +20,18 @@
package org.apache.datasketches.memory;
/**
- * Specific RuntimeException for the AutoCloseable.close() method.
- *
+ * Specific RuntimeException for the AutoCloseable.close() method.
+ *
* @author Lee Rhodes
*
*/
public class MemoryCloseException extends MemoryException {
private static final long serialVersionUID = 2L;
-
+
public MemoryCloseException() {
super("The associated resource failed to close.");
}
-
+
public MemoryCloseException(final String resource) {
super("The associated resource, " + resource + ", failed to close");
}
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MemoryException.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MemoryException.java
index fb51a91..6b3663c 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MemoryException.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MemoryException.java
@@ -21,18 +21,18 @@ package org.apache.datasketches.memory;
/**
* Specific RuntimeExceptions for the datasketches-memory component.
- *
+ *
* @author Lee Rhodes
*
*/
public class MemoryException extends RuntimeException {
private static final long serialVersionUID = 1L;
-
+
/**
* Constructs a new runtime exception with the specified detail message. The cause is not
* initialized, and may subsequently be initialized by a call to
* Throwable.initCause(java.lang.Throwable).
- *
+ *
* @param message the detail message. The detail message is saved for later retrieval by the
* Throwable.getMessage() method.
*/
@@ -40,5 +40,3 @@ public class MemoryException extends RuntimeException {
super(message);
}
}
-
-
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MurmurHash3v2.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MurmurHash3v2.java
index 888a0cf..b958213 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MurmurHash3v2.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MurmurHash3v2.java
@@ -159,7 +159,7 @@ public final class MurmurHash3v2 {
/**
* Returns a 128-bit hash of the input as a long array of size 2.
*
- * @param mem The input on-heap Memory. Must be non-null and non-empty,
+ * @param mem The input on-heap Memory. Must be non-null and non-empty,
* otherwise throws IllegalArgumentException.
* @param offsetBytes the starting point within Memory.
* @param lengthBytes the total number of bytes to be hashed.
@@ -170,12 +170,12 @@ public final class MurmurHash3v2 {
@SuppressWarnings("restriction")
public static long[] hash(final Memory mem, final long offsetBytes, final long lengthBytes,
final long seed, final long[] hashOut) {
- if ((mem == null) || (mem.getCapacity() == 0L)) {
+ if ((mem == null) || (mem.getCapacity() == 0L)) {
throw new IllegalArgumentException("Input mem is empty or null.");
}
final Object uObj = ((WritableMemory) mem).getArray();
- if (uObj == null) {
- throw new IllegalArgumentException("The backing resource of input mem is not on-heap.");
+ if (uObj == null) {
+ throw new IllegalArgumentException("The backing resource of input mem is not on-heap.");
}
long cumOff = mem.getCumulativeOffset() + offsetBytes;
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/XxHash.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/XxHash.java
index e17b34b..de20bd5 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/XxHash.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/XxHash.java
@@ -19,7 +19,15 @@
package org.apache.datasketches.memory;
-import static org.apache.datasketches.memory.internal.XxHash64.*;
+import static org.apache.datasketches.memory.internal.XxHash64.hash;
+import static org.apache.datasketches.memory.internal.XxHash64.hashBooleans;
+import static org.apache.datasketches.memory.internal.XxHash64.hashBytes;
+import static org.apache.datasketches.memory.internal.XxHash64.hashChars;
+import static org.apache.datasketches.memory.internal.XxHash64.hashDoubles;
+import static org.apache.datasketches.memory.internal.XxHash64.hashFloats;
+import static org.apache.datasketches.memory.internal.XxHash64.hashInts;
+import static org.apache.datasketches.memory.internal.XxHash64.hashLongs;
+import static org.apache.datasketches.memory.internal.XxHash64.hashShorts;
/**
* The XxHash is a fast, non-cryptographic, 64-bit hash function that has
@@ -42,7 +50,7 @@ import static org.apache.datasketches.memory.internal.XxHash64.*;
public final class XxHash {
public XxHash() { /* singleton */ }
-
+
/**
* Hash the given arr starting at the given offset and continuing for the given length using the
* given seed.
@@ -56,7 +64,7 @@ public final class XxHash {
final long lengthBooleans, final long seed) {
return hashBooleans(arr, offsetBooleans, lengthBooleans, seed);
}
-
+
/**
* Hash the given arr starting at the given offset and continuing for the given length using the
* given seed.
@@ -70,7 +78,7 @@ public final class XxHash {
final long lengthBytes, final long seed) {
return hashBytes(arr, offsetBytes, lengthBytes, seed);
}
-
+
/**
* Hash the given arr starting at the given offset and continuing for the given length using the
* given seed.
@@ -84,7 +92,7 @@ public final class XxHash {
final long lengthShorts, final long seed) {
return hashShorts(arr, offsetShorts, lengthShorts, seed);
}
-
+
/**
* Hash the given arr starting at the given offset and continuing for the given length using the
* given seed.
@@ -98,7 +106,7 @@ public final class XxHash {
final long lengthChars, final long seed) {
return hashChars(arr, offsetChars, lengthChars, seed);
}
-
+
/**
* Hash the given arr starting at the given offset and continuing for the given length using the
* given seed.
@@ -112,7 +120,7 @@ public final class XxHash {
final long lengthInts, final long seed) {
return hashInts(arr, offsetInts, lengthInts, seed);
}
-
+
/**
* Hash the given arr starting at the given offset and continuing for the given length using the
* given seed.
@@ -126,7 +134,7 @@ public final class XxHash {
final long lengthLongs, final long seed) {
return hashLongs(arr, offsetLongs, lengthLongs, seed);
}
-
+
/**
* Returns a 64-bit hash from a single long. This method has been optimized for speed when only
* a single hash of a long is required.
@@ -137,7 +145,7 @@ public final class XxHash {
public static long hashLong(final long in, final long seed) {
return hash(in, seed);
}
-
+
/**
* Hash the given arr starting at the given offset and continuing for the given length using the
* given seed.
@@ -151,7 +159,7 @@ public final class XxHash {
final long lengthFloats, final long seed) {
return hashFloats(arr, offsetFloats, lengthFloats, seed);
}
-
+
/**
* Hash the given arr starting at the given offset and continuing for the given length using the
* given seed.
@@ -165,7 +173,7 @@ public final class XxHash {
final long lengthDoubles, final long seed) {
return hashDoubles(arr, offsetDoubles, lengthDoubles, seed);
}
-
+
/**
* Hash the given arr starting at the given offset and continuing for the given length using the
* given seed.
@@ -179,6 +187,6 @@ public final class XxHash {
final long lengthChars, final long seed) {
return org.apache.datasketches.memory.internal.XxHash64.hashString(str, offsetChars, lengthChars, seed);
}
-
+
}
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/AllocateDirect.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/AllocateDirect.java
index a1315f3..ae649ef 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/AllocateDirect.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/AllocateDirect.java
@@ -127,7 +127,7 @@ final class AllocateDirect {
BaseStateImpl.currentDirectMemoryAllocations_.decrementAndGet();
BaseStateImpl.currentDirectMemoryAllocated_.addAndGet(-capacity);
return true;
- }
+ }
return false;
}
}
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/AllocateDirectMap.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/AllocateDirectMap.java
index 90a5126..d8356c9 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/AllocateDirectMap.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/AllocateDirectMap.java
@@ -76,7 +76,7 @@ class AllocateDirectMap implements Map {
.getDeclaredMethod("unmap0", long.class, long.class); //OK through jDK16
FILE_CHANNEL_IMPL_UNMAP0_METHOD.setAccessible(true);
-
+
//The MappedByteBuffer methods load0, isLoaded0 and force0 are removed in 15
MAPPED_BYTE_BUFFER_LOAD0_METHOD = MappedByteBuffer.class
.getDeclaredMethod("load0", long.class, long.class); //JDK15 removed
@@ -122,7 +122,7 @@ class AllocateDirectMap implements Map {
}
//Map Interface
-
+
@Override
public void load() {
madvise();
@@ -152,7 +152,7 @@ class AllocateDirectMap implements Map {
}
}
// End Map Interface
-
+
@Override
public void close() {
doClose("AllocateDirectMap");
@@ -166,7 +166,7 @@ class AllocateDirectMap implements Map {
// because the valid state is already changed.
cleaner.clean();
return true;
- }
+ }
return false;
} catch (final Exception e) {
throw new MemoryCloseException(resource);
@@ -295,7 +295,7 @@ class AllocateDirectMap implements Map {
BaseStateImpl.currentDirectMemoryMapAllocated_.addAndGet(-myCapacity);
}
return true;
- }
+ }
return false;
}
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/AllocateDirectWritableMap.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/AllocateDirectWritableMap.java
index ce6a413..1cb93e1 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/AllocateDirectWritableMap.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/AllocateDirectWritableMap.java
@@ -42,7 +42,7 @@ final class AllocateDirectWritableMap extends AllocateDirectMap implements Writa
}
//Added by WritableMap Interface
-
+
@Override
public void force() {
if (resourceReadOnly) {
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseWritableMemoryImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseWritableMemoryImpl.java
index 5464382..f40192d 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseWritableMemoryImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseWritableMemoryImpl.java
@@ -89,7 +89,7 @@ abstract class BaseWritableMemoryImpl extends WritableMemoryImpl {
}
static BaseWritableMemoryImpl wrapByteBuffer(
- final ByteBuffer byteBuf, final boolean localReadOnly, final ByteOrder byteOrder,
+ final ByteBuffer byteBuf, final boolean localReadOnly, final ByteOrder byteOrder,
final MemoryRequestServer memReqSvr) {
final AccessByteBuffer abb = new AccessByteBuffer(byteBuf);
if (abb.resourceReadOnly && !localReadOnly) {
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/DirectWritableMemoryImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/DirectWritableMemoryImpl.java
index 9fbb834..c79f896 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/DirectWritableMemoryImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/DirectWritableMemoryImpl.java
@@ -95,5 +95,5 @@ final class DirectWritableMemoryImpl extends NativeWritableMemoryImpl {
public boolean isValid() {
return valid.get();
}
-
+
}
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/HeapNonNativeWritableBufferImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/HeapNonNativeWritableBufferImpl.java
index 2e81c3f..efddbe0 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/HeapNonNativeWritableBufferImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/HeapNonNativeWritableBufferImpl.java
@@ -74,7 +74,7 @@ final class HeapNonNativeWritableBufferImpl extends NonNativeWritableBufferImpl
public MemoryRequestServer getMemoryRequestServer() {
return null;
}
-
+
@Override
int getTypeId() {
return typeId & 0xff;
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/HeapNonNativeWritableMemoryImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/HeapNonNativeWritableMemoryImpl.java
index fad9d89..769f9fd 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/HeapNonNativeWritableMemoryImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/HeapNonNativeWritableMemoryImpl.java
@@ -73,7 +73,7 @@ final class HeapNonNativeWritableMemoryImpl extends NonNativeWritableMemoryImpl
public MemoryRequestServer getMemoryRequestServer() {
return null;
}
-
+
@Override
int getTypeId() {
return typeId & 0xff;
@@ -83,5 +83,5 @@ final class HeapNonNativeWritableMemoryImpl extends NonNativeWritableMemoryImpl
Object getUnsafeObject() {
return unsafeObj;
}
-
+
}
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/HeapWritableBufferImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/HeapWritableBufferImpl.java
index 641b4c4..3085868 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/HeapWritableBufferImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/HeapWritableBufferImpl.java
@@ -74,7 +74,7 @@ final class HeapWritableBufferImpl extends NativeWritableBufferImpl {
public MemoryRequestServer getMemoryRequestServer() {
return null;
}
-
+
@Override
int getTypeId() {
return typeId & 0xff;
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/HeapWritableMemoryImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/HeapWritableMemoryImpl.java
index 806cc16..0e7fa93 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/HeapWritableMemoryImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/HeapWritableMemoryImpl.java
@@ -73,7 +73,7 @@ final class HeapWritableMemoryImpl extends NativeWritableMemoryImpl {
public MemoryRequestServer getMemoryRequestServer() {
return null;
}
-
+
@Override
int getTypeId() {
return typeId & 0xff;
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/Ints.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/Ints.java
index 4a80336..4d17365 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/Ints.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/Ints.java
@@ -28,7 +28,7 @@ public final class Ints {
final int result = (int) v;
if (result != v) {
throw new IllegalArgumentException("Out of range: " + v);
- }
+ }
return result;
}
}
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/MapNonNativeWritableBufferImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/MapNonNativeWritableBufferImpl.java
index f0302b9..9140928 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/MapNonNativeWritableBufferImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/MapNonNativeWritableBufferImpl.java
@@ -77,7 +77,7 @@ final class MapNonNativeWritableBufferImpl extends NonNativeWritableBufferImpl {
public MemoryRequestServer getMemoryRequestServer() {
return null;
}
-
+
@Override
long getNativeBaseOffset() {
return nativeBaseOffset;
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/MapNonNativeWritableMemoryImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/MapNonNativeWritableMemoryImpl.java
index 25f002b..d972659 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/MapNonNativeWritableMemoryImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/MapNonNativeWritableMemoryImpl.java
@@ -76,7 +76,7 @@ final class MapNonNativeWritableMemoryImpl extends NonNativeWritableMemoryImpl {
public MemoryRequestServer getMemoryRequestServer() {
return null;
}
-
+
@Override
long getNativeBaseOffset() {
return nativeBaseOffset;
@@ -91,5 +91,5 @@ final class MapNonNativeWritableMemoryImpl extends NonNativeWritableMemoryImpl {
public boolean isValid() {
return valid.get();
}
-
+
}
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/MapWritableBufferImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/MapWritableBufferImpl.java
index 4174518..ecbb28c 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/MapWritableBufferImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/MapWritableBufferImpl.java
@@ -77,7 +77,7 @@ final class MapWritableBufferImpl extends NativeWritableBufferImpl {
public MemoryRequestServer getMemoryRequestServer() {
return null;
}
-
+
@Override
long getNativeBaseOffset() {
return nativeBaseOffset;
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/MapWritableMemoryImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/MapWritableMemoryImpl.java
index 8ee8a23..15cac79 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/MapWritableMemoryImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/MapWritableMemoryImpl.java
@@ -76,7 +76,7 @@ final class MapWritableMemoryImpl extends NativeWritableMemoryImpl {
public MemoryRequestServer getMemoryRequestServer() {
return null;
}
-
+
@Override
long getNativeBaseOffset() {
return nativeBaseOffset;
@@ -91,5 +91,5 @@ final class MapWritableMemoryImpl extends NativeWritableMemoryImpl {
public boolean isValid() {
return valid.get();
}
-
+
}
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NioBits.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NioBits.java
index c0644d4..62827ac 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NioBits.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NioBits.java
@@ -72,7 +72,7 @@ final class NioBits {
totalCapacityField.setAccessible(true);
nioBitsTotalCapacity = (AtomicLong) (totalCapacityField.get(null));
- } catch (final ClassNotFoundException | NoSuchMethodException | IllegalAccessException
+ } catch (final ClassNotFoundException | NoSuchMethodException | IllegalAccessException
| IllegalArgumentException | SecurityException | NoSuchFieldException e) {
throw new RuntimeException("Could not acquire java.nio.Bits class: " + e.getClass());
}
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/Util.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/Util.java
index 42fae24..8552f6b 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/Util.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/Util.java
@@ -36,7 +36,7 @@ import org.apache.datasketches.memory.Memory;
*/
public final class Util {
public static final String LS = System.getProperty("line.separator");
-
+
//Byte Order related
public static final ByteOrder nativeByteOrder = ByteOrder.nativeOrder();
public static final ByteOrder nonNativeByteOrder = nativeByteOrder == ByteOrder.LITTLE_ENDIAN
@@ -53,11 +53,11 @@ public final class Util {
* <p>A reference to this can be found in java.nio.Bits.</p>
*/
public static final int UNSAFE_COPY_THRESHOLD_BYTES = 1024 * 1024;
-
+
private Util() { }
//Byte Order Related
-
+
/**
* Returns the Native Byte Order
* @return the Native Byte Order
@@ -77,8 +77,8 @@ public final class Util {
}
return Util.nativeByteOrder == byteOrder;
}
-
-
+
+
/**
* Searches a range of the specified array of longs for the specified value using the binary
* search algorithm. The range must be sorted method) prior to making this call.
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/VirtualMachineMemory.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/VirtualMachineMemory.java
index 0bf9b8e..c4497e9 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/VirtualMachineMemory.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/VirtualMachineMemory.java
@@ -56,7 +56,7 @@ public final class VirtualMachineMemory {
/**
* Returns the maximum amount of allocatable direct buffer memory. The
* directMemory variable is initialized during system initialization.
- *
+ *
* @return the maximum amount of allocatable direct buffer memory.
*/
public static long getMaxDBBMemory() {
@@ -65,7 +65,7 @@ public final class VirtualMachineMemory {
/**
* Returns true if the direct buffers should be page aligned.
- *
+ *
* @return flag that determines whether direct buffers should be page aligned.
*/
public static boolean getIsPageAligned() {
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/WritableDirectHandleImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/WritableDirectHandleImpl.java
index f5938d6..76882ca 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/WritableDirectHandleImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/WritableDirectHandleImpl.java
@@ -49,7 +49,7 @@ public final class WritableDirectHandleImpl implements WritableHandle {
public Memory get() {
return wMem;
}
-
+
@Override
public WritableMemory getWritable() {
return wMem;
@@ -62,6 +62,6 @@ public final class WritableDirectHandleImpl implements WritableHandle {
if (direct.doClose()) {
wMem = null;
}
-
+
}
}
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/WritableMapHandleImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/WritableMapHandleImpl.java
index 3a77ca5..6a82a44 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/WritableMapHandleImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/WritableMapHandleImpl.java
@@ -31,7 +31,7 @@ import org.apache.datasketches.memory.WritableMemory;
* @author Roman Leventov
* @author Lee Rhodes
*/
-public final class WritableMapHandleImpl extends MapHandleImpl
+public final class WritableMapHandleImpl extends MapHandleImpl
implements WritableMapHandle {
WritableMapHandleImpl(final AllocateDirectWritableMap dirWmap,
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/XxHash64.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/XxHash64.java
index 8592382..af91e52 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/XxHash64.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/XxHash64.java
@@ -189,7 +189,7 @@ public class XxHash64 {
hash = (Long.rotateLeft(hash, 27) * P1) + P4;
return finalize(hash);
}
-
+
private static long finalize(long hash) {
hash ^= hash >>> 33;
hash *= P2;
@@ -199,8 +199,8 @@ public class XxHash64 {
return hash;
}
-
-
+
+
/**
* Hash the given arr starting at the given offset and continuing for the given length using the
* given seed.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org