Package org.vast.data

Class DataArrayImpl

All Implemented Interfaces:
Serializable, HasCopy, AbstractSWE, AbstractSWEIdentifiable, BlockComponent, DataArray, DataComponent
Direct Known Subclasses:
MatrixImpl

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

See Also:
  • Field Details

  • 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

      public DataArrayImpl 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 interface DataArray
      Specified by:
      copy in interface DataComponent
      Specified by:
      copy in interface HasCopy
      Specified by:
      copy in class AbstractArrayImpl
      Returns:
      copy of this component, including sub-components
    • copyTo

      protected void copyTo(DataArrayImpl other)
    • 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 class AbstractDataComponentImpl
    • 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 class AbstractDataComponentImpl
    • getComponent

      public AbstractDataComponentImpl getComponent(int index)
      Description copied from interface: DataComponent
      Get the sub-component located at the specified index
      Specified by:
      getComponent in interface DataComponent
      Specified by:
      getComponent in class AbstractDataComponentImpl
      Parameters:
      index - index of component to lookup
      Returns:
      child component or null if none exists at the specified index
    • getComponent

      public AbstractDataComponentImpl getComponent(String name)
      Description copied from interface: DataComponent
      Get the sub-component registered with the specified name
      Specified by:
      getComponent in interface DataComponent
      Specified by:
      getComponent in class AbstractDataComponentImpl
      Parameters:
      name - name of component to lookup
      Returns:
      child component or null if none exists with the specified name
    • setData

      public void setData(DataBlock dataBlock)
      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 interface DataComponent
      Specified by:
      setData in class AbstractDataComponentImpl
    • 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 interface DataComponent
      Specified by:
      clearData in class AbstractDataComponentImpl
    • validateData

      public void validateData(List<ValidationException> errorList)
      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 interface DataComponent
      Specified by:
      validateData in class AbstractDataComponentImpl
      Parameters:
      errorList - list to which validation exceptions will be appended
    • createDataBlock

      public 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)
      Specified by:
      createDataBlock in interface DataComponent
      Specified by:
      createDataBlock in class AbstractDataComponentImpl
      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 interface DataComponent
      Specified by:
      getComponentCount in class AbstractDataComponentImpl
      Returns:
      number of direct sub-components
    • getComponentIndex

      public int getComponentIndex(String name)
      Description copied from interface: DataComponent
      Get the index of the sub-component registered with this name
      Specified by:
      getComponentIndex in interface DataComponent
      Specified by:
      getComponentIndex in class AbstractDataComponentImpl
      Parameters:
      name - name of component to lookup
      Returns:
      index of child component or -1 if none exists with the specified name
    • toString

      public String toString(String indent)
      Description copied from class: AbstractDataComponentImpl
      Returns String representation of this DataContainer
      Specified by:
      toString in class AbstractDataComponentImpl
      Parameters:
      indent - int
      Returns:
      String
    • accept

      public void accept(DataComponentVisitor visitor)