Package org.esa.snap.core.datamodel
Class DataNode
java.lang.Object
com.bc.ceres.core.ExtensibleObject
org.esa.snap.core.datamodel.ProductNode
org.esa.snap.core.datamodel.DataNode
- All Implemented Interfaces:
Extensible
- Direct Known Subclasses:
MetadataAttribute
,RasterDataNode
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
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
Fields inherited from class org.esa.snap.core.datamodel.ProductNode
PROPERTY_NAME_DESCRIPTION, PROPERTY_NAME_NAME
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new data node with the given name, data type and number of elements.DataNode
(String name, ProductData data, boolean readOnly) -
Method Summary
Modifier and TypeMethodDescriptionabstract void
acceptVisitor
(ProductVisitor visitor) Accepts the given visitor.protected void
Checks if the data that should be used to access the data is compatible with the data this node can hold.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
Fires a node data changed event.getData()
Gets the data of this data node.Gets the data elements of this data node.int
Gets the data element size in bytes.int
Gets the data type of this data node.long
Gets the number of data elements in this data node.long
getRawStorageSize
(ProductSubsetDef subsetDef) Gets the estimated size in bytes of this product node.getUnit()
boolean
Tests whether the data type of this node is a floating point type.boolean
boolean
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) void
Methods inherited from class org.esa.snap.core.datamodel.ProductNode
fireProductNodeChanged, fireProductNodeChanged, getDescription, getDisplayName, getName, getOwner, getProduct, getProductReader, getProductReaderSafe, getProductRefString, getProductSafe, getProductWriter, getProductWriterSafe, getRawStorageSize, isModified, isPartOfSubset, isValidNodeName, removeFromFile, setDescription, setModified, setName, setNodeName, setOwner, toString, updateExpression
Methods inherited from class com.bc.ceres.core.ExtensibleObject
getExtension
-
Field Details
-
PROPERTY_NAME_DATA
- See Also:
-
PROPERTY_NAME_READ_ONLY
- See Also:
-
PROPERTY_NAME_SYNTHETIC
- See Also:
-
PROPERTY_NAME_UNIT
- See Also:
-
-
Constructor Details
-
DataNode
Constructs a new data node with the given name, data type and number of elements. -
DataNode
-
-
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
Sets the data of this data node. -
getData
Gets the data of this data node. -
setDataElems
Sets the data elements of this data node.- See Also:
-
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
-
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
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
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 classProductNode
- Parameters:
visitor
- the visitor, must not benull
-
getRawStorageSize
Gets the estimated size in bytes of this product node.- Specified by:
getRawStorageSize
in classProductNode
- Parameters:
subsetDef
- if notnull
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 classProductNode
-
createCompatibleProductData
Creates product data that is compatible to this dataset's data type. The data buffer returned contains exactlynumElems
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
-