org.esa.beam.framework.datamodel
Class IndexCoding

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
                  extended by org.esa.beam.framework.datamodel.IndexCoding
All Implemented Interfaces:
com.bc.ceres.core.Extensible

public class IndexCoding
extends SampleCoding

Provides the information required to decode integer sample values that represent index values (e.g. types, classes, categories).

Since:
BEAM 4.2

Field Summary
 
Fields inherited from class org.esa.beam.framework.datamodel.ProductNode
PROPERTY_NAME_DESCRIPTION, PROPERTY_NAME_NAME
 
Constructor Summary
IndexCoding(String name)
          Constructs a new index coding object with the given name.
 
Method Summary
 void acceptVisitor(ProductVisitor visitor)
          Accepts the given visitor.
 MetadataAttribute addIndex(String name, int value, String description)
          Adds a new index definition to this flags coding.
 MetadataAttribute getIndex(String name)
          Returns a metadata attribute wich is the representation of the index with the given name.
 String[] getIndexNames()
          Returns a string array which contains the names of all indexes contained in this IndexCoding object.
 int getIndexValue(String name)
          Returns the flag mask value for the specified flag name.
 
Methods inherited from class org.esa.beam.framework.datamodel.SampleCoding
addAttribute, addElement, addSample, getSampleCount, getSampleName, getSampleValue
 
Methods inherited from class org.esa.beam.framework.datamodel.MetadataElement
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

IndexCoding

public IndexCoding(String name)
Constructs a new index coding object with the given name.

Parameters:
name - the name
Method Detail

getIndex

public MetadataAttribute getIndex(String name)
Returns a metadata attribute wich is the representation of the index with the given name. This method delegates to getPropertyValue(String).

Parameters:
name - the flag name
Returns:
a metadata attribute wich is the representation of the flag with the given name

getIndexNames

public String[] getIndexNames()
Returns a string array which contains the names of all indexes contained in this IndexCoding object.

Returns:
a string array which contains all names of this FlagCoding.
If this FlagCoding does not contain any flag, null is returned

addIndex

public MetadataAttribute addIndex(String name,
                                  int value,
                                  String description)
Adds a new index definition to this flags coding.

Parameters:
name - the index name
value - the index value
description - the description text
Returns:
A new attribute representing the coded index.
Throws:
IllegalArgumentException - if name is null

getIndexValue

public int getIndexValue(String name)
Returns the flag mask value for the specified flag name.

Parameters:
name - the flag name
Returns:
flagMask the flag's bit mask as a 32 bit integer
Throws:
IllegalArgumentException - if name is null, or a flag with the name does not exist

acceptVisitor

public 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.

The method simply calls visitor.visit(this).

Overrides:
acceptVisitor in class MetadataElement
Parameters:
visitor - the visitor, must not be null


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