From df9ff7f340a5ab4e07efc613f5f264eeae63d4c7 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 3 Jul 2014 16:06:47 +0200 Subject: Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74) Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74) - Change non static accesses to static members using declaring type - Change indirect accesses to static members to direct accesses (accesses through subtypes) - Add final modifier to private fields - Add final modifier to method parameters - Add final modifier to local variables - Remove unnecessary casts - Remove unnecessary '$NON-NLS$' tags - Remove trailing white spaces on all lines --- src/java/com/jogamp/common/nio/PointerBuffer.java | 44 +++++++++++------------ 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'src/java/com/jogamp/common/nio/PointerBuffer.java') diff --git a/src/java/com/jogamp/common/nio/PointerBuffer.java b/src/java/com/jogamp/common/nio/PointerBuffer.java index 5d470d5..e9138ac 100644 --- a/src/java/com/jogamp/common/nio/PointerBuffer.java +++ b/src/java/com/jogamp/common/nio/PointerBuffer.java @@ -57,17 +57,17 @@ public class PointerBuffer extends AbstractBuffer { } /** no backup array, use for direct usage only */ - static PointerBuffer create(ByteBuffer bb) { + static PointerBuffer create(final ByteBuffer bb) { return Platform.is32Bit() ? new PointerBuffer( bb.asIntBuffer() ) : new PointerBuffer( bb.asLongBuffer() ); } /** supports backup array */ - PointerBuffer(IntBuffer b) { + PointerBuffer(final IntBuffer b) { super(b, ELEMENT_SIZE, b.capacity()); } /** supports backup array */ - PointerBuffer(LongBuffer b) { + PointerBuffer(final LongBuffer b) { super(b, ELEMENT_SIZE, b.capacity()); } @@ -79,7 +79,7 @@ public class PointerBuffer extends AbstractBuffer { } /** Returns a non direct PointerBuffer in native order, having a backup array */ - public static PointerBuffer allocate(int size) { + public static PointerBuffer allocate(final int size) { if (Platform.is32Bit()) { return new PointerBuffer(IntBuffer.wrap(new int[size])); } else { @@ -88,11 +88,11 @@ public class PointerBuffer extends AbstractBuffer { } /** Returns a direct PointerBuffer in native order, w/o backup array */ - public static PointerBuffer allocateDirect(int size) { + public static PointerBuffer allocateDirect(final int size) { return create(Buffers.newDirectByteBuffer(ELEMENT_SIZE * size)); } - public static PointerBuffer wrap(ByteBuffer src) { + public static PointerBuffer wrap(final ByteBuffer src) { return create(src); } @@ -118,7 +118,7 @@ public class PointerBuffer extends AbstractBuffer { * Relative bulk get method. Copy the source values src[position .. capacity] [ * to this buffer and increment the position by capacity-position. */ @Override - public final PointerBuffer put(PointerBuffer src) { + public final PointerBuffer put(final PointerBuffer src) { if (remaining() < src.remaining()) { throw new IndexOutOfBoundsException(); } @@ -132,7 +132,7 @@ public class PointerBuffer extends AbstractBuffer { final long addr = src.get(); put(addr); if( null != src.dataMap) { - Buffer bb = (Buffer) src.dataMap.get(addr); + final Buffer bb = (Buffer) src.dataMap.get(addr); if(null!=bb) { validateDataMap(); dataMap.put(addr, bb); @@ -150,19 +150,19 @@ public class PointerBuffer extends AbstractBuffer { /** Relative get method. Get the pointer value at the current position and increment the position by one. */ @Override public final long get() { - long r = get(position); + final long r = get(position); position++; return r; } /** Absolute get method. Get the pointer value at the given index */ @Override - public final long get(int idx) { + public final long get(final int idx) { if (0 > idx || idx >= capacity) { throw new IndexOutOfBoundsException(); } if (Platform.is32Bit()) { - return (long) ((IntBuffer) buffer).get(idx) & 0x00000000FFFFFFFFL; + return ((IntBuffer) buffer).get(idx) & 0x00000000FFFFFFFFL; } else { return ((LongBuffer) buffer).get(idx); } @@ -172,7 +172,7 @@ public class PointerBuffer extends AbstractBuffer { * Relative bulk get method. Copy the pointer values [ position .. position+length [ * to the destination array [ dest[offset] .. dest[offset+length] [ * and increment the position by length. */ - public final PointerBuffer get(long[] dest, int offset, int length) { + public final PointerBuffer get(final long[] dest, int offset, int length) { if (dest.length { /** Absolute put method. Put the pointer value at the given index */ @Override - public final PointerBuffer put(int idx, long v) { + public final PointerBuffer put(final int idx, final long v) { if (0 > idx || idx >= capacity) { throw new IndexOutOfBoundsException(); } @@ -202,7 +202,7 @@ public class PointerBuffer extends AbstractBuffer { /** Relative put method. Put the pointer value at the current position and increment the position by one. */ @Override - public final PointerBuffer put(long value) { + public final PointerBuffer put(final long value) { put(position, value); position++; return this; @@ -211,7 +211,7 @@ public class PointerBuffer extends AbstractBuffer { /** * Relative bulk put method. Put the pointer values [ src[offset] .. src[offset+length] [ * at the current position and increment the position by length. */ - public final PointerBuffer put(long[] src, int offset, int length) { + public final PointerBuffer put(final long[] src, int offset, int length) { if (src.length { @throws IllegalArgumentException if bb is null or not a direct buffer */ - public final PointerBuffer referenceBuffer(int index, Buffer bb) { + public final PointerBuffer referenceBuffer(final int index, final Buffer bb) { if(null==bb) { throw new IllegalArgumentException("Buffer is null"); } if(!Buffers.isDirect(bb)) { throw new IllegalArgumentException("Buffer is not direct"); } - long mask = Platform.is32Bit() ? 0x00000000FFFFFFFFL : 0xFFFFFFFFFFFFFFFFL ; - long bbAddr = getDirectBufferAddressImpl(bb) & mask; + final long mask = Platform.is32Bit() ? 0x00000000FFFFFFFFL : 0xFFFFFFFFFFFFFFFFL ; + final long bbAddr = getDirectBufferAddressImpl(bb) & mask; if(0==bbAddr) { throw new RuntimeException("Couldn't determine native address of given Buffer: "+bb); } @@ -252,22 +252,22 @@ public class PointerBuffer extends AbstractBuffer { /** Put the address of the given direct Buffer at the end of this pointer array. Adding a reference of the given direct Buffer to this object. */ - public final PointerBuffer referenceBuffer(Buffer bb) { + public final PointerBuffer referenceBuffer(final Buffer bb) { referenceBuffer(position, bb); position++; return this; } - public final Buffer getReferencedBuffer(int index) { + public final Buffer getReferencedBuffer(final int index) { if(null != dataMap) { - long addr = get(index); + final long addr = get(index); return (Buffer) dataMap.get(addr); } return null; } public final Buffer getReferencedBuffer() { - Buffer bb = getReferencedBuffer(position); + final Buffer bb = getReferencedBuffer(position); position++; return bb; } -- cgit v1.2.3