visad
Class Tuple

java.lang.Object
  extended by visad.ThingImpl
      extended by visad.DataImpl
          extended by visad.Tuple
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Data, Thing, TupleIface
Direct Known Subclasses:
JamaCholeskyDecomposition, JamaEigenvalueDecomposition, JamaLUDecomposition, JamaQRDecomposition, JamaSingularValueDecomposition, NamedLocationTuple, RealTuple

public class Tuple
extends DataImpl
implements TupleIface

Tuple is the general VisAD data class for vectors. Tuple objects are immutable in the sense that the sequence of Data objects cannot be modified; Tuple objects are mutable, however, in the sense that a contained Data object might be mutable (e.g. it might be a Field with modifiable range values).

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class visad.DataImpl
DataImpl.Syncher
 
Field Summary
 
Fields inherited from interface visad.Data
ABS, ACOS, ACOS_DEGREES, ADD, ASIN, ASIN_DEGREES, ATAN, ATAN_DEGREES, ATAN2, ATAN2_DEGREES, CEIL, COS, COS_DEGREES, DEGREES_TO_RADIANS, DEPENDENT, DIVIDE, EXP, FLOOR, INDEPENDENT, INV_ATAN2, INV_ATAN2_DEGREES, INV_DIVIDE, INV_POW, INV_REMAINDER, INV_SUBTRACT, LOG, MAX, MIN, MULTIPLY, NEAREST_NEIGHBOR, NEGATE, NO_ERRORS, NOP, POW, RADIANS_TO_DEGREES, REMAINDER, RINT, ROUND, SIN, SIN_DEGREES, SQRT, SUBTRACT, TAN, TAN_DEGREES, WEIGHTED_AVERAGE
 
Constructor Summary
Tuple(Data[] datums)
          construct a Tuple object from an array of Data objects; this constructs its MathType from the MathTypes of the data array; components are copies of data
Tuple(Data[] datums, boolean copy)
          construct a Tuple object from an array of Data objects; this constructs its MathType from the MathTypes of the data array; only copy data if copy == true
Tuple(TupleType type)
          construct a Tuple object with missing value
Tuple(TupleType type, Data[] datums)
          construct a Tuple object from a type and an array of Data objects
Tuple(TupleType type, Data[] datums, boolean copy)
          construct a Tuple object from a type and an array of Data objects
 
Method Summary
 Data __getitem__(int index)
          A wrapper around getComponent for JPython.
 int __len__()
          A wrapper around getLength for JPython.
 Data adjustSamplingError(Data error, int error_mode)
          return a Tuple that clones this, except its ErrorEstimate-s are adjusted for sampling errors in error
 Data binary(Data data, int op, MathType new_type, int sampling_mode, int error_mode)
          general binary operation between this and data; op may be Data.ADD, Data.SUBTRACT, etc; these include all binary operations defined for Java primitive data types; new_type is the MathType of the result; sampling_mode may be Data.NEAREST_NEIGHBOR or Data.WEIGHTED_AVERAGE; error_mode may be Data.INDEPENDENT, Data.DEPENDENT or Data.NO_ERRORS
static TupleType buildTupleType(Data[] datums)
          make a TupleType for an array of Data
 java.lang.Object clone()
          Clones this instance.
 DataShadow computeRanges(ShadowType type, DataShadow shadow)
          recursive version of computeRanges; would like 'default' visibility here, but must be declared 'public' because it is defined in the Data interface
 boolean equals(java.lang.Object obj)
          Indicates if this Tuple is identical to an object.
 Data getComponent(int i)
          Returns a component of this instance.
 Data[] getComponents()
          Returns the components that constitute this instance.
 int getDimension()
          return number of components
 int getLength()
          Return the number of components of the Tuple
 Real[] getRealComponents()
           
 int hashCode()
          Returns the hash code of this object.
 boolean isMissing()
          a method to tell whether data object has a missing value
 java.lang.String longString(java.lang.String pre)
          generates a longer string than generated by toString, indented by pre (a string of blanks)
