Package org.esa.snap.core.datamodel
Class SampleCoding
java.lang.Object
com.bc.ceres.core.ExtensibleObject
org.esa.snap.core.datamodel.ProductNode
org.esa.snap.core.datamodel.MetadataElement
org.esa.snap.core.datamodel.SampleCoding
- All Implemented Interfaces:
Extensible
- Direct Known Subclasses:
FlagCoding
,IndexCoding
Provides the information required to decode integer sample values that
are combined of single flags (bit indexes).
- Since:
- BEAM 4.2
-
Field Summary
Fields inherited from class org.esa.snap.core.datamodel.ProductNode
PROPERTY_NAME_DESCRIPTION, PROPERTY_NAME_NAME
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAttribute
(MetadataAttribute attribute) Adds an attribute to this node.void
addElement
(MetadataElement element) Overrides the base classaddElement
in order to not add an element to this flag coding because flag codings do not support inner elements.Adds a new coding value to this sample coding.addSamples
(String name, int[] values, String description) Adds a new coding value to this sample coding.int
Gets the number of coded sample values.getSampleName
(int index) Gets the sample name at the specified attribute index.int
getSampleValue
(int index) Gets the sample value at the specified attribute index.Methods inherited from class org.esa.snap.core.datamodel.MetadataElement
acceptVisitor, addElementAt, containsAttribute, containsElement, createDeepClone, dispose, getAttribute, getAttributeAt, getAttributeDouble, getAttributeDouble, getAttributeIndex, getAttributeInt, getAttributeInt, getAttributeNames, getAttributes, getAttributeString, getAttributeString, getAttributeUTC, getAttributeUTC, getElement, getElementAt, getElementGroup, getElementIndex, getElementNames, getElements, getNumAttributes, getNumElements, getParentElement, getRawStorageSize, removeAttribute, removeElement, setAttributeDouble, setAttributeInt, setAttributeString, setAttributeUTC, setModified
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, setName, setNodeName, setOwner, toString, updateExpression
Methods inherited from class com.bc.ceres.core.ExtensibleObject
getExtension
-
Constructor Details
-
SampleCoding
-
-
Method Details
-
addElement
Overrides the base classaddElement
in order to not add an element to this flag coding because flag codings do not support inner elements.- Overrides:
addElement
in classMetadataElement
- Parameters:
element
- the element to be added, always ignored
-
addAttribute
Adds an attribute to this node. If an attribute with the same name already exists, the method does nothing.- Overrides:
addAttribute
in classMetadataElement
- Parameters:
attribute
- the attribute to be added- Throws:
IllegalArgumentException
- if the attribute added is not an integer or does not have a scalar value
-
addSample
Adds a new coding value to this sample coding.- Parameters:
name
- the coding namevalue
- the valuedescription
- the description text- Returns:
- A new attribute representing the coded sample.
- Throws:
IllegalArgumentException
- ifname
is null
-
addSamples
Adds a new coding value to this sample coding.- Parameters:
name
- the coding namevalues
- the valuesdescription
- the description text- Returns:
- A new attribute representing the coded sample.
- Throws:
IllegalArgumentException
- ifname
is null
-
getSampleCount
public int getSampleCount()Gets the number of coded sample values.- Returns:
- the number of coded sample values
-
getSampleName
Gets the sample name at the specified attribute index.- Parameters:
index
- the attribute index.- Returns:
- the sample name.
-
getSampleValue
public int getSampleValue(int index) Gets the sample value at the specified attribute index.- Parameters:
index
- the attribute index.- Returns:
- the sample value.
-