public abstract class StorageModel extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static StorageModel |
DOUBLE_ARRAY |
static StorageModel |
DOUBLE_ARRAY_ARRAY |
static StorageModel |
DOUBLE2_INLINED |
static StorageModel |
DOUBLE3_ARRAY |
static StorageModel |
DOUBLE3_INLINED |
static StorageModel |
INT_ARRAY |
static StorageModel |
INT_ARRAY_ARRAY |
static StorageModel |
STRING_ARRAY |
static StorageModel |
STRING_ARRAY_ARRAY |
Modifier and Type | Method and Description |
---|---|
StorageModel |
array()
Like
array(int) but without specifying an entry size. |
StorageModel |
array(int numPerEntry)
Create a storage model that adds an additional dimension
to an array specifying a constant length for each entry.
|
void |
checkFormat(Object newData) |
DataList |
createReadOnly(Object v)
Like
createReadOnly(Object,int,int) assuming
offset 0 and the entire array length. |
DataList |
createReadOnly(Object v,
int start,
int length)
Create a
data list using this data model. |
WritableDataList |
createWritableDataList(Object v) |
DoubleArray |
getAsDoubleArray(Object data,
int index) |
IntArray |
getAsIntArray(Object data,
int index) |
StringArray |
getAsStringArray(Object data,
int index) |
StorageModel |
getComponentModel() |
int[] |
getDimensions()
Get the dimension of the data.
|
int[] |
getDimensions(DataList from)
Like
getDimensions() but with initialization of the
first entry with the length of the specified list. |
abstract int |
getLength(Object data)
Return the length of a data item in the format of this
storage model.
|
int |
getNumberOfDimensions() |
StorageModel |
inlined(int numPerEntry)
Create a storage model that inlines an additional dimension
in a linear array of length
*numPerEntry . |
boolean |
isArray() |
abstract DataItem |
item(Object data,
int i) |
static StorageModel |
objectType(Class cl) |
static StorageModel |
primitive(Class cl)
Get the single-item storage model for a primitive data
type.
|
DoubleArray |
toDoubleArray(Object data) |
DoubleArrayArray |
toDoubleArrayArray(Object data) |
IntArray |
toIntArray(Object data) |
IntArrayArray |
toIntArrayArray(Object data) |
String |
toString()
Return a string representation of the storage model, e.g.
|
StringArray |
toStringArray(Object data) |
StringArrayArray |
toStringArrayArray(Object data) |
public static final StorageModel INT_ARRAY
public static final StorageModel DOUBLE_ARRAY
public static final StorageModel INT_ARRAY_ARRAY
public static final StorageModel DOUBLE_ARRAY_ARRAY
public static final StorageModel DOUBLE2_INLINED
public static final StorageModel DOUBLE3_INLINED
public static final StorageModel DOUBLE3_ARRAY
public static final StorageModel STRING_ARRAY
public static final StorageModel STRING_ARRAY_ARRAY
public static StorageModel primitive(Class cl)
type.class
e.g. int.class
or referring to the static
constants of their counterpart reference type classes,
e.g. Integer.TYPE
.cl
- the primitive type's class representationpublic static StorageModel objectType(Class cl)
public StorageModel inlined(int numPerEntry)
*numPerEntry
.
Can be applied several times, e.g.
StorageModel.DOUBLE_ARRAY.inline(4).inline(4)
creates
a storage model for a list of 4x4 matrices still stored in
a linear double[]
array. Can also be used
in combination with array(int)
.public StorageModel array(int numPerEntry)
StorageModel.INT_ARRAY.inline(2).inline(3)
creates
a storage model for a list of int[2][3]
entries.
Can also used combined with inlined(int)
.array()
public StorageModel array()
array(int)
but without specifying an entry size.
Implies that entries might have different lengths. The resulting
storage model will return -1 if queried for the general entry
size.public final DataList createReadOnly(Object v)
createReadOnly(Object,int,int)
assuming
offset 0
and the entire array length.public DataList createReadOnly(Object v, int start, int length)
data list
using this data model.
Certain storage models will return specialized data lists,
e.g. DoubleArray
or IntArray
.v
- the object to wrapstart
- start offset inside vlength
- the number of itemspublic WritableDataList createWritableDataList(Object v)
public String toString()
public abstract int getLength(Object data)
public int getNumberOfDimensions()
public int[] getDimensions()
-1
for list/array types as the is the length of the list.getDimensions(DataList)
public int[] getDimensions(DataList from)
getDimensions()
but with initialization of the
first entry with the length of the specified list.public boolean isArray()
public StorageModel getComponentModel()
public DoubleArray getAsDoubleArray(Object data, int index)
public StringArray getAsStringArray(Object data, int index)
public IntArrayArray toIntArrayArray(Object data)
public DoubleArray toDoubleArray(Object data)
public DoubleArrayArray toDoubleArrayArray(Object data)
public StringArray toStringArray(Object data)
public StringArrayArray toStringArrayArray(Object data)
public void checkFormat(Object newData)