public interface Layout
int[] read( Layout index, int[] src) { int[] dest = new int[index.getTotalNelems()]; while (index.hasNext()) { Layout.Chunk chunk = index.next(); System.arraycopy(src, chunk.getSrcElem(), dest, chunk.getDestElem(), chunk.getNelems()); } return dest; } int[] read( Layout index, RandomAccessFile raf) { int[] dest = new int[index.getTotalNelems()]; while (index.hasNext()) { Layout.Chunk chunk = index.next(); raf.seek( chunk.getSrcPos()); raf.readInt(dest, chunk.getDestElem(), chunk.getNelems()); } return dest; } // note src and dest misnamed void write( Layout index, int[] src, RandomAccessFile raf) { while (index.hasNext()) { Layout.Chunk chunk = index.next(); raf.seek ( chunk.getSrcPos()); for (int k=0; k
Modifier and Type | Interface and Description |
---|---|
static interface |
Layout.Chunk
A chunk of data that is contiguous in both the source and destination.
|
Modifier and Type | Method and Description |
---|---|
int |
getElemSize()
Get size of each element in bytes.
|
long |
getTotalNelems()
Get total number of elements in the wanted subset.
|
boolean |
hasNext()
Is there more to do
|
Layout.Chunk |
next()
Get the next chunk
|
long getTotalNelems()
int getElemSize()
boolean hasNext()
Layout.Chunk next()