org.esa.beam.framework.datamodel
Class DataNode

java.lang.Object
  extended by com.bc.ceres.core.ExtensibleObject
      extended by org.esa.beam.framework.datamodel.ProductNode
          extended by org.esa.beam.framework.datamodel.DataNode
All Implemented Interfaces:
com.bc.ceres.core.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 Summary
static String PROPERTY_NAME_DATA
           
static String PROPERTY_NAME_READ_ONLY
           
static String PROPERTY_NAME_SYNTHETIC
           
static String PROPERTY_NAME_UNIT
           
 
Fields inherited from class org.esa.beam.framework.datamodel.ProductNode
PROPERTY_NAME_DESCRIPTION, PROPERTY_NAME_NAME
 
Constructor Summary
DataNode(String name, int dataType, long numElems)
          Constructs a new data node with the given name, data type and number of elements.
DataNode(String name, ProductData data, boolean readOnly)
           
 
Method Summary
abstract  void acceptVisitor(ProductVisitor visitor)
          Accepts the given visitor.
protected  void checkDataCompatibility(ProductData data)
          Checks if the data that should be used to access the data is compatible with the data this node can hold.
 ProductData createCompatibleProductData(int numElems)
          Creates product data that is compatible to this dataset's data type.
 void dispose()
          Releases all of the resources used by this object instance and all of its owned children.
 void fireProductNodeDataChanged()
          Fires a node data changed event.
 ProductData getData()
          Gets the data of this data node.
 Object getDataElems()
          Gets the data elements of this data node.
 int getDataElemSize()
          Gets the data element size in bytes.
 int getDataType()
          Gets the data type of this data node.
 long getNumDataElems()
          Gets the number of data elements in this data node.
 long getRawStorageSize(ProductSubsetDef subsetDef)
          Gets the estimated size in bytes of this product node.
 String getUnit()
           
 boolean isFloatingPointType()
          Tests whether the data type of this node is a floating point type.
 boolean isReadOnly()
           
 boolean isSynthetic()
          Deprecated. since BEAM 4.10 (not used, no replacement)
 void setData(ProductData data)
          Sets the data of this data node.
 void setDataElems(Object elems)
          Sets the data elements of this data node.
 void setReadOnly(boolean readOnly)
           
 void setSynthetic(boolean synthetic)
          Deprecated. since BEAM 4.10 (not used, no replacement)
 void setUnit(String unit)
           
 
Methods inherited from class org.esa.beam.framework.datamodel.ProductNode
fireProductNodeChanged, fireProductNodeChanged, getDescription, getDisplayName, getName, getOwner, getProduct, getProductReader, getProductReaderSafe, getProductRefString, getProductSafe, getProductWriter, getProductWriterSafe, getRawStorageSize, isModified, isPartOfSubset, isValidNodeName, removeFromFile, setDescription, setModified, setName, setOwner, toString, updateExpression
 
Methods inherited from class com.bc.ceres.core.ExtensibleObject
getExtension
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROPERTY_NAME_DATA

public static final String PROPERTY_NAME_DATA
See Also:
Constant Field Values

PROPERTY_NAME_READ_ONLY

public static final String PROPERTY_NAME_READ_ONLY
See Also:
Constant Field Values

PROPERTY_NAME_SYNTHETIC

public static final String PROPERTY_NAME_SYNTHETIC
See Also:
Constant Field Values

PROPERTY_NAME_UNIT

public static final String PROPERTY_NAME_UNIT
See Also:
Constant Field Values
Constructor Detail

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 Detail

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:
ProductData.setElems(Object)

getDataElems

public Object getDataElems()
Gets the data elements of this data node.

See Also:
ProductData.getElems()

getDataElemSize

public int getDataElemSize()
Gets the data element size in bytes.

See Also:
ProductData.getElemSize(int)

setReadOnly

public void setReadOnly(boolean readOnly)

isReadOnly

public boolean isReadOnly()

setUnit

public void setUnit(String unit)

getUnit

public String getUnit()

isSynthetic

@Deprecated
public boolean isSynthetic()
Deprecated. since BEAM 4.10 (not used, no replacement)


setSynthetic

@Deprecated
public void setSynthetic(boolean synthetic)
Deprecated. since BEAM 4.10 (not used, no replacement)


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


Copyright © 2002-2013 Brockmann Consult GmbH. All Rights Reserved.