static Tuple makeTuple(Data[] datums)
           
 Data unary(int op, MathType new_type, int sampling_mode, int error_mode)
          general unary operation; operation may be Data.ABS, Data.ACOS, etc; these include all unary operations defined for Java primitive data types; new_type is the MathType of the result; sampling_mode may be Data.NEAREST_NEIGHBOR or Data.WEIGHTED_AVERAGE; error_mode may be Data.INDEPENDENT, Data.DEPENDENT or Data.NO_ERRORS
 
Methods inherited from class visad.DataImpl
__add__, __add__, __div__, __div__, __mod__, __mod__, __mul__, __mul__, __neg__, __pow__, __pow__, __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, cos, cos, cosDegrees, cosDegrees, dataClone, divide, divide, exp, exp, floor, floor, getType, local, log, log, longString, main, max, max, min, min, multiply, multiply, negate, negate, notifyReferences, pow, pow, remainder, remainder, rint, rint, round, round, sin, sin, sinDegrees, sinDegrees, sqrt, sqrt, subtract, subtract, tan, tan, tanDegrees, tanDegrees, toString, unary
 
Methods inherited from class visad.ThingImpl
addReference, removeReference
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface visad.Data
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, cos, cos, cosDegrees, cosDegrees, dataClone, divide, divide, exp, exp, floor, floor, getType, local, log, log, longString, max, max, min, min, multiply, multiply, negate, negate, pow, pow, remainder, remainder, rint, rint, round, round, sin, sin, sinDegrees, sinDegrees, sqrt, sqrt, subtract, subtract, tan, tan, tanDegrees, tanDegrees, unary
 
Methods inherited from interface visad.Thing
addReference, removeReference
 

Constructor Detail

Tuple

public Tuple(TupleType type)
construct a Tuple object with missing value


Tuple

public Tuple(TupleType type,
             Data[] datums)
      throws VisADException,
             java.rmi.RemoteException
construct a Tuple object from a type and an array of Data objects

Throws:
VisADException
java.rmi.RemoteException

Tuple

public Tuple(TupleType type,
             Data[] datums,
             boolean copy)
      throws VisADException,
             java.rmi.RemoteException
construct a Tuple object from a type and an array of Data objects

Throws:
VisADException
java.rmi.RemoteException

Tuple

public Tuple(Data[] datums,
             boolean copy)
      throws VisADException,
             java.rmi.RemoteException
construct a Tuple object from an array of Data objects; this constructs its MathType from the MathTypes of the data array; only copy data if copy == true

Throws:
VisADException
java.rmi.RemoteException

Tuple

public Tuple(Data[] datums)
      throws VisADException,
             java.rmi.RemoteException
construct a Tuple object from an array of Data objects; this constructs its MathType from the MathTypes of the data array; components are copies of data

Throws:
VisADException
java.rmi.RemoteException
Method Detail

makeTuple

public static Tuple makeTuple(Data[] datums)
                       throws VisADException,
                              java.rmi.RemoteException
Throws:
VisADException
java.rmi.RemoteException

buildTupleType

public static TupleType buildTupleType(Data[] datums)
                                throws VisADException,
                                       java.rmi.RemoteException
make a TupleType for an array of Data

Throws:
VisADException
java.rmi.RemoteException

getRealComponents

public Real[] getRealComponents()
                         throws VisADException,
                                java.rmi.RemoteException
Specified by:
getRealComponents in interface TupleIface
Throws:
VisADException
java.rmi.RemoteException

getComponents

public Data[] getComponents()
Returns the components that constitute this instance. If this instance has no components, then null is returned. A returned array may be modified without affecting the behavior of this instance.

Returns:
The components of this instance or null.

getDimension

public int getDimension()
return number of components

Specified by:
getDimension in interface TupleIface

getComponent

public Data getComponent(int i)
                  throws VisADException,
                         java.rmi.RemoteException
Returns a component of this instance. If this instance has no components, then an object of the appropriate MathType is created that has no data and is returned. A returned component is the actual component of this instance and is not a copy or clone.

Specified by:
getComponent in interface TupleIface
Parameters:
i - The zero-based index of the coponent to return.
Returns:
The i-th component of this instance.
Throws:
VisADException - if this instance has no components and couldn't create one with no data.
java.rmi.RemoteException - if a Java RMI failure occurs.
TypeException - if the index is less than zero or greater than getDimension()-1.

