org.esa.beam.framework.datamodel
Class SampleCoding

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.MetadataElement
              extended by org.esa.beam.framework.datamodel.SampleCoding
All Implemented Interfaces:
com.bc.ceres.core.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.beam.framework.datamodel.ProductNode
PROPERTY_NAME_DESCRIPTION, PROPERTY_NAME_NAME
 
Constructor Summary
SampleCoding(String name)
           
 
Method Summary
 void addAttribute(MetadataAttribute attribute)
          Adds an attribute to this node.
 void addElement(MetadataElement element)
          Overrides the base class addElement in order to not add an element to this flag coding because flag codings do not support inner elements.
 MetadataAttribute addSample(String name, int value, String description)
          Adds a new coding value to this sample coding.
 int getSampleCount()
          Gets the number of coded sample values.
 String 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.beam.framework.datamodel.MetadataElement
acceptVisitor, addAttributeFast, 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.beam.framework.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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SampleCoding

public SampleCoding(String name)
Method Detail

addElement

public void addElement(MetadataElement element)
Overrides the base class addElement in order to not add an element to this flag coding because flag codings do not support inner elements.

Overrides:
addElement in class MetadataElement
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:
addAttribute in class MetadataElement
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 name
value - the value
description - the description text
Returns:
A new attribute representing the coded sample.
Throws:
IllegalArgumentException - if name is 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.


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