public class DataArrayImpl extends AbstractArrayImpl
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
Modifier and Type | Field and Description |
---|---|
static String |
ARRAY_SIZE_FIELD |
protected int |
currentSize |
protected static String |
errorBlockMixed |
protected CountImpl |
implicitElementCount |
elementCount, elementType, ELT_COUNT_NAME, encoding, values
dataBlock, definition, encodingInfo, INDENT, MAX_ARRAY_ERRORS, optional, parent, scalarCount, updatable
description, identifier, label
extensionList, id
Constructor and Description |
---|
DataArrayImpl()
Default constructor.
|
DataArrayImpl(int arraySize) |
Modifier and Type | Method and Description |
---|---|
void |
accept(DataComponentVisitor visitor) |
protected void |
checkIndex(int index)
Check that the integer index given is in range: 0 to size of array - 1
|
void |
clearData()
Clear the datablock used by this component.
|
DataArrayImpl |
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) |
AbstractDataBlock |
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)
|
CountImpl |
getArraySizeComponent() |
AbstractDataComponentImpl |
getComponent(int index)
Get the sub-component located at the specified index
|
AbstractDataComponentImpl |
getComponent(String name)
Get the sub-component registered with the specified name
|
int |
getComponentCount()
Returns number of sub-components in this component
|
int |
getComponentIndex(String name)
Get the index of the sub-component registered with this name
|
protected void |
resizeDataBlock(int oldArraySize,
int newArraySize)
Do everything that is necessary to properly resize data block
|
void |
setData(DataBlock dataBlock)
Assign a new datablock to this component.
|
void |
setFixedSize(int newSize)
Set the size of this array to a new FIXED value
|
String |
toString(String indent)
Returns String representation of this DataContainer
|
protected void |
updateAtomCount(int childAtomCountDiff)
Update datablock atomCount (for resizable array support)
Needed to update atom count info in all parents of a
DataArray that has been resized!
|
void |
updateSize()
Dynamically update size of a VARIABLE SIZE array
Note that elementCount component must carry the right value at this time
|
void |
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 datablock
|
protected 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 DataBlock
|
void |
validateData(List<ValidationException> errorList)
Validates dataBlock against constraints if any.
|
addComponent, copyTo, getElementCount, getElementCountProperty, getElementType, getElementTypeProperty, getEncoding, getValues, hasConstraints, isImplicitSize, isSetEncoding, isSetValues, isVariableSize, removeComponent, removeComponent, setElementCount, setElementType, setEncoding, setValues, setVariableSizeComponent
assignNewDataBlock, clone, copyTo, getData, getDefinition, getEncodingInfo, getName, getOptional, getParent, getUpdatable, isSetDefinition, isSetOptional, isSetUpdatable, renewDataBlock, setDefinition, setEncodingInfo, setName, setOptional, setParent, setUpdatable, toString, unSetOptional, unSetUpdatable
copyTo, getDescription, getIdentifier, getLabel, isSetDescription, isSetIdentifier, isSetLabel, setDescription, setIdentifier, setLabel
addExtension, copyTo, getExtensionList, getId, getNumExtensions, isSetId, setId
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
assignNewDataBlock, clone, getData, getDefinition, getName, getOptional, getParent, getUpdatable, isSetDefinition, isSetOptional, isSetUpdatable, renewDataBlock, setDefinition, setName, setOptional, setUpdatable, unSetOptional, unSetUpdatable
getDescription, getIdentifier, getLabel, isSetDescription, isSetIdentifier, isSetLabel, setDescription, setIdentifier, setLabel
addExtension, getExtensionList, getId, getNumExtensions, isSetId, setId
protected static final String errorBlockMixed
public static final String ARRAY_SIZE_FIELD
protected int currentSize
protected CountImpl implicitElementCount
public DataArrayImpl()
public DataArrayImpl(int arraySize)
public DataArrayImpl copy()
DataComponent
copy
in interface HasCopy
copy
in interface DataArray
copy
in interface DataComponent
copy
in class AbstractArrayImpl
protected void copyTo(DataArrayImpl other)
protected void updateStartIndex(int startIndex)
AbstractDataComponentImpl
updateStartIndex
in class AbstractDataComponentImpl
protected void updateAtomCount(int childAtomCountDiff)
AbstractDataComponentImpl
updateAtomCount
in class AbstractDataComponentImpl
public AbstractDataComponentImpl getComponent(int index)
DataComponent
getComponent
in interface DataComponent
getComponent
in class AbstractDataComponentImpl
index
- index of component to lookuppublic AbstractDataComponentImpl getComponent(String name)
DataComponent
getComponent
in interface DataComponent
getComponent
in class AbstractDataComponentImpl
name
- name of component to lookuppublic void setData(DataBlock dataBlock)
DataComponent
setData
in interface DataComponent
setData
in class AbstractDataComponentImpl
public void clearData()
DataComponent
clearData
in interface DataComponent
clearData
in class AbstractDataComponentImpl
public void validateData(List<ValidationException> errorList)
DataComponent
validateData
in interface DataComponent
validateData
in class AbstractDataComponentImpl
errorList
- list to which validation exceptions will be appendedpublic AbstractDataBlock createDataBlock()
createDataBlock
in interface DataComponent
createDataBlock
in class AbstractDataComponentImpl
protected void checkIndex(int index)
index
- intDataException
protected void resizeDataBlock(int oldArraySize, int newArraySize)
oldArraySize
- newArraySize
- public void updateSize()
public void updateSize(int newSize)
newSize
- public void setFixedSize(int newSize)
newSize
- protected void updateSizeComponent(int newSize)
newSize
- public int getComponentCount()
DataComponent
getComponentCount
in interface DataComponent
getComponentCount
in class AbstractDataComponentImpl
public int getComponentIndex(String name)
DataComponent
getComponentIndex
in interface DataComponent
getComponentIndex
in class AbstractDataComponentImpl
name
- name of component to lookuppublic String toString(String indent)
AbstractDataComponentImpl
toString
in class AbstractDataComponentImpl
indent
- intpublic final CountImpl getArraySizeComponent()
public void accept(DataComponentVisitor visitor)
Copyright © 2016 Sensia Software LLC. All rights reserved.