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
public class SampleCoding extends MetadataElement
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 Constructor Description SampleCoding(String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttribute(MetadataAttribute attribute)Adds an attribute to this node.voidaddElement(MetadataElement element)Overrides the base classaddElementin order to not add an element to this flag coding because flag codings do not support inner elements.MetadataAttributeaddSample(String name, int value, String description)Adds a new coding value to this sample coding.MetadataAttributeaddSamples(String name, int[] values, String description)Adds a new coding value to this sample coding.intgetSampleCount()Gets the number of coded sample values.StringgetSampleName(int index)Gets the sample name at the specified attribute index.intgetSampleValue(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, setOwner, toString, updateExpression
-
Methods inherited from class com.bc.ceres.core.ExtensibleObject
getExtension
-
-
-
-
Constructor Detail
-
SampleCoding
public SampleCoding(String name)
-
-
Method Detail
-
addElement
public void addElement(MetadataElement element)
Overrides the base classaddElementin order to not add an element to this flag coding because flag codings do not support inner elements.- Overrides:
addElementin classMetadataElement- Parameters:
element- the element to be added, always ignored
-
addAttribute
public void addAttribute(MetadataAttribute attribute)
Adds an attribute to this node. If an attribute with the same name already exists, the method does nothing.- Overrides:
addAttributein 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
public MetadataAttribute addSample(String name, int value, String description)
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- ifnameis null
-
addSamples
public MetadataAttribute addSamples(String name, int[] values, String description)
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- ifnameis null
-
getSampleCount
public int getSampleCount()
Gets the number of coded sample values.- Returns:
- the number of coded sample values
-
getSampleName
public String getSampleName(int index)
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.
-
-