com.jogamp.opengl.impl
Class MemoryObject

java.lang.Object
  extended by com.jogamp.opengl.impl.MemoryObject

public class MemoryObject
extends Object


Constructor Summary
MemoryObject(long addr, long size)
           
 
Method Summary
 boolean equals(Object obj)
          Ignores the optional attached ByteBuffer intentionally.
 ByteBuffer getBuffer()
           
static int getHash32(long addr, long size)
          Generates a 32bit hash value by addr and size.
Ignores the optional attached ByteBuffer intentionally.
static long getHash64(long addr, long size)
          Generates a 64bit hash value by addr and size.
Ignores the optional attached ByteBuffer intentionally.
static MemoryObject getOrAddSafe(HashMap map, MemoryObject obj0)
          Verifies the hash map operation, ie slow add: if !map.contains(obj0), the values are verified (slow) fast get: if map.contains(obj0), the mapped value is compared with equals (fast) In case the above verification fails, a RuntimeException is thrown.
In such case the calculation of the hash value should either be tuned,
or we just cannot use hash mapping.
 int hashCode()
           
 void setBuffer(ByteBuffer buffer)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MemoryObject

public MemoryObject(long addr,
                    long size)
Method Detail

setBuffer

public void setBuffer(ByteBuffer buffer)

getBuffer

public ByteBuffer getBuffer()

hashCode

public int hashCode()
Overrides:
hashCode in class Object
Returns:
the 32bit hash value generated via getHash32(long, long)

equals

public boolean equals(Object obj)
Ignores the optional attached ByteBuffer intentionally.

Overrides:
equals in class Object
Returns:
true of reference is equal or obj is of type MemoryObject and addr and size is equal.

getHash32

public static int getHash32(long addr,
                            long size)
Generates a 32bit hash value by addr and size.
Ignores the optional attached ByteBuffer intentionally.


getHash64

public static long getHash64(long addr,
                             long size)
Generates a 64bit hash value by addr and size.
Ignores the optional attached ByteBuffer intentionally.


toString

public String toString()
Overrides:
toString in class Object

getOrAddSafe

public static MemoryObject getOrAddSafe(HashMap map,
                                        MemoryObject obj0)
Verifies the hash map operation, ie In case the above verification fails, a RuntimeException is thrown.
In such case the calculation of the hash value should either be tuned,
or we just cannot use hash mapping.

Parameters:
map - the identity HashMap mapping MemoryObject to MemoryObject
obj0 - the MemoryObject to get or add in the map
Returns:
either the already mapped one where obj0 != return, or the added obj0 == return.
Throws:
RuntimeException - if hash collision occurs


Copyright 2010 JogAmp Community.