isMissing

public boolean isMissing()
Description copied from interface: Data
a method to tell whether data object has a missing value

Specified by:
isMissing in interface Data
Specified by:
isMissing in interface TupleIface

binary

public Data binary(Data data,
                   int op,
                   MathType new_type,
                   int sampling_mode,
                   int error_mode)
            throws VisADException,
                   java.rmi.RemoteException
Description copied from interface: Data
general binary operation between this and data; op may be Data.ADD, Data.SUBTRACT, etc; these include all binary operations defined for Java primitive data types; new_type is the MathType of the result; sampling_mode may be Data.NEAREST_NEIGHBOR or Data.WEIGHTED_AVERAGE; error_mode may be Data.INDEPENDENT, Data.DEPENDENT or Data.NO_ERRORS

Specified by:
binary in interface Data
Specified by:
binary in interface TupleIface
Overrides:
binary in class DataImpl
Throws:
VisADException
java.rmi.RemoteException

unary

public Data unary(int op,
                  MathType new_type,
                  int sampling_mode,
                  int error_mode)
           throws VisADException,
                  java.rmi.RemoteException
Description copied from interface: Data
general unary operation; operation may be Data.ABS, Data.ACOS, etc; these include all unary operations defined for Java primitive data types; new_type is the MathType of the result; sampling_mode may be Data.NEAREST_NEIGHBOR or Data.WEIGHTED_AVERAGE; error_mode may be Data.INDEPENDENT, Data.DEPENDENT or Data.NO_ERRORS

Specified by:
unary in interface Data
Specified by:
unary in interface TupleIface
Overrides:
unary in class DataImpl
Throws:
VisADException
java.rmi.RemoteException

computeRanges

public DataShadow computeRanges(ShadowType type,
                                DataShadow shadow)
                         throws VisADException,
                                java.rmi.RemoteException
Description copied from interface: Data
recursive version of computeRanges; would like 'default' visibility here, but must be declared 'public' because it is defined in the Data interface

Specified by:
computeRanges in interface Data
Specified by:
computeRanges in interface TupleIface
Throws:
VisADException
java.rmi.RemoteException

adjustSamplingError

public Data adjustSamplingError(Data error,
                                int error_mode)
                         throws VisADException,
                                java.rmi.RemoteException
return a Tuple that clones this, except its ErrorEstimate-s are adjusted for sampling errors in error

Specified by:
adjustSamplingError in interface Data
Specified by:
adjustSamplingError in interface TupleIface
Overrides:
adjustSamplingError in class DataImpl
Throws:
VisADException
java.rmi.RemoteException

__getitem__

public Data __getitem__(int index)
                 throws VisADException,
                        java.rmi.RemoteException
A wrapper around getComponent for JPython.

Returns:
The requested Data object.
Throws:
VisADException
java.rmi.RemoteException

__len__

public int __len__()
A wrapper around getLength for JPython.

Returns:
The number of components of the Tuple

getLength

public int getLength()
Return the number of components of the Tuple

Returns:
Number of components.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException

Clones this instance. The clone() method of each component is invoked.

This implementation throws CloneNotSupportedException if and only if one of the components throws it.

Overrides:
clone in class DataImpl
Returns:
A clone of this instance.
Throws:
java.lang.CloneNotSupportedException - if cloning isn't supported.

longString

public java.lang.String longString(java.lang.String pre)
                            throws VisADException,
                                   java.rmi.RemoteException
Description copied from class: DataImpl
generates a longer string than generated by toString, indented by pre (a string of blanks)

Specified by:
longString in interface Data
Specified by:
longString in interface TupleIface
Overrides:
longString in class DataImpl
Throws:
VisADException
java.rmi.RemoteException

equals

public boolean equals(java.lang.Object obj)
Indicates if this Tuple is identical to an object.

Overrides:
equals in class java.lang.Object
Parameters:
obj - The object.
Returns:
true if and only if the object is a Tuple and both Tuple-s have identical component sequences.

hashCode

public int hashCode()
Returns the hash code of this object.

Overrides:
hashCode in class java.lang.Object
Returns:
The hash code of this object.