Class Ensemble

java.lang.Object
ucar.unidata.metdata.Ensemble
All Implemented Interfaces:
Serializable

public class Ensemble extends Object implements Serializable
A class for holding an ensemble of Quantitys and Values. Each Quantity can have only one associated Value.
Version:
$Revision: 1.7 $
Author:
Glenn Davis
See Also:
  • Constructor Details

    • Ensemble

      public Ensemble()
      Create a new Ensemble
  • Method Details

    • put

      public Value put(String qstr, int vv, String uStr)
      Pust a Quantity into the Ensemble.
      Parameters:
      qstr - quantity name
      vv - quantity value
      uStr - unit name
      Returns:
      the new Value or null if it is not already there
    • put

      public Value put(Quantity qq, Value vv)
      Put a Quantity in the Ensemble
      Parameters:
      qq - Quantity
      vv - Value
      Returns:
      vv or null if it is not already there
    • get

      public Value get(Quantity qq)
      Get the Value of a Quantity from the Ensemble
      Parameters:
      qq - Quantity to look up
      Returns:
      associated value
    • get

      public Value get(String qstr)
      Get the Value from the Ensemble by Quantity name
      Parameters:
      qstr - quantity name
      Returns:
      associated value or null if it does not exist
    • isEmpty

      public boolean isEmpty()
      See if this ensemble is empty
      Returns:
      true if it has not entries
    • size

      public int size()
      Get the size of the ensemble.
      Returns:
      number of entries
    • keySet

      public Set keySet()
      Get the set of Quantitys in the Ensemble.
      Returns:
      set of Quantities
    • entrySet

      public Set entrySet()
      Get the set of Values in the Ensemble.
      Returns:
      set of Values
    • hashCode

      public int hashCode()
      Return the hash code for this object.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code
    • equals

      public boolean equals(Object oo)
      See if the Object in question is equal to this Ensemble.
      Overrides:
      equals in class Object
      Parameters:
      oo - Object in question
      Returns:
      true if they are equal
    • formatEntry

      protected StringBuffer formatEntry(StringBuffer buf, Map.Entry entry)
      Format the Entry.
      Parameters:
      buf - StringBuffer for formatting
      entry - Entry to format
      Returns:
      formatted Entry
    • format

      public StringBuffer format(StringBuffer buf)
      Format the entire Ensemble. Iterates through all entries and returns the StringBuffer containing them.
      Parameters:
      buf - StringBuffer to put formatted entries into
      Returns:
      buf
    • toString

      public String toString()
      Return a String representation of this Ensemble
      Overrides:
      toString in class Object
      Returns:
      string representation