de.jreality.scene.data
Class DataItem

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList
          extended by de.jreality.scene.data.DataItem
All Implemented Interfaces:
Iterable, Collection, List
Direct Known Subclasses:
DataList

public abstract class DataItem
extends AbstractList

Base class for data items of this package supporting different views to the same data using the same reference but still maintaining the readonly constraint of the source.

Author:
Holger

Constructor Summary
DataItem(Object source, int srcOffset)
           
 
Method Summary
 Object copyTo(StorageModel which, Object target)
          Copy the data into the specified array or into a new one if the target parameter is null.
 Object copyTo(WritableDataList target)
           
abstract  StorageModel getStorageModel()
           
static void printUsage()
          For debugging only: print the usage count of all data items.
 DoubleArray toDoubleArray()
           
 double[] toDoubleArray(double[] target)
          Copy the data into the specified array or into a new one if the target parameter is null.
 double[][] toDoubleArrayArray(double[][] target)
          Copy the data into the specified array or into a new one if the target parameter is null.
 IntArray toIntArray()
           
 int[] toIntArray(int[] target)
          Copy the data into the specified array or into a new one if the target parameter is null.
 IntArrayArray toIntArrayArray()
           
 int[][] toIntArrayArray(int[][] target)
          Copy the data into the specified array or into a new one if the target parameter is null.
 StringArray toStringArray()
           
 String[] toStringArray(String[] target)
           
 StringArrayArray toStringArrayArray()
           
 String[][] toStringArrayArray(String[][] target)
          Copy the data into the specified array or into a new one if the target parameter is null.
 
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, get, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, set, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, size, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, size, toArray, toArray
 

Constructor Detail

DataItem

public DataItem(Object source,
                int srcOffset)
Method Detail

getStorageModel

public abstract StorageModel getStorageModel()

toIntArray

public IntArray toIntArray()

toIntArrayArray

public IntArrayArray toIntArrayArray()

toDoubleArray

public DoubleArray toDoubleArray()

toDoubleArray

public double[] toDoubleArray(double[] target)
Copy the data into the specified array or into a new one if the target parameter is null. Returns the filled array.


toDoubleArrayArray

public double[][] toDoubleArrayArray(double[][] target)
Copy the data into the specified array or into a new one if the target parameter is null. Returns the filled array.


toIntArray

public int[] toIntArray(int[] target)
Copy the data into the specified array or into a new one if the target parameter is null. Returns the filled array.


toIntArrayArray

public int[][] toIntArrayArray(int[][] target)
Copy the data into the specified array or into a new one if the target parameter is null. Returns the filled array.


toStringArray

public StringArray toStringArray()

toStringArrayArray

public StringArrayArray toStringArrayArray()

toStringArray

public String[] toStringArray(String[] target)

toStringArrayArray

public String[][] toStringArrayArray(String[][] target)
Copy the data into the specified array or into a new one if the target parameter is null. Returns the filled array.


copyTo

public Object copyTo(StorageModel which,
                     Object target)
Copy the data into the specified array or into a new one if the target parameter is null. Returns the filled array. The passed in StorageModel specifies the data format of the target. If the format is a multidim. array and the target contains null references, the storage model must specify an entry size as this method will create the required arrays. This method will apply flattening conversions if the target storage model has less dimensions than the underlying model of this list. The toXXXArray() methods are shorthands for commonly used data formats. Note that unlike the List.toArray() method this method will not create a new array if the target is too small.


copyTo

public Object copyTo(WritableDataList target)

printUsage

public static void printUsage()
For debugging only: print the usage count of all data items. Do not use in production code, this method might disappear without further notice.