visad
Class Real

java.lang.Object
  |
  +--visad.ThingImpl
        |
        +--visad.DataImpl
              |
              +--visad.Scalar
                    |
                    +--visad.Real
Direct Known Subclasses:
DateTime

public class Real
extends Scalar
implements RealIface

Real is the class of VisAD scalar data for real numbers represented as double precision floating point values. Double.NaN is used to indicate missing values, because it has the appropriate arithmetic semantics. Real objects are immutable.

See Also:
Serialized Form

Inner classes inherited from class visad.DataImpl
DataImpl.Syncher
 
Inner classes inherited from class visad.ThingImpl
ThingImpl.RemotePair
 
Fields inherited from class visad.DataImpl
Type
 
Constructor Summary
Real(double value)
          Constructs a generic Real object.
Real(double value, double error)
          Constructs a generic Real object.
Real(RealType type)
          Constructs a Real object.
Real(RealType type, double value)
          Constructs a Real object.
Real(RealType type, double value, Unit u)
          Constructs a Real object.
Real(RealType type, double value, Unit u, double error)
          Constructs a Real object.
Real(RealType type, double value, Unit u, ErrorEstimate error)
          Constructs a Real object.
 
Method Summary
 int __eq__(double other)
           
 int __eq__(Real other)
           
 double __float__()
          Methods to convert types for Jython
 int __ge__(double other)
           
 int __ge__(Real other)
           
 int __gt__(double other)
          Methods for Jython comparisons with doubles and other Reals
 int __gt__(Real other)
           
 int __int__()
           
 int __le__(double other)
           
 int __le__(Real other)
           
 long __long__()
           
 int __lt__(double other)
           
 int __lt__(Real other)
           
 int __ne__(double other)
           
 int __ne__(Real other)
           
 Data adjustSamplingError(Data error, int error_mode)
          return a Real that clones this, except its ErrorEstimate is adjusted for the sampling error in error
 Data binary(Data data, int op, MathType new_type, int sampling_mode, int error_mode)
           
 Real cloneButUnit(Unit u)
          clone this, but with a new Unit
 Real cloneButValue(double value)
          clone this, but with a new value
 int compareTo(Object object)
          Compares this Real to another.
 DataShadow computeRanges(ShadowType type, DataShadow shadow)
           
 boolean equals(Object obj)
          Indicates if this Real is semantically identical to an object.
 ErrorEstimate getError()
           
 Unit getUnit()
           
 double getValue()
          Get the value for this Real in the units of the data.
 double getValue(Unit unit_out)
          Get the value for this Real converted to unit_out.
 int hashCode()
          Returns the hash code of this Real.
 boolean isMissing()
          Check to see if the value of this Real is a NaN.
 String longString(String pre)
           
static void main(String[] args)
          run 'java visad.Real' to test the Real class
 String toString()
           
 String toValueString()
          Gets a string that represents just the value portion of this Real -- but with full semantics (e.g.
 Data unary(int op, MathType new_type, int sampling_mode, int error_mode)
          unary function on a Real; override some trig functions based on Unit; transcental functions destroy dimensionfull Unit
 
Methods inherited from class visad.Scalar
addReference, clone, removeReference
 
Methods inherited from class visad.DataImpl
__add__, __add__, __div__, __div__, __mod__, __mod__, __mul__, __mul__, __neg__, __pow__, __pow__, __radd__, __rdiv__, __rmod__, __rmul__, __rpow__, __rsub__, __sub__, __sub__, abs, abs, acos, acos, acosDegrees, acosDegrees, add, add, asin, asin, asinDegrees, asinDegrees, atan, atan, atan2, atan2, atan2Degrees, atan2Degrees, atanDegrees, atanDegrees, binary, ceil, ceil, changeMathType, computeRanges, computeRanges, computeReferenceRanges, cos, cos, cosDegrees, cosDegrees, dataClone, divide, divide, exp, exp, floor, floor, getType, invertOp, local, log, log, longString, max, max, min, min, multiply, multiply, negate, negate, notifyReferences, pow, pow, remainder, remainder, rint, rint, round, round, setParent, sin, sin, sinDegrees, sinDegrees, sqrt, sqrt, subtract, subtract, tan, tan, tanDegrees, tanDegrees, unary
 
Methods inherited from class visad.ThingImpl
adaptedAddReference, adaptedRemoveReference
 
Methods inherited from class java.lang.Object
, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Real

public Real(RealType type,
            double value,
            Unit u,
            ErrorEstimate error)
     throws VisADException
Constructs a Real object. This is the most general constructor.
Parameters:
type - The type of the Real.
value - The value of the Real. May be Double.NaN.
u - The unit of the Real. May be null. If non-null and type.isInterval() returns true, then the unit will actually be u.getAbsoluteUnit().
error - Error estimate of the Real. May be null.
Throws:
UnitException - if the default unit of the type is inconvertible with the unit argument (i.e. if Unit.canConvert(u, type.getDefaultUnit()) returns false).
VisADException - Couldn't create necessary VisAD object.

Real

public Real(RealType type,
            double value,
            Unit u,
            double error)
     throws VisADException
Constructs a Real object. The error estimate will be based on a numeric value.
Parameters:
type - The type of the Real.
value - The value of the Real. May be Double.NaN.
u - The unit of the Real. May be null. If non-null and type.isInterval() returns true, then the unit will actually be u.getAbsoluteUnit().
error - Value for constructing an error estimate for the Real in units of u != null && type.isInterval() ? u.getAbsoluteUnit() : u.
Throws:
VisADException - Couldn't create necessary VisAD object.

Real

public Real(RealType type,
            double value,
            Unit u)
     throws VisADException
Constructs a Real object. The error estimate will be null.
Parameters:
type - The type of the Real.
value - The value of the Real. May be Double.NaN.
u - The unit of the Real. May be null. If non-null and type.isInterval() returns true, then the unit will actually be u.getAbsoluteUnit().
Throws:
VisADException - Couldn't create necessary VisAD object.

Real

public Real(RealType type,
            double value)
Constructs a Real object. The unit of the Real will be the default unit of the RealType and the error estimate will be null.
Parameters:
type - The type of the Real.
value - The value of the Real in units of type.getDefaultUnit(). May be Double.NaN.

Real

public Real(RealType type)
Constructs a Real object. The value will be missing, the unit of the Real will be the default unit of the RealType, and the error estimate will be null.
Parameters:
type - The type of the Real.

Real

public Real(double value,
            double error)
Constructs a generic Real object. The RealType of the Real will be RealType.Generic, the unit of the Real will be RealType.Generic.getDefaultUnit(), and the error estimate will be based on a numeric value.
Parameters:
value - The value of the Real. May be Double.NaN.
error - Value for constructing an error estimate for the Real in units of RealType.Generic.getDefaultUnit().

Real

public Real(double value)
Constructs a generic Real object. The RealType of the Real will be RealType.Generic, the unit of the Real will be RealType.Generic.getDefaultUnit(), and the error estimate will be 0.0.
Parameters:
value - The value of the Real. May be Double.NaN.
Method Detail

getValue

public final double getValue()
Get the value for this Real in the units of the data.
Specified by:
getValue in interface RealIface
Returns:
value as a double.

__gt__

public int __gt__(double other)
Methods for Jython comparisons with doubles and other Reals
Returns:
=0 for false, =1 for true

__lt__

public int __lt__(double other)

__ge__

public int __ge__(double other)

__le__

public int __le__(double other)

__ne__

public int __ne__(double other)

__eq__

public int __eq__(double other)

__gt__

public int __gt__(Real other)
           throws VisADException,
                  RemoteException

__lt__

public int __lt__(Real other)
           throws VisADException,
                  RemoteException

__ge__

public int __ge__(Real other)
           throws VisADException,
                  RemoteException

__le__

public int __le__(Real other)
           throws VisADException,
                  RemoteException

__eq__

public int __eq__(Real other)
           throws VisADException,
                  RemoteException

__ne__

public int __ne__(Real other)
           throws VisADException,
                  RemoteException

__float__

public double __float__()
Methods to convert types for Jython
Returns:
this Real as a float, long, or int

__long__

public long __long__()

__int__

public int __int__()

getValue

public final double getValue(Unit unit_out)
                      throws VisADException
Get the value for this Real converted to unit_out.
Specified by:
getValue in interface RealIface
Parameters:
unit_out - unit for return value
Returns:
value in unit_out units.
Throws:
VisADException - if either the Real's Unit or the unit_out is null (but not both).

isMissing

public boolean isMissing()
Check to see if the value of this Real is a NaN.
Returns:
true if a NaN.

binary

public Data binary(Data data,
                   int op,
                   MathType new_type,
                   int sampling_mode,
                   int error_mode)
            throws VisADException,
                   RemoteException
Overrides:
binary in class DataImpl

unary

public Data unary(int op,
                  MathType new_type,
                  int sampling_mode,
                  int error_mode)
           throws VisADException
unary function on a Real; override some trig functions based on Unit; transcental functions destroy dimensionfull Unit
Overrides:
unary in class DataImpl

computeRanges

public DataShadow computeRanges(ShadowType type,
                                DataShadow shadow)
                         throws VisADException,
                                RemoteException

getUnit

public Unit getUnit()
Specified by:
getUnit in interface RealIface

getError

public ErrorEstimate getError()
Specified by:
getError in interface RealIface

adjustSamplingError

public Data adjustSamplingError(Data error,
                                int error_mode)
                         throws VisADException,
                                RemoteException
return a Real that clones this, except its ErrorEstimate is adjusted for the sampling error in error
Specified by:
adjustSamplingError in interface RealIface
Overrides:
adjustSamplingError in class DataImpl

cloneButValue

public Real cloneButValue(double value)
                   throws VisADException
clone this, but with a new value
Specified by:
cloneButValue in interface RealIface

cloneButUnit

public Real cloneButUnit(Unit u)
                  throws VisADException
clone this, but with a new Unit
Specified by:
cloneButUnit in interface RealIface

toString

public String toString()
Specified by:
toString in interface RealIface
Overrides:
toString in class DataImpl

toValueString

public String toValueString()
Gets a string that represents just the value portion of this Real -- but with full semantics (e.g. numeric value and unit).
Specified by:
toValueString in interface RealIface
Returns:
A string representation of just the value portion of this Real.

longString

public String longString(String pre)
                  throws VisADException
Overrides:
longString in class DataImpl

compareTo

public int compareTo(Object object)
Compares this Real to another.
Specified by:
compareTo in interface RealIface
Parameters:
object - The other Real to compare against. It shall be a Real with a compatible (i.e. convertible) unit.
Returns:
A negative integer, zero, or a positive integer depending on whether this Real is considered less than, equal to, or greater than the other Real, respectively. If the values of the Real-s in the default unit are equal, then the ErrorEstimate.compareTo() method is used to break the tie.

equals

public boolean equals(Object obj)
Indicates if this Real is semantically identical to an object.
Parameters:
obj - The object.
Returns:
true if and only if this Real is semantically identical to the object.
Overrides:
equals in class Scalar

hashCode

public int hashCode()
Returns the hash code of this Real.
Specified by:
hashCode in interface RealIface
Returns:
The hash code of this Real. If two Real-s are semantically identical, then their hash codes are equal.
Overrides:
hashCode in class Object

main

public static void main(String[] args)
                 throws VisADException,
                        RemoteException
run 'java visad.Real' to test the Real class