|
|
|||||||||||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.lmu.ifi.dbs.elki.persistent.OnDiskUpperTriangleMatrix
public class OnDiskUpperTriangleMatrix
Class representing an upper triangle matrix backed by an on-disk array of O((n+1)*n/2) size
Field Summary | |
---|---|
private OnDiskArray |
array
Data storage |
private int |
matrixsize
Size of the matrix |
private static long |
serialVersionUID
Serial number, also used for generating a magic |
private static int |
TRIANGLE_HEADER_SIZE
Size of this class' header |
Constructor Summary | |
---|---|
OnDiskUpperTriangleMatrix(File filename,
int magicseed,
int extraheadersize,
int recordsize,
boolean writable)
Constructor to access an existing array. |
|
OnDiskUpperTriangleMatrix(File filename,
int magicseed,
int extraheadersize,
int recordsize,
int matrixsize)
Constructor to access a new array. |
Method Summary | |
---|---|
private static int |
arraysize(int matrixsize)
Compute the size of the needed backing array from the matrix dimensions. |
void |
close()
Close the matrix file. |
private int |
computeOffset(int x,
int y)
Compute the offset within the file. |
int |
getMatrixSize()
Query the size of the matrix. |
byte[] |
readRecord(int x,
int y)
Get data from the matrix |
void |
resizeMatrix(int newsize)
Resize the matrix to cover newsize x newsize. |
void |
writeRecord(int x,
int y,
byte[] data)
Put data into the matrix |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
private static final int TRIANGLE_HEADER_SIZE
private int matrixsize
private OnDiskArray array
Constructor Detail |
---|
public OnDiskUpperTriangleMatrix(File filename, int magicseed, int extraheadersize, int recordsize, boolean writable) throws IOException
filename
- File namemagicseed
- Magic numberextraheadersize
- Size of extra header datarecordsize
- Record sizewritable
- flag to open writable
IOException
public OnDiskUpperTriangleMatrix(File filename, int magicseed, int extraheadersize, int recordsize, int matrixsize) throws IOException
filename
- File namemagicseed
- Magic numberextraheadersize
- Size of extra header datarecordsize
- Record sizematrixsize
- Size of matrix to store
IOException
Method Detail |
---|
public void resizeMatrix(int newsize) throws IOException
newsize
- New matrix size.
IOException
private static int arraysize(int matrixsize)
matrixsize
- size of the matrix
private int computeOffset(int x, int y)
x
- First coordinatey
- Second coordinate
public byte[] readRecord(int x, int y) throws IOException
x
- First coordinatey
- Second coordinate
IOException
public void writeRecord(int x, int y, byte[] data) throws IOException
x
- First coordinatey
- Second coordinatedata
- Data
IOException
public void close() throws IOException
IOException
public int getMatrixSize()
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |