summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/nio/PointerBuffer.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-07-03 16:06:47 +0200
committerSven Gothel <[email protected]>2014-07-03 16:06:47 +0200
commitdf9ff7f340a5ab4e07efc613f5f264eeae63d4c7 (patch)
tree239ae276b82024b140428e6c0fe5d739fdd686a4 /src/java/com/jogamp/common/nio/PointerBuffer.java
parenteb47aaba63e3b1bf55f274a0f338f1010a017ae4 (diff)
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
Diffstat (limited to 'src/java/com/jogamp/common/nio/PointerBuffer.java')
-rw-r--r--src/java/com/jogamp/common/nio/PointerBuffer.java44
1 files changed, 22 insertions, 22 deletions
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<PointerBuffer> {
}
/** 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<PointerBuffer> {
}
/** 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<PointerBuffer> {
}
/** 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<PointerBuffer> {
* Relative bulk get method. Copy the source values <code> src[position .. capacity] [</code>
* to this buffer and increment the position by <code>capacity-position</code>. */
@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<PointerBuffer> {
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<PointerBuffer> {
/** 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<PointerBuffer> {
* Relative bulk get method. Copy the pointer values <code> [ position .. position+length [</code>
* to the destination array <code> [ dest[offset] .. dest[offset+length] [ </code>
* and increment the position by <code>length</code>. */
- public final PointerBuffer get(long[] dest, int offset, int length) {
+ public final PointerBuffer get(final long[] dest, int offset, int length) {
if (dest.length<offset+length) {
throw new IndexOutOfBoundsException();
}
@@ -188,7 +188,7 @@ public class PointerBuffer extends AbstractBuffer<PointerBuffer> {
/** 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<PointerBuffer> {
/** 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<PointerBuffer> {
/**
* Relative bulk put method. Put the pointer values <code> [ src[offset] .. src[offset+length] [</code>
* at the current position and increment the position by <code>length</code>. */
- public final PointerBuffer put(long[] src, int offset, int length) {
+ public final PointerBuffer put(final long[] src, int offset, int length) {
if (src.length<offset+length) {
throw new IndexOutOfBoundsException();
}
@@ -231,15 +231,15 @@ public class PointerBuffer extends AbstractBuffer<PointerBuffer> {
@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<PointerBuffer> {
/** 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;
}