de.jreality.scene.data
Class DataList

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList
          extended by de.jreality.scene.data.DataItem
              extended by de.jreality.scene.data.DataList
All Implemented Interfaces:
Serializable, Iterable, Collection, List
Direct Known Subclasses:
ByteBufferList, DoubleArray, DoubleArrayArray, IntArray, IntArrayArray, StringArray, StringArrayArray, WritableDataList

public class DataList
extends DataItem
implements Serializable

A data list using a storage model for the data. This list is readonly. There are several methods allowing to open another view to the same list using a different storage model or using an explicitly declared storage model for higher performance. These methods might return the same instance using a more specific declared type if the storage model matches that type. They might convert the data into a different but compatible storage model. And they throw a UnsupportedOperationException for incompatible models.
The subclasses with explicit storage models can be used to create effectively immutable arrays. The point about these wrapped arrays is that a good JIT compiler optimizes access to these to be not slower than for direct array access but writing is still reserved to the creator.

Author:
Holger
See Also:
List, StorageModel, #Item, Serialized Form

Method Summary
 Object get(int index)
           
 StorageModel getStorageModel()
           
 DataItem item(int index)
           
 DataList readOnlyList()
          Return a read only view to this list.
 int size()
           
 DoubleArray toDoubleArray()
           
 DoubleArrayArray toDoubleArrayArray()
           
 IntArray toIntArray()
           
 IntArrayArray toIntArrayArray()
           
 String toString()
           
 
Methods inherited from class de.jreality.scene.data.DataItem
copyTo, copyTo, printUsage, toDoubleArray, toDoubleArrayArray, toIntArray, toIntArrayArray, toStringArray, toStringArray, toStringArrayArray, toStringArrayArray
 
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, set, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 
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, toArray, toArray
 

Method Detail

getStorageModel

public StorageModel getStorageModel()
Specified by:
getStorageModel in class DataItem

get

public Object get(int index)
Specified by:
get in interface List
Specified by:
get in class AbstractList

item

public DataItem item(int index)

size

public int size()
Specified by:
size in interface Collection
Specified by:
size in interface List
Specified by:
size in class AbstractCollection

toIntArray

public IntArray toIntArray()
Overrides:
toIntArray in class DataItem

toIntArrayArray

public IntArrayArray toIntArrayArray()
Overrides:
toIntArrayArray in class DataItem

toDoubleArray

public DoubleArray toDoubleArray()
Overrides:
toDoubleArray in class DataItem

toDoubleArrayArray

public DoubleArrayArray toDoubleArrayArray()

readOnlyList

public DataList readOnlyList()
Return a read only view to this list. This will return this for DataList classes that do not provide any method with modifying side effects. Writeable instances will create a read only view using the same underlying data reference thus changes to the writable list will propagate immediately to these views. The views might be cached and reused.

Returns:

toString

public String toString()
Overrides:
toString in class AbstractCollection