visad
Class Tuple
- java.lang.Object
-
- visad.ThingImpl
-
- visad.DataImpl
-
- visad.Tuple
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Data, Thing, TupleIface
- Direct Known Subclasses:
- DoubleStringTuple, 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
Dataobjects cannot be modified; Tuple objects are mutable, however, in the sense that a containedDataobject might be mutable (e.g. it might be aFieldwith modifiable range values).- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class visad.DataImpl
DataImpl.Syncher
-
-
Field Summary
Fields Modifier and Type Field and Description static intcloneCnt-
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
Constructors Constructor and Description Tuple(Data[] datums)Construct a Tuple object from an array of Data objects; this constructs its MathType from the MathTypes of the data arrayTuple(Data[] datums, boolean copy)Construct a Tuple object from an array of Data objects; this constructs its MathType from the MathTypes of the data arrayTuple(TupleType type)Construct a Tuple object with missing valueTuple(TupleType type, Data[] datums)Construct a Tuple object from a type and an array of Data objectsTuple(TupleType type, Data[] datums, boolean copy)Construct a Tuple object from a type and an array of Data objectsTuple(TupleType type, Data[] datums, boolean copy, boolean checkType)Construct a Tuple object from a type and an array of Data objects
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description Data__getitem__(int index)A wrapper aroundgetComponentfor JPython.int__len__()A wrapper aroundgetLengthfor JPython.DataadjustSamplingError(Data error, int error_mode)return a Tuple that clones this, except its ErrorEstimate-s are adjusted for sampling errors in errorDatabinary(Data data, int op, MathType new_type, int sampling_mode, int error_mode)Pointwise binary operation between this and data.static TupleTypebuildTupleType(Data[] datums)Make a TupleType for an array of Datajava.lang.Objectclone()Clones this instance.DataShadowcomputeRanges(ShadowType type, DataShadow shadow)Recursive version of computeRanges(), called down through Data object tree.booleanequals(java.lang.Object obj)Indicates if this Tuple is identical to an object.DatagetComponent(int i)Returns a component of this instance.Data[]getComponents()Returns the components that constitute this instance.Data[]getComponents(boolean copy)Returns the components that constitute this instance.intgetDimension()Return number of components in this Tuple.intgetLength()Return the number of components of the TupleReal[]getRealComponents()Get all the Real components from this Tuple.inthashCode()Returns the hash code of this object.booleanisMissing()Check if there is no Data in this Tuple.java.lang.StringlongString(java.lang.String pre)static TuplemakeTuple(Data[] datums)Create a Tuple from an array of Data objects.Dataunary(int op, MathType new_type, int sampling_mode, int error_mode)Pointwise unary operation applied to this.-
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, 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 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- Parameters:
type- the TupleType
-
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- Parameters:
type- the TupleTypedatums- the Data components- Throws:
VisADExceptionjava.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- Parameters:
type- the TupleTypedatums- the Data componentscopy- if true, copy the data objects- Throws:
VisADExceptionjava.rmi.RemoteException
-
Tuple
public Tuple(TupleType type, Data[] datums, boolean copy, boolean checkType) throws VisADException, java.rmi.RemoteException
Construct a Tuple object from a type and an array of Data objects- Parameters:
type- the TupleTypedatums- the Data componentscopy- if true, copy the data objectscheckType- if true, make sure the type matches the datum types.- Throws:
VisADExceptionjava.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- Parameters:
datums- the Data componentscopy- if true, copy the data objects- Throws:
VisADExceptionjava.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- Parameters:
datums- the Data components- Throws:
VisADExceptionjava.rmi.RemoteException
-
-
Method Detail
-
makeTuple
public static Tuple makeTuple(Data[] datums) throws VisADException, java.rmi.RemoteException
Create a Tuple from an array of Data objects.- Returns:
- a Tuple.
- Throws:
VisADExceptionjava.rmi.RemoteException
-
buildTupleType
public static TupleType buildTupleType(Data[] datums) throws VisADException, java.rmi.RemoteException
Make a TupleType for an array of Data- Parameters:
datums- array of Data objects- Throws:
VisADExceptionjava.rmi.RemoteException
-
getRealComponents
public Real[] getRealComponents() throws VisADException, java.rmi.RemoteException
Get all the Real components from this Tuple.- Specified by:
getRealComponentsin interfaceTupleIface- Returns:
- an array of Real-s
- Throws:
VisADExceptionjava.rmi.RemoteException
-
getComponents
public final Data[] getComponents()
Returns the components that constitute this instance. If this instance has no components, thennullis returned. A returned array may be modified without affecting the behavior of this instance.- Returns:
- The components of this instance or
null.
-
getComponents
public Data[] getComponents(boolean copy)
Returns the components that constitute this instance. If this instance has no components, thennullis returned. IF copy==true a returned array may be modified without affecting the behavior of this instance. Else, the returned array is the actual component array- Parameters:
copy- if true then return a copy of the tuple array. Else return the actual array- Returns:
- The components of this instance or
null.
-
isMissing
public boolean isMissing()
Check if there is no Data in this Tuple.- Specified by:
isMissingin interfaceData- Specified by:
isMissingin interfaceTupleIface- Returns:
- true if there is no data.
-
getDimension
public int getDimension()
Return number of components in this Tuple.- Specified by:
getDimensionin interfaceTupleIface- Returns:
- the number of components.
-
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 appropriateMathTypeis 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:
getComponentin interfaceTupleIface- 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 thangetDimension()-1.
-
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 class:DataImplPointwise binary operation between this and data. Applies to Reals, Tuples (recursively to components), and to Field ranges (Field domains implicitly resampled if necessary). Does not apply to Field domains or Sets (regarded as domains of Fields wthout ranges). Data.ADD is only op defined for Text, interpreted as concatenate. MathTypes of this and data must match, or one may match the range of the other if it is a FunctionType.- Specified by:
binaryin interfaceData- Specified by:
binaryin interfaceTupleIface- Overrides:
binaryin classDataImpl- Parameters:
data- other Data operand for binary operationop- may be Data.ADD, Data.SUBTRACT, etc; these include all binary operations defined for Java primitive data typesnew_type- MathType of the resultsampling_mode- may be Data.NEAREST_NEIGHBOR or Data.WEIGHTED_AVERAGEerror_mode- may be Data.INDEPENDENT, Data.DEPENDENT or Data.NO_ERRORS;- Returns:
- result, with MathType = new_type
- Throws:
VisADException- a VisAD error occurredjava.rmi.RemoteException- an RMI error occurred
-
unary
public Data unary(int op, MathType new_type, int sampling_mode, int error_mode) throws VisADException, java.rmi.RemoteException
Description copied from class:DataImplPointwise unary operation applied to this. Applies to Reals, Tuples (recursively to components), and to Field ranges (Field domains implicitly resampled if necessary). Does not apply to Field domains, Sets (regarded as domains of Fields wthout ranges) or Text.- Specified by:
unaryin interfaceData- Specified by:
unaryin interfaceTupleIface- Overrides:
unaryin classDataImpl- Parameters:
op- may be Data.ABS, Data.ACOS, etc; these include all unary operations defined for Java primitive data typesnew_type- MathType of the resultsampling_mode- may be Data.NEAREST_NEIGHBOR or Data.WEIGHTED_AVERAGEerror_mode- may be Data.INDEPENDENT, Data.DEPENDENT or Data.NO_ERRORS;- Returns:
- result, with MathType = new_type
- Throws:
VisADException- a VisAD error occurredjava.rmi.RemoteException- an RMI error occurred
-
computeRanges
public DataShadow computeRanges(ShadowType type, DataShadow shadow) throws VisADException, java.rmi.RemoteException
Description copied from interface:DataRecursive version of computeRanges(), called down through Data object tree.- Specified by:
computeRangesin interfaceData- Specified by:
computeRangesin interfaceTupleIface- Parameters:
type- ShadowType generated for MathType of thisshadow- DataShadow instance whose contained double[][] array and animation sampling Set are modified according to RealType values in this, and used as return value- Returns:
- DataShadow instance containing double[][] array of RealType ranges, and an animation sampling Set
- Throws:
VisADException- a VisAD error occurredjava.rmi.RemoteException- an RMI error occurred
-
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:
adjustSamplingErrorin interfaceData- Specified by:
adjustSamplingErrorin interfaceTupleIface- Overrides:
adjustSamplingErrorin classDataImplerror_mode- may be Data.INDEPENDENT, Data.DEPENDENT or Data.NO_ERRORS;- Returns:
- clone of this, except with ErrorEstimates set according to values in error
- Throws:
VisADException- a VisAD error occurredjava.rmi.RemoteException- an RMI error occurred
-
__getitem__
public Data __getitem__(int index) throws VisADException, java.rmi.RemoteException
A wrapper aroundgetComponentfor JPython.- Returns:
- The requested Data object.
- Throws:
VisADExceptionjava.rmi.RemoteException
-
__len__
public int __len__()
A wrapper aroundgetLengthfor 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.CloneNotSupportedExceptionClones this instance. The
clone()method of each component is invoked.This implementation throws
CloneNotSupportedExceptionif and only if one of the components throws it.
-
longString
public java.lang.String longString(java.lang.String pre) throws VisADException, java.rmi.RemoteException- Specified by:
longStringin interfaceData- Specified by:
longStringin interfaceTupleIface- Overrides:
longStringin classDataImpl- Parameters:
pre- String added to start of each line- Returns:
- a longer String than returned by toString(), indented by pre (a string of blanks)
- Throws:
VisADExceptionjava.rmi.RemoteException
-
equals
public boolean equals(java.lang.Object obj)
Indicates if this Tuple is identical to an object.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- The object.- Returns:
trueif 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:
hashCodein classjava.lang.Object- Returns:
- The hash code of this object.
-
-
DMelt 3.0 © DataMelt by jWork.ORG