Class ConstantMapAdapter

java.lang.Object
ucar.visad.display.MapAdapter
ucar.visad.display.ConstantMapAdapter
All Implemented Interfaces:
Comparable, ConstantMaps, Propertied

public class ConstantMapAdapter extends MapAdapter implements ConstantMaps
Provides support for adapting VisAD ConstantMap-s into something that is (hopefully) easier to use. Unlike instances of VisAD ConstantMap, the underlying ConstantMap of an instance of this class may change. (Yes, I know, a modifiable ConstantMap is something of an oxymoron -- yet it's still useful.)

Instances of this class have the following, bound, JavaBean properties:

Name Type Access Default Description
constantMap ConstantMap set/get construction-dependent The underlying ConstantMap of this instance
Version:
$Revision: 1.10 $
Author:
Steven R. Emmerson
  • Field Details

  • Constructor Details

    • ConstantMapAdapter

      public ConstantMapAdapter(DisplayRealType drt) throws VisADException
      Constructs. The numeric value of the underlying ConstantMap will be NaN.
      Parameters:
      drt - The DisplayRealType to be associated with this adapter.
      Throws:
      VisADException - VisAD failure.
    • ConstantMapAdapter

      public ConstantMapAdapter(Real value, DisplayRealType drt) throws VisADException
      Constructs.
      Parameters:
      value - The initial value for the DisplayRealType in units of the default unit of the DisplayRealType.
      drt - The DisplayRealType to be associated with this adapter.
      Throws:
      VisADException - VisAD failure.
    • ConstantMapAdapter

      public ConstantMapAdapter(double value, DisplayRealType drt) throws VisADException
      Constructs.
      Parameters:
      value - The initial value for the DisplayRealType in units of the default unit of the DisplayRealType.
      drt - The DisplayRealType to be associated with this adapter.
      Throws:
      VisADException - VisAD failure.
  • Method Details

    • setValue

      public void setValue(Real value) throws VisADException
      Set the constant value of the associated DisplayRealType. Fires a PropertyChangeEvent for CONSTANT_MAP with this instance as the source and with the both the old and new values appropriately set. The event is fired synchronously -- so watch out for deadlock.
      Parameters:
      value - The new value for the associated DisplayRealType.
      Throws:
      VisADException - VisAD failure.
    • setValue

      public void setValue(double value) throws VisADException
      Set the constant value of the associated DisplayRealType. Fires a PropertyChangeEvent for CONSTANT_MAP with this instance as the source and with the both the old and new values appropriately set. The event is fired synchronously -- so watch out for deadlock.
      Parameters:
      value - The new value for the associated DisplayRealType in units of the default unit of the DisplayRealType.
      Throws:
      VisADException - VisAD failure.
    • getConstantMap

      public ConstantMap getConstantMap()
      Returns the constant-map property.
      Returns:
      The constant-map property.
    • getConstantMaps

      public ConstantMap[] getConstantMaps()
      Returns the constant-map properties. This implementation returns this instances constant-map in a one-element array.
      Specified by:
      getConstantMaps in interface ConstantMaps
      Returns:
      The constant-map properties.
    • getConstantMaps

      public static ConstantMap[] getConstantMaps(ConstantMapAdapter[] constantMapAdapters)
      Returns the ConstantMaps of this instance. It is guaranteed that the returned array contains no duplicates.
      Parameters:
      constantMapAdapters - An array of adapted ConstantMap-s. May be null.
      Returns:
      The array of ConstantMap-s corresponding to the input. May be null.
    • setDisplay

      public void setDisplay(Display display) throws VisADException, RemoteException
      This method should be package private because it is expected that only a DisplayAdapter will invoke this method.
      Specified by:
      setDisplay in interface ConstantMaps
      Parameters:
      display - The VisAD display.
      Throws:
      VisADException - VisAD failure.
      RemoteException - Java RMI failure.
    • accept

      public void accept(ConstantMaps.Visitor visitor) throws VisADException, RemoteException
      Accepts a visitor for this instance.
      Specified by:
      accept in interface ConstantMaps
      Parameters:
      visitor - The visitor for this instance.
      Throws:
      VisADException - VisAD failure.
      RemoteException - Java RMI failure.
    • toString

      public String toString()
      Returns the string representation of this instance.
      Overrides:
      toString in class Object
      Returns:
      The string representation of this instance.
    • compareTo

      public int compareTo(Object obj)
      Compares this instance to another object.
      Specified by:
      compareTo in interface Comparable
      Parameters:
      obj - The other object. Must be an instance of this class.
      Returns:
      A value less than, equal to, or greater than zero depending on whether this instance is considered less than, equal to, or greater than the other object, respectively.
    • equals

      public boolean equals(Object obj)
      Indicates if this instance is semantically identical to another object.
      Overrides:
      equals in class Object
      Parameters:
      obj - The other object.
      Returns:
      true if and only if this instance is semantically identical to the other object.
    • hashCode

      public int hashCode()
      Returns the hash code of this instance.
      Overrides:
      hashCode in class Object
      Returns:
      The hash code of this instance.