visad
Class ConstantMap

java.lang.Object
  extended by visad.ScalarMap
      extended by visad.ConstantMap
All Implemented Interfaces:
Serializable, Cloneable, Comparable

public class ConstantMap
extends ScalarMap

mapping from constant to DisplayRealType

See Also:
Serialized Form

Constructor Summary
ConstantMap(double constant, DisplayRealType display_scalar)
          construct a ConstantMap with a double constant
ConstantMap(Real constant, DisplayRealType display_scalar)
          construct a ConstantMap with a Real constant;
 
Method Summary
 Object clone()
          Create and return a copy of this ScalarMap.
protected  int compareTo(ConstantMap that)
          Compares this instance to another instance.
 int compareTo(Object obj)
          Compares this instance to another object.
protected  int compareTo(ScalarMap that)
          Compares this instance to a ScalarMap.
 boolean equals(Object o)
          Indicates whether or not this instance equals an Object.
static boolean getAllowMultipleUseKludge()
           
 double getConstant()
           
static void setAllowMultipleUseKludge(boolean k)
          allow ConstantMaps to be used in multiple calls to DisplayImpl.addReference() or addReferences() such multiple use was not checked in the early releases of VisAD, and this method allows applications to easily avoid more extensive changes
 String toString(String pre)
          Returns a string representation of the ScalarMap with the specified prefix prepended.
 
Methods inherited from class visad.ScalarMap
addScalarMapListener, badRange, checkTicks, copy, disableAutoScale, doInitialize, equalizeFlow, getAxisScale, getControl, getDisplay, getDisplayScalar, getOverrideUnit, getRange, getScalar, getScalarName, getScale, getScaleEnable, getValueIndex, hashCode, incTick, inverseScaleValues, inverseScaleValues, isAutoScale, makeScale, peekTicks, removeScalarMapListener, resetAutoScale, scaleValues, scaleValues, scaleValues, scaleValues, setOverrideUnit, setRange, setRange, setRange, setRangeByUnits, setScalarName, setScaleColor, setScaleEnable, setTicks, setUnderscoreToBlank, setValueIndex, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConstantMap

public ConstantMap(double constant,
                   DisplayRealType display_scalar)
            throws VisADException
construct a ConstantMap with a double constant

Parameters:
constant - - double equated to DisplayRealType
display_scalar - - DisplayRealType set to constant (may not be Animation, SelectValue, SelectRange or IsoContour)
Throws:
VisADException - - a VisAD error occurred

ConstantMap

public ConstantMap(Real constant,
                   DisplayRealType display_scalar)
            throws VisADException
construct a ConstantMap with a Real constant;

Parameters:
constant - - Real whose value is equated to DisplayRealType
display_scalar - - DisplayRealType set to constant (may not be Animation, SelectValue, SelectRange or IsoContour)
Throws:
VisADException - - a VisAD error occurred
Method Detail

setAllowMultipleUseKludge

public static void setAllowMultipleUseKludge(boolean k)
allow ConstantMaps to be used in multiple calls to DisplayImpl.addReference() or addReferences() such multiple use was not checked in the early releases of VisAD, and this method allows applications to easily avoid more extensive changes

Parameters:
k - - true to allow multiple use

getAllowMultipleUseKludge

public static boolean getAllowMultipleUseKludge()
Returns:
boolean indicating whether ConstantMaps may be used in multiple calls to DisplayImpl.addReference() or addReferences()

getConstant

public double getConstant()
Returns:
constant value mapped to DisplayRealType

equals

public boolean equals(Object o)
Indicates whether or not this instance equals an Object.

Overrides:
equals in class ScalarMap
Parameters:
o - - A object.
Returns:
true if and only if this instance is equal to o.

compareTo

public int compareTo(Object obj)
Compares this instance to another object.

Specified by:
compareTo in interface Comparable
Overrides:
compareTo in class ScalarMap
Parameters:
obj - The other object.
Returns:
A value that is negative, zero, or positive depending on whether this instance is considered less than, equal to, or greater than the other object, respectively.

compareTo

protected int compareTo(ConstantMap that)
Compares this instance to another instance.

Parameters:
that - The other instance.
Returns:
A value that is negative, zero, or positive depending on whether this instance is considered less than, equal to, or greater than the other instance, respectively.

compareTo

protected int compareTo(ScalarMap that)
Compares this instance to a ScalarMap.

Overrides:
compareTo in class ScalarMap
Parameters:
that - The ScalarMap.
Returns:
-1 always. ConstantMap-s are considered less than true ScalarMap-s.

clone

public Object clone()
Description copied from class: ScalarMap
Create and return a copy of this ScalarMap.

Overrides:
clone in class ScalarMap
Returns:
copy of the ScalarMap or null if a copy couldn't be created.

toString

public String toString(String pre)
Description copied from class: ScalarMap
Returns a string representation of the ScalarMap with the specified prefix prepended.

Overrides:
toString in class ScalarMap
Parameters:
pre - prefix to prepend to the representation
Returns:
a string that "textually represents" this ScalarMap with pre prepended.