summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/nio/PointerBuffer.java
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2011-02-09 22:19:22 +0100
committerMichael Bien <[email protected]>2011-02-09 22:19:22 +0100
commite581ea0e1f65101a7d4baf99d18fa43e1aa20b01 (patch)
treed41b99d3ea1dd68e7054e63778aee5208980409d /src/java/com/jogamp/common/nio/PointerBuffer.java
parente20879b9f124ecca8bc7467013e118d1b7f5782b (diff)
- removed CDC impl for com.jogamp.common.nio
- generified class hierarchy (casts no longer needed in client code) - @Override where needed and other minor changes
Diffstat (limited to 'src/java/com/jogamp/common/nio/PointerBuffer.java')
-rw-r--r--src/java/com/jogamp/common/nio/PointerBuffer.java27
1 files changed, 8 insertions, 19 deletions
diff --git a/src/java/com/jogamp/common/nio/PointerBuffer.java b/src/java/com/jogamp/common/nio/PointerBuffer.java
index f43dc20..5f866e1 100644
--- a/src/java/com/jogamp/common/nio/PointerBuffer.java
+++ b/src/java/com/jogamp/common/nio/PointerBuffer.java
@@ -45,9 +45,9 @@ import java.util.HashMap;
* @author Michael Bien
* @author Sven Gothel
*/
-public abstract class PointerBuffer extends AbstractLongBuffer {
+public abstract class PointerBuffer extends AbstractLongBuffer<PointerBuffer> {
- protected HashMap/*<aptr, buffer>*/ dataMap = new HashMap();
+ protected HashMap<Long, Buffer> dataMap = new HashMap<Long, Buffer>();
static {
NativeLibrary.ensureNativeLibLoaded();
@@ -58,28 +58,15 @@ public abstract class PointerBuffer extends AbstractLongBuffer {
}
public static PointerBuffer allocate(int size) {
- if (Platform.isJavaSE()) {
- return new PointerBufferSE(ByteBuffer.wrap(new byte[elementSize() * size]));
- } else {
- return new PointerBufferME_CDC_FP(ByteBuffer.wrap(new byte[elementSize() * size]));
- }
+ return new PointerBufferSE(ByteBuffer.wrap(new byte[elementSize() * size]));
}
public static PointerBuffer allocateDirect(int size) {
- if (Platform.isJavaSE()) {
- return new PointerBufferSE(Buffers.newDirectByteBuffer(elementSize() * size));
- } else {
- return new PointerBufferME_CDC_FP(Buffers.newDirectByteBuffer(elementSize() * size));
- }
+ return new PointerBufferSE(Buffers.newDirectByteBuffer(elementSize() * size));
}
public static PointerBuffer wrap(ByteBuffer src) {
- PointerBuffer res;
- if (Platform.isJavaSE()) {
- res = new PointerBufferSE(src);
- } else {
- res = new PointerBufferME_CDC_FP(src);
- }
+ PointerBuffer res = new PointerBufferSE(src);
res.updateBackup();
return res;
@@ -89,6 +76,7 @@ public abstract class PointerBuffer extends AbstractLongBuffer {
return Platform.is32Bit() ? Buffers.SIZEOF_INT : Buffers.SIZEOF_LONG;
}
+ @Override
public final PointerBuffer put(PointerBuffer src) {
if (remaining() < src.remaining()) {
throw new IndexOutOfBoundsException();
@@ -140,7 +128,7 @@ public abstract class PointerBuffer extends AbstractLongBuffer {
public final Buffer getReferencedBuffer(int index) {
long addr = get(index);
- return (Buffer) dataMap.get(new Long(addr));
+ return dataMap.get(new Long(addr));
}
public final Buffer getReferencedBuffer() {
@@ -151,6 +139,7 @@ public abstract class PointerBuffer extends AbstractLongBuffer {
private native long getDirectBufferAddressImpl(Object directBuffer);
+ @Override
public String toString() {
return "PointerBuffer:"+super.toString();
}