Package org.vast.data
Class DataArrayImpl
- All Implemented Interfaces:
Serializable
,HasCopy
,AbstractSWE
,AbstractSWEIdentifiable
,BlockComponent
,DataArray
,DataComponent
- Direct Known Subclasses:
MatrixImpl
Array of identical components. Can be of variable size. In the case of a variable size array, size is actually given by another component: sizeComponent which should be a Count. There are two cases of variable size component: - The component is explicitely listed in the component tree (in this case, the count component has a parent) - The component is implicitely given before the array data (in this case, the count component has no parent) 08-2014: Updated to implement new API autogenerated from XML schema
- See Also:
-
Field Summary
FieldsFields inherited from class org.vast.data.AbstractArrayImpl
elementCount, elementType, ELT_COUNT_NAME, encoding, implicitElementCount, values
Fields inherited from class org.vast.data.AbstractDataComponentImpl
dataBlock, definition, encodingInfo, INDENT, MAX_ARRAY_ERRORS, optional, parent, scalarCount, updatable
Fields inherited from class org.vast.data.AbstractSWEIdentifiableImpl
description, identifier, label
Fields inherited from class org.vast.data.AbstractSWEImpl
extensionList, id
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(DataComponentVisitor visitor) protected void
checkIndex
(int index) Check that the integer index given is in range: 0 to size of array - 1void
Clear the datablock used by this component.copy()
Return a structural copy of this component The copy is done recursively, but only the structure is copied (not the data)protected void
copyTo
(DataArrayImpl other) Create the right data block to carry this array data It can be either a scalar array (DataBlockDouble, etc...) or a group of mixed types parallel arrays (DataBlockMixed)getComponent
(int index) Get the sub-component located at the specified indexgetComponent
(String name) Get the sub-component registered with the specified nameint
Returns number of sub-components in this componentint
getComponentIndex
(String name) Get the index of the sub-component registered with this nameprotected void
resizeDataBlock
(int oldArraySize, int newArraySize) Do everything that is necessary to properly resize data blockvoid
Assign a new datablock to this component.void
setFixedSize
(int newSize) Set the size of this array to a new FIXED valueReturns String representation of this DataContainerprotected void
updateAtomCount
(int childAtomCountDiff) Update this component's datablock atomCount (for resizable array support).void
Dynamically update size of a VARIABLE SIZE array Note that elementCount component must carry the right value at this timevoid
updateSize
(int newSize) Set the size of this VARIABLE SIZE array to a new value Automatically updates the sizeData component value.protected void
updateSizeComponent
(int newSize) Simply update value in size data component w/o resizing datablockprotected void
updateStartIndex
(int startIndex) Update datablock start index (for array support) Needed when data is selected by DataArray getComponent(int) and the DataArray is using a parallel or primitive DataBlockvoid
validateData
(List<ValidationException> errorList) Validates datablock against constraints if any.Methods inherited from class org.vast.data.AbstractArrayImpl
addComponent, copyTo, getArraySizeComponent, getElementCount, getElementCountProperty, getElementType, getElementTypeProperty, getEncoding, getValues, hasConstraints, isImplicitSize, isSetEncoding, isSetValues, isVariableSize, removeComponent, removeComponent, setElementCount, setElementType, setEncoding, setValues, setVariableSizeComponent
Methods inherited from class org.vast.data.AbstractDataComponentImpl
assignNewDataBlock, clone, copyTo, getData, getDefinition, getEncodingInfo, getName, getOptional, getParent, getUpdatable, hasData, isSetDefinition, isSetOptional, isSetUpdatable, renewDataBlock, setDefinition, setEncodingInfo, setName, setOptional, setParent, setUpdatable, toString, unSetOptional, unSetUpdatable
Methods inherited from class org.vast.data.AbstractSWEIdentifiableImpl
copyTo, getDescription, getIdentifier, getLabel, isSetDescription, isSetIdentifier, isSetLabel, setDescription, setIdentifier, setLabel
Methods inherited from class org.vast.data.AbstractSWEImpl
addExtension, copyTo, getExtensionList, getId, getNumExtensions, isSetId, setId
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.opengis.swe.v20.AbstractSWE
addExtension, getExtensionList, getId, getNumExtensions, isSetId, setId
Methods inherited from interface net.opengis.swe.v20.AbstractSWEIdentifiable
getDescription, getIdentifier, getLabel, isSetDescription, isSetIdentifier, isSetLabel, setDescription, setIdentifier, setLabel
Methods inherited from interface net.opengis.swe.v20.DataComponent
assignNewDataBlock, clone, getData, getDefinition, getName, getOptional, getParent, getUpdatable, hasData, isSetDefinition, isSetOptional, isSetUpdatable, renewDataBlock, setDefinition, setName, setOptional, setUpdatable, unSetOptional, unSetUpdatable
-
Field Details
-
MIXED_BLOCK_ERROR_MSG
- See Also:
-
ARRAY_SIZE_FIELD
- See Also:
-
currentSize
protected int currentSize
-
-
Constructor Details
-
DataArrayImpl
public DataArrayImpl()Default constructor. The array will be variable size with implicit size until either setSize() is called or the elementType property is set to reference the ID of another component in the tree. -
DataArrayImpl
public DataArrayImpl(int arraySize)
-
-
Method Details
-
copy
Description copied from interface:DataComponent
Return a structural copy of this component The copy is done recursively, but only the structure is copied (not the data)- Specified by:
copy
in interfaceDataArray
- Specified by:
copy
in interfaceDataComponent
- Specified by:
copy
in interfaceHasCopy
- Specified by:
copy
in classAbstractArrayImpl
- Returns:
- copy of this component, including sub-components
-
copyTo
-
updateStartIndex
protected void updateStartIndex(int startIndex) Description copied from class:AbstractDataComponentImpl
Update datablock start index (for array support) Needed when data is selected by DataArray getComponent(int) and the DataArray is using a parallel or primitive DataBlock- Specified by:
updateStartIndex
in classAbstractDataComponentImpl
-
updateAtomCount
protected void updateAtomCount(int childAtomCountDiff) Description copied from class:AbstractDataComponentImpl
Update this component's datablock atomCount (for resizable array support). This is called by child components to notify parents that a variable size DataArray has been resized- Specified by:
updateAtomCount
in classAbstractDataComponentImpl
-
getComponent
Description copied from interface:DataComponent
Get the sub-component located at the specified index- Specified by:
getComponent
in interfaceDataComponent
- Specified by:
getComponent
in classAbstractDataComponentImpl
- Parameters:
index
- index of component to lookup- Returns:
- child component or null if none exists at the specified index
-
getComponent
Description copied from interface:DataComponent
Get the sub-component registered with the specified name- Specified by:
getComponent
in interfaceDataComponent
- Specified by:
getComponent
in classAbstractDataComponentImpl
- Parameters:
name
- name of component to lookup- Returns:
- child component or null if none exists with the specified name
-
setData
Description copied from interface:DataComponent
Assign a new datablock to this component. This will recursively assign the right datablocks to sub-components recursively.- Specified by:
setData
in interfaceDataComponent
- Specified by:
setData
in classAbstractDataComponentImpl
-
clearData
public void clearData()Description copied from interface:DataComponent
Clear the datablock used by this component. This will also clear data from all the sub-components recursively.- Specified by:
clearData
in interfaceDataComponent
- Specified by:
clearData
in classAbstractDataComponentImpl
-
validateData
Description copied from interface:DataComponent
Validates datablock against constraints if any. No exceptions are thrown, rather they are appended to the provided list.- Specified by:
validateData
in interfaceDataComponent
- Specified by:
validateData
in classAbstractDataComponentImpl
- Parameters:
errorList
- list to which validation exceptions will be appended
-
createDataBlock
Create the right data block to carry this array data It can be either a scalar array (DataBlockDouble, etc...) or a group of mixed types parallel arrays (DataBlockMixed)- Specified by:
createDataBlock
in interfaceDataComponent
- Specified by:
createDataBlock
in classAbstractDataComponentImpl
- Returns:
- new datablock object
-
checkIndex
protected void checkIndex(int index) Check that the integer index given is in range: 0 to size of array - 1- Parameters:
index
- int- Throws:
IndexOutOfBoundsException
-
resizeDataBlock
protected void resizeDataBlock(int oldArraySize, int newArraySize) Do everything that is necessary to properly resize data block- Parameters:
oldArraySize
-newArraySize
-
-
updateSize
public void updateSize()Dynamically update size of a VARIABLE SIZE array Note that elementCount component must carry the right value at this time -
updateSize
public void updateSize(int newSize) Set the size of this VARIABLE SIZE array to a new value Automatically updates the sizeData component value.- Parameters:
newSize
-
-
setFixedSize
public void setFixedSize(int newSize) Set the size of this array to a new FIXED value- Parameters:
newSize
-
-
updateSizeComponent
protected void updateSizeComponent(int newSize) Simply update value in size data component w/o resizing datablock- Parameters:
newSize
-
-
getComponentCount
public int getComponentCount()Description copied from interface:DataComponent
Returns number of sub-components in this component- Specified by:
getComponentCount
in interfaceDataComponent
- Specified by:
getComponentCount
in classAbstractDataComponentImpl
- Returns:
- number of direct sub-components
-
getComponentIndex
Description copied from interface:DataComponent
Get the index of the sub-component registered with this name- Specified by:
getComponentIndex
in interfaceDataComponent
- Specified by:
getComponentIndex
in classAbstractDataComponentImpl
- Parameters:
name
- name of component to lookup- Returns:
- index of child component or -1 if none exists with the specified name
-
toString
Description copied from class:AbstractDataComponentImpl
Returns String representation of this DataContainer- Specified by:
toString
in classAbstractDataComponentImpl
- Parameters:
indent
- int- Returns:
- String
-
accept
-