net.java.dev.joode.util
Class RealPointer

java.lang.Object
  extended by net.java.dev.joode.util.RealPointer

public class RealPointer
extends java.lang.Object

Created originally to ease porting the ODE code. Represents an index to an element of some float data. Used alot by the LCP areas of the code, where a large matrix is broken down into small matrixes for sub methods work with. Creating new instances causes *alot* of garbage, so please switch to using the object pool functionality (aquire & release static instance methods)

Author:
Tom Larkworthy

Field Summary
 Real data
           
 int index
           
static RealPointer tmp
           
 
Constructor Summary
RealPointer(Real data)
          Deprecated.  
RealPointer(Real data, int index)
          Deprecated.  
RealPointer(RealPointer base, int add)
          Deprecated.  
 
Method Summary
 RealPointer add(int n)
          Deprecated. use the passback version wherever possible
 RealPointer add(int n, RealPointer result)
          adds to this pointer producing a new pointer in C float * ptr; float * ptr2 = ptr1 + 10; <-- creates new pointer, old pointer is preserved Garabageless
static RealPointer aquireInstance(Real data)
          returns an initialized RealPointer that points to the argument.
static RealPointer aquireInstance(Real data, int index)
           
static RealPointer aquireInstance(RealPointer base, int add)
          creates a new RealPointer that points to the same data black, but with an incremented index in C:- float * ptr a = ...; float * ptr b = a + rowskip;
 java.lang.Object clone()
           
 void copy(RealPointer b, int n)
           
 Real getData()
           
 int getIndex()
           
 float getValue()
          returns the value of the cell that the index points to
 float getValue(int offset)
           
static void releaseInstance(RealPointer instance)
          returns an object back to the instance pool, so it can be aquired by aquire instance methods
 RealPointer set(RealPointer a)
          sets this to be a copy of the passed in parameter (and returns this) an alternative to garbage creating cloning
 void setData(Real data)
           
 void setIndex(int index)
           
 void setValue(float val)
           
 void setValue(int offset, float val)
           
 void setZero(int n)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

tmp

public static RealPointer tmp

data

public Real data

index

public int index
Constructor Detail

RealPointer

public RealPointer(Real data)
Deprecated. 

creates a new RealPointer. Use aquireInstance instead, which defers to an instance pool.

Parameters:
data -

RealPointer

public RealPointer(Real data,
                   int index)
Deprecated. 

creates a new RealPointer. Use aquireInstance instead, which defers to an instance pool.

Parameters:
data -

RealPointer

public RealPointer(RealPointer base,
                   int add)
Deprecated. 

creates a new RealPointer. Use aquireInstance instead, which defers to an instance pool.

Method Detail

aquireInstance

public static RealPointer aquireInstance(Real data)
returns an initialized RealPointer that points to the argument. (The index of the pointer is initialized to zero). Please release the instance when the user code no longer requires the object.

Parameters:
data -
Returns:

aquireInstance

public static RealPointer aquireInstance(Real data,
                                         int index)

releaseInstance

public static void releaseInstance(RealPointer instance)
returns an object back to the instance pool, so it can be aquired by aquire instance methods


aquireInstance

public static RealPointer aquireInstance(RealPointer base,
                                         int add)
creates a new RealPointer that points to the same data black, but with an incremented index in C:- float * ptr a = ...; float * ptr b = a + rowskip;

Parameters:
base -
add -
Returns:

getData

public Real getData()
Returns:
Returns the data block.

setData

public void setData(Real data)
Parameters:
data - The data to set.

getIndex

public int getIndex()
Returns:
Returns the index.

setIndex

public void setIndex(int index)
Parameters:
index - The index to set.

getValue

public float getValue()
returns the value of the cell that the index points to

Returns:

getValue

public float getValue(int offset)

setValue

public void setValue(float val)

setValue

public void setValue(int offset,
                     float val)

add

public RealPointer add(int n)
Deprecated. use the passback version wherever possible

adds to this pointer producing a new pointer in C float * ptr; float * ptr2 = ptr1 + 10; <-- creates new pointer, old pointer is preserved WE HAVE REALLY BAD GRABAGE PRODUCED BY THIS METHOD

Parameters:
n -

add

public RealPointer add(int n,
                       RealPointer result)
adds to this pointer producing a new pointer in C float * ptr; float * ptr2 = ptr1 + 10; <-- creates new pointer, old pointer is preserved Garabageless

Parameters:
n -
result -

setZero

public void setZero(int n)
Parameters:
n -

copy

public void copy(RealPointer b,
                 int n)
Parameters:
b -
n -

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

set

public RealPointer set(RealPointer a)
sets this to be a copy of the passed in parameter (and returns this) an alternative to garbage creating cloning

Parameters:
a -
Returns: