|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectucar.multiarray.AbstractAccessor
public abstract class AbstractAccessor
This abstract class provides a skeletal implementation of the Accessor interface.
A minimal concrete implementation
would provide concrete implementations
Object get(int [] index),
Object copyout(int [] origin, int [] shape),
set(int [] index, Object value).
copyin(int [] index, MultiArray value).
Accessor| Constructor Summary | |
|---|---|
AbstractAccessor()
|
|
| Method Summary | |
|---|---|
static void |
copy(Accessor src,
int[] src_limits,
Accessor dst,
int[] dst_pos)
Used to implement copyin. |
void |
copyin(int[] origin,
MultiArray data)
You almost always want to override this |
static void |
copyO(Accessor src,
int[] src_pos,
Accessor dst,
int[] dst_limits)
Used to implement copyout. |
abstract MultiArray |
copyout(int[] origin,
int[] shape)
Aggregate read access. |
abstract java.lang.Object |
get(int[] index)
Get (read) the array element at index. |
boolean |
getBoolean(int[] index)
Get the array element at index, as a boolean. |
byte |
getByte(int[] index)
Get the array element at index, as a byte. |
char |
getChar(int[] index)
Get the array element at index, as a char. |
double |
getDouble(int[] index)
Get the array element at index, as a double. |
float |
getFloat(int[] index)
Get the array element at index, as a float. |
int |
getInt(int[] index)
Get the array element at index, as an int. |
long |
getLong(int[] index)
Get the array element at index, as a long. |
short |
getShort(int[] index)
Get the array element at index, as a short. |
abstract void |
set(int[] index,
java.lang.Object value)
Set (modify, write) the array element at index to the specified value. |
void |
setBoolean(int[] index,
boolean value)
Set the array element at index to the specified boolean value. |
void |
setByte(int[] index,
byte value)
Set the array element at index to the specified byte value. |
void |
setChar(int[] index,
char value)
Set the array element at index to the specified char value. |
void |
setDouble(int[] index,
double value)
Set the array element at index to the specified double value. |
void |
setFloat(int[] index,
float value)
Set the array element at index to the specified float value. |
void |
setInt(int[] index,
int value)
Set the array element at index to the specified int value. |
void |
setLong(int[] index,
long value)
Set the array element at index to the specified long value. |
void |
setShort(int[] index,
short value)
Set the array element at index to the specified short value. |
abstract java.lang.Object |
toArray()
Returns a new array containing all of the elements in this MultiArray. |
abstract java.lang.Object |
toArray(java.lang.Object dst,
int[] origin,
int[] shape)
Returns an array containing elements of this MultiArray specified by origin and shape, possibly converting the component type. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractAccessor()
| Method Detail |
|---|
public static void copy(Accessor src,
int[] src_limits,
Accessor dst,
int[] dst_pos)
throws java.io.IOException
src - the data sourcesrc_limits - limits on the source IndexIterator
typically < ((MultiArray)src).getLengths()dst - the destination, values here are modifieddst_pos - starting position in the data source
java.io.IOException
public static void copyO(Accessor src,
int[] src_pos,
Accessor dst,
int[] dst_limits)
throws java.io.IOException
src - the data sourcesrc_pos - starting position in the data sourcedst - the destination, values here are modifieddst_limits - limits on the source IndexIterator
typically < ((MultiArray)dst).getLengths()
java.io.IOException
public abstract java.lang.Object get(int[] index)
throws java.io.IOException
Accessor
get in interface Accessorindex - MultiArray index
index
java.io.IOException
public boolean getBoolean(int[] index)
throws java.io.IOException
Accessor
getBoolean in interface Accessorjava.io.IOExceptionAccessor.get(int[])
public char getChar(int[] index)
throws java.io.IOException
Accessor
getChar in interface Accessorjava.io.IOExceptionAccessor.get(int[])
public byte getByte(int[] index)
throws java.io.IOException
Accessor
getByte in interface Accessorjava.io.IOExceptionAccessor.get(int[])
public short getShort(int[] index)
throws java.io.IOException
Accessor
getShort in interface Accessorjava.io.IOExceptionAccessor.get(int[])
public int getInt(int[] index)
throws java.io.IOException
Accessor
getInt in interface Accessorjava.io.IOExceptionAccessor.get(int[])
public long getLong(int[] index)
throws java.io.IOException
Accessor
getLong in interface Accessorjava.io.IOExceptionAccessor.get(int[])
public float getFloat(int[] index)
throws java.io.IOException
Accessor
getFloat in interface Accessorjava.io.IOExceptionAccessor.get(int[])
public double getDouble(int[] index)
throws java.io.IOException
Accessor
getDouble in interface Accessorjava.io.IOExceptionAccessor.get(int[])
public abstract void set(int[] index,
java.lang.Object value)
throws java.io.IOException
Accessor
set in interface Accessorindex - MultiArray indexvalue - the new value.
java.io.IOException
public void setBoolean(int[] index,
boolean value)
throws java.io.IOException
Accessor
setBoolean in interface Accessorjava.io.IOExceptionAccessor.set(int[], java.lang.Object)
public void setChar(int[] index,
char value)
throws java.io.IOException
Accessor
setChar in interface Accessorjava.io.IOExceptionAccessor.set(int[], java.lang.Object)
public void setByte(int[] index,
byte value)
throws java.io.IOException
Accessor
setByte in interface Accessorjava.io.IOExceptionAccessor.set(int[], java.lang.Object)
public void setShort(int[] index,
short value)
throws java.io.IOException
Accessor
setShort in interface Accessorjava.io.IOExceptionAccessor.set(int[], java.lang.Object)
public void setInt(int[] index,
int value)
throws java.io.IOException
Accessor
setInt in interface Accessorjava.io.IOExceptionAccessor.set(int[], java.lang.Object)
public void setLong(int[] index,
long value)
throws java.io.IOException
Accessor
setLong in interface Accessorjava.io.IOExceptionAccessor.set(int[], java.lang.Object)
public void setFloat(int[] index,
float value)
throws java.io.IOException
Accessor
setFloat in interface Accessorjava.io.IOExceptionAccessor.set(int[], java.lang.Object)
public void setDouble(int[] index,
double value)
throws java.io.IOException
Accessor
setDouble in interface Accessorjava.io.IOExceptionAccessor.set(int[], java.lang.Object)
public abstract MultiArray copyout(int[] origin,
int[] shape)
throws java.io.IOException
AccessorIt is easier to implement than to specify :-).
The main reason to implement this instead of using the equivalent proxy is for remote or file access.
assert(origin[ii] + shape[ii] <= lengths[ii]);
copyout in interface Accessororigin - int array specifying the starting index.shape - int array specifying the extents in each
dimension. This becomes the shape of the return.
java.io.IOException
public void copyin(int[] origin,
MultiArray data)
throws java.io.IOException
copyin in interface Accessororigin - int array specifying the starting index.data - MultiArray with the same componentType as
this and shape smaller than
this.getLengths() - origin
java.io.IOException
public abstract java.lang.Object toArray()
throws java.io.IOException
AccessorThis method acts as bridge between array-based and MultiArray-based APIs.
This method is functionally equivalent to
Object anArray = Array.newInstance(getComponentType(), 1);
int [] origin = new int[getRank()]
int [] shape = getDimensions();
return toArray(anArray, origin, shape);
toArray in interface Accessorjava.io.IOException
public abstract java.lang.Object toArray(java.lang.Object dst,
int[] origin,
int[] shape)
throws java.io.IOException
AccessorThe anArray argument should be an array. If it is large enough to contain the output, it is used and no new storage is allocated. Otherwise, new storage is allocated with the same component type as the argument, and the data is copied into it.
This method acts as bridge between array-based and MultiArray-based APIs.
This method is similar to copyout(origin, shape).toArray(), but avoids a copy operation and (potentially) an allocation.
NOTE: Implementation of type conversion is deferred until
JDK 1.2. Currently, the componentType of anArray
must be the same as this
toArray in interface Accessorjava.io.IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||