Class DataNode

All Implemented Interfaces:
Extensible
Direct Known Subclasses:
MetadataAttribute, RasterDataNode

public abstract class DataNode extends ProductNode
A DataNode is the base class for all nodes within a data product which carry data. The data is represented by an instance of ProductData.
  • Field Details

  • Constructor Details

    • DataNode

      public DataNode(String name, int dataType, long numElems)
      Constructs a new data node with the given name, data type and number of elements.
    • DataNode

      public DataNode(String name, ProductData data, boolean readOnly)
  • Method Details

    • getDataType

      public int getDataType()
      Gets the data type of this data node.
      Returns:
      the data type which is always one of the multiple ProductData.TYPE_X constants
    • isFloatingPointType

      public boolean isFloatingPointType()
      Tests whether the data type of this node is a floating point type.
      Returns:
      true, if so
    • getNumDataElems

      public long getNumDataElems()
      Gets the number of data elements in this data node.
    • setData

      public void setData(ProductData data)
      Sets the data of this data node.
    • getData

      public ProductData getData()
      Gets the data of this data node.
    • setDataElems

      public void setDataElems(Object elems)
      Sets the data elements of this data node.
      See Also:
    • getDataElems

      public Object getDataElems()
      Gets the data elements of this data node.
      See Also:
    • getDataElemSize

      public int getDataElemSize()
      Gets the data element size in bytes.
      See Also:
    • setReadOnly

      public void setReadOnly(boolean readOnly)
    • isReadOnly

      public boolean isReadOnly()
    • setUnit

      public void setUnit(String unit)
    • getUnit

      public String getUnit()
    • isSynthetic

      public boolean isSynthetic()
    • setSynthetic

      public void setSynthetic(boolean synthetic)
    • fireProductNodeDataChanged

      public void fireProductNodeDataChanged()
      Fires a node data changed event. This method is called after the data of this data node changed.
    • checkDataCompatibility

      protected void checkDataCompatibility(ProductData data) throws IllegalArgumentException
      Checks if the data that should be used to access the data is compatible with the data this node can hold.
      Parameters:
      data - the data to be checked for compatibility
      Throws:
      IllegalArgumentException - if data is invalid.
    • acceptVisitor

      public abstract void acceptVisitor(ProductVisitor visitor)
      Accepts the given visitor. This method implements the well known 'Visitor' design pattern of the gang-of-four. The visitor pattern allows to define new operations on the product data model without the need to add more code to it. The new operation is implemented by the visitor.
      Specified by:
      acceptVisitor in class ProductNode
      Parameters:
      visitor - the visitor, must not be null
    • getRawStorageSize

      public long getRawStorageSize(ProductSubsetDef subsetDef)
      Gets the estimated size in bytes of this product node.
      Specified by:
      getRawStorageSize in class ProductNode
      Parameters:
      subsetDef - if not null the subset may limit the size returned
      Returns:
      the size in bytes.
    • dispose

      public void dispose()
      Releases all of the resources used by this object instance and all of its owned children. Its primary use is to allow the garbage collector to perform a vanilla job.

      This method should be called only if it is for sure that this object instance will never be used again. The results of referencing an instance of this class after a call to dispose() are undefined.

      Overrides of this method should always call super.dispose(); after disposing this instance.

      Overrides:
      dispose in class ProductNode
    • createCompatibleProductData

      public ProductData createCompatibleProductData(int numElems)
      Creates product data that is compatible to this dataset's data type. The data buffer returned contains exactly numElems elements of a compatible data type.
      Parameters:
      numElems - the number of elements, must not be less than one
      Returns:
      product data compatible with this data node