Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class ncsa.horizon.arrayND.ArrayChunk

java.lang.Object
  |
  +--ncsa.horizon.arrayND.ArrayChunk

public class ArrayChunk
extends java.lang.Object
a representation of a chunk of consecutive values in an array. This is used to access portions of a multidimensional array via 1-D array chuncks.

Here's an example of how one might copy a chunk of data into a 1-D array:

     ArrayChunk chunk;
     Object out;          // the 1-D output array
     ...
     int i, j;
     for(i=chunk.begin(), j=0; i != chunk.end(); i += chunk.stride(), j++) 
        Array.set( out, j, Array.get(chunk.array(), i) );
 


Field Summary
java.lang.Object data
          the reference to a 1-D array containing the chunk of interest
int jump
          the stride necessary to iterate through the chunk of interest
int past
          the position just after the last value in the chunk of interest
int start
          the starting postition within data of the chunk of interest
 
Constructor Summary
ArrayChunk(int strt, int lim, int step, java.lang.Object ary)
          identify a chunk of data within a 1-D array.
ArrayChunk(java.lang.Object ary, int strt, int count)
          identify a chunk of data within a 1-D array.
ArrayChunk(java.lang.Object ary, int strt, int count, int step)
          identify a chunk of data within a 1-D array.
ArrayChunk()
          a no-arg constructor for use by subclasses only
 
Method Summary
int begin()
          return the index to the first value in the chunk
java.lang.Object data()
          return a reference to the 1-D array holding the chunk
int end()
          return the index to the first value in the chunk
int getCount()
          return the number of values in the chunk of interest
int stride()
          return the index to the first value in the chunk
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Field Detail

data

protected java.lang.Object data
the reference to a 1-D array containing the chunk of interest

start

protected int start
the starting postition within data of the chunk of interest

past

protected int past
the position just after the last value in the chunk of interest

jump

protected int jump
the stride necessary to iterate through the chunk of interest
Constructor Detail

ArrayChunk

public ArrayChunk(int strt,
                  int lim,
                  int step,
                  java.lang.Object ary)
           throws java.lang.IllegalArgumentException,
                  java.lang.ArrayIndexOutOfBoundsException
identify a chunk of data within a 1-D array.
Parameters:
strt - the positition of the first value in the chunk of interest
lim - a position just after the last value in the chunk. This value can actually be any value within the range (last, last+stride].
step - the stride necessary to iterate through each value of the chunk.
ary - a 1-D array containing the chunck of interest
Throws:
java.lang.IllegalArgumentException - if ary is not a 1-D array
java.lang.ArrayIndexOutOfBoundsException - if strt or lim are out of the bounds of ary.

ArrayChunk

public ArrayChunk(java.lang.Object ary,
                  int strt,
                  int count)
           throws java.lang.IllegalArgumentException,
                  java.lang.ArrayIndexOutOfBoundsException
identify a chunk of data within a 1-D array. It is assumed the data is arranged consecutively within the array (i.e. stride of one).
Parameters:
ary - a 1-D array containing the chunck of interest
strt - the positition of the first value in the chunk of interest
count - the number of values in the chunk.
Throws:
java.lang.IllegalArgumentException - if ary is not a 1-D array
java.lang.ArrayIndexOutOfBoundsException - if strt or lim are out of the bounds of ary.

ArrayChunk

public ArrayChunk(java.lang.Object ary,
                  int strt,
                  int count,
                  int step)
           throws java.lang.IllegalArgumentException,
                  java.lang.ArrayIndexOutOfBoundsException
identify a chunk of data within a 1-D array. It is assumed the data is arranged consecutively within the array (i.e. stride of one).
Parameters:
ary - a 1-D array containing the chunck of interest
strt - the positition of the first value in the chunk of interest
count - the number of values in the chunk.
step - the stride necessary to iterate through each value of the chunk.
Throws:
java.lang.IllegalArgumentException - if ary is not a 1-D array
java.lang.ArrayIndexOutOfBoundsException - if strt or count are out of the bounds of ary.

ArrayChunk

protected ArrayChunk()
a no-arg constructor for use by subclasses only
Method Detail

begin

public final int begin()
return the index to the first value in the chunk

end

public final int end()
return the index to the first value in the chunk

stride

public final int stride()
return the index to the first value in the chunk

data

public final java.lang.Object data()
return a reference to the 1-D array holding the chunk

getCount

public final int getCount()
return the number of values in the chunk of interest

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD