Class 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
  • Constructor Details

    • SampleCoding

      public SampleCoding(String name)
  • Method Details

    • 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
    • addSamples

      public MetadataAttribute addSamples(String name, int[] values, String description)
      Adds a new coding value to this sample coding.
      Parameters:
      name - the coding name
      values - the values
      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.