public class CA3DString
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
private java.lang.String[][][] |
fullMatrix
3D array contains the full matrix
|
private java.lang.String[] |
lineNum
Array of unique numbers for compression
|
private int[] |
lineRep
Array of number of repetitions for compression
|
private static long |
serialVersionUID
serialVersionUID
|
private int |
sizeX
Size of the first index
|
private int |
sizeY
Size of the second index
|
private int |
sizeZ
Size of the third index
|
Constructor and Description |
---|
CA3DString(int sizeX,
int sizeY,
int sizeZ,
java.lang.String defaultValue)
Constructor of compress 3D array
|
Modifier and Type | Method and Description |
---|---|
void |
add(java.lang.String value,
int x,
int y,
int z)
Add a value to a single location in the array
|
void |
add(java.lang.String value,
int fromX,
int fromY,
int fromZ,
int toX,
int toY,
int toZ)
Add a value to a region in the array
|
private void |
compressMatrix()
Prepare compressed data from full matrix to write out
|
void |
deepCopyFrom(CA3DString matrix)
Initialize a compressed matrix by creating a deep copy
|
private void |
expandMatrix()
Expand compressed data to full matrix
|
java.lang.String |
get(int x,
int y,
int z)
Get a single value from the array
|
int |
getSizeX()
Getter for the size of first dimension
|
int |
getSizeY()
Getter for the size of second dimension
|
int |
getSizeZ()
Getter for the size of third dimension
|
private void |
readObject(java.io.ObjectInputStream in)
Read object from input stream
|
void |
set(java.lang.String value,
int x,
int y,
int z)
Set a value to a single location in the array
|
void |
set(java.lang.String value,
int fromX,
int fromY,
int fromZ,
int toX,
int toY,
int toZ)
Set a value to a region in the array
|
private void |
writeObject(java.io.ObjectOutputStream out)
Write object to output stream
|
private static final long serialVersionUID
private int sizeX
private int sizeY
private int sizeZ
private java.lang.String[][][] fullMatrix
private java.lang.String[] lineNum
private int[] lineRep
public CA3DString(int sizeX, int sizeY, int sizeZ, java.lang.String defaultValue)
sizeX
- size of the first indexsizeY
- size of the second indexsizeZ
- size of the third indexdefaultValue
- default value in the arraypublic void set(java.lang.String value, int x, int y, int z)
value
- new valuex
- first indexy
- second indexz
- third indexpublic void set(java.lang.String value, int fromX, int fromY, int fromZ, int toX, int toY, int toZ)
value
- new valuefromX
- from first index (inclusive)fromY
- from second index (inclusive)fromZ
- from third index (inclusive)toX
- to first index (inclusive)toY
- to second index (inclusive)toZ
- to third index (inclusive)public void add(java.lang.String value, int x, int y, int z)
value
- value to be addedx
- first indexy
- second indexz
- third indexpublic void add(java.lang.String value, int fromX, int fromY, int fromZ, int toX, int toY, int toZ)
value
- value to be addedfromX
- from first index (inclusive)fromY
- from second index (inclusive)fromZ
- from third index (inclusive)toX
- to first index (inclusive)toY
- to second index (inclusive)toZ
- to third index (inclusive)public java.lang.String get(int x, int y, int z)
x
- first indexy
- second indexz
- third indexpublic int getSizeX()
public int getSizeY()
public int getSizeZ()
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException
out
- object output streamjava.io.IOException
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
in
- object input streamjava.io.IOException
java.lang.ClassNotFoundException
private void compressMatrix()
private void expandMatrix()
public void deepCopyFrom(CA3DString matrix)
matrix
- matrix to be copied from