Package org.vast.data
Class DataChoiceImpl
java.lang.Object
org.vast.data.AbstractSWEImpl
org.vast.data.AbstractSWEIdentifiableImpl
org.vast.data.AbstractDataComponentImpl
org.vast.data.DataChoiceImpl
- All Implemented Interfaces:
Serializable
,HasCopy
,AbstractSWE
,AbstractSWEIdentifiable
,DataChoice
,DataComponent
- Direct Known Subclasses:
GeometryDataImpl
Exclusive list of DataComponents (Choice) 08-2014: Updated to implement new API autogenerated from XML schema
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Category
protected DataComponentPropertyList<DataComponent>
protected int
protected static int
protected static String
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) void
addComponent
(String name, DataComponent component) Add a sub-component and registers a name for itvoid
addItem
(String name, DataComponent item) Adds a new item propertyprotected void
checkIndex
(int index) Check that the integer index given is in range: 0 to item list sizevoid
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)Create a new datablock for holding data of this componentGets the choiceValue propertygetComponent
(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 nameGets the item property with the given nameGets the list of item propertiesint
Returns number of item propertiesint
Gets the selected item in this choiceboolean
Recursively checks if constraints are specified in this component or any of its sub-componentsboolean
Checks if choiceValue is setremoveComponent
(int index) Remove the sub-component at the specified indexremoveComponent
(String name) Remove sub-component with the specified namevoid
setChoiceValue
(Category choiceValue) Sets the choiceValue propertyvoid
Assign a new datablock to this component.void
setSelectedItem
(int index) Sets the choice selection to the item with the given indexvoid
setSelectedItem
(String name) Sets the choice selection to the item with the given nameReturns String representation of this DataContainervoid
unselect()
protected void
updateAtomCount
(int childAtomCountDiff) Update this component's datablock atomCount (for resizable array support).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 DataBlockvoid
validateData
(List<ValidationException> errorList) Validates datablock against constraints if any.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
-
UNSELECTED
protected static int UNSELECTED -
UNSELECTED_ERROR
-
selected
protected int selected -
choiceValue
-
itemList
-
-
Constructor Details
-
DataChoiceImpl
public DataChoiceImpl() -
DataChoiceImpl
public DataChoiceImpl(int size)
-
-
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 interfaceDataChoice
- Specified by:
copy
in interfaceDataComponent
- Specified by:
copy
in interfaceHasCopy
- Specified by:
copy
in classAbstractDataComponentImpl
- Returns:
- copy of this component, including sub-components
-
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
-
addComponent
Description copied from interface:DataComponent
Add a sub-component and registers a name for it- Specified by:
addComponent
in interfaceDataComponent
- Specified by:
addComponent
in classAbstractDataComponentImpl
- Parameters:
name
- name of component to usecomponent
- new sub-component to append to this component
-
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
-
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
-
removeComponent
Description copied from interface:DataComponent
Remove the sub-component at the specified index- Specified by:
removeComponent
in interfaceDataComponent
- Returns:
- the component that was just removed
-
removeComponent
Description copied from interface:DataComponent
Remove sub-component with the specified name- Specified by:
removeComponent
in interfaceDataComponent
- Returns:
- the component that was just removed
-
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
Description copied from interface:DataComponent
Create a new datablock for holding data of this component- 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 item list size- Parameters:
index
- int- Throws:
IndexOutOfBoundsException
-
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
-
getSelected
public int getSelected() -
getSelectedItem
Description copied from interface:DataChoice
Gets the selected item in this choice- Specified by:
getSelectedItem
in interfaceDataChoice
- Returns:
- the selected component or null if non is selected
-
setSelectedItem
public void setSelectedItem(int index) Description copied from interface:DataChoice
Sets the choice selection to the item with the given index- Specified by:
setSelectedItem
in interfaceDataChoice
-
setSelectedItem
Description copied from interface:DataChoice
Sets the choice selection to the item with the given name- Specified by:
setSelectedItem
in interfaceDataChoice
-
unselect
public void unselect() -
toString
Description copied from class:AbstractDataComponentImpl
Returns String representation of this DataContainer- Specified by:
toString
in classAbstractDataComponentImpl
- Parameters:
indent
- int- Returns:
- String
-
hasConstraints
public boolean hasConstraints()Description copied from interface:DataComponent
Recursively checks if constraints are specified in this component or any of its sub-components- Specified by:
hasConstraints
in interfaceDataComponent
- Specified by:
hasConstraints
in classAbstractDataComponentImpl
- Returns:
- true if at least one constraint is found, false otherwise
-
getChoiceValue
Gets the choiceValue property- Specified by:
getChoiceValue
in interfaceDataChoice
-
isSetChoiceValue
public boolean isSetChoiceValue()Checks if choiceValue is set- Specified by:
isSetChoiceValue
in interfaceDataChoice
-
setChoiceValue
Sets the choiceValue property- Specified by:
setChoiceValue
in interfaceDataChoice
-
getItemList
Gets the list of item properties- Specified by:
getItemList
in interfaceDataChoice
-
getNumItems
public int getNumItems()Returns number of item properties- Specified by:
getNumItems
in interfaceDataChoice
-
getItem
Gets the item property with the given name- Specified by:
getItem
in interfaceDataChoice
-
addItem
Adds a new item property- Specified by:
addItem
in interfaceDataChoice
-
accept
- Specified by:
accept
in interfaceDataComponent
-