Maven module :un.api : api-math :
Class : un.api.math.Tuple
Extends/Implements : -
Subclasses : -

A tuple is an ordered list of numeric values.
author  Johann Sorel


Variables : -
Functions : getSize, getX, getY, getZ, getW, getXY, getXYZ, getXYZW, setX, setY, setZ, setW, setXY, setXYZ, setXYZW, setAll, setToZero, isZero, isAll, setToNaN, isValid, getValues, get, set, set, set, set, toArrayDouble, toArrayDouble, toArrayFloat, toArrayFloat, copy




Get number of dimension.
return  tuple dimension
int getSize ()


Convenient method to get value at ordinate 0.
May throw an exception if dimension 0 do not exist.
return  double
double getX ()


Convenient method to get value at ordinate 1.
May throw an exception if dimension 1 do not exist.
return  double
double getY ()


Convenient method to get value at ordinate 2.
May throw an exception if dimension 2 do not exist.
return  double
double getZ ()


Convenient method to get value at ordinate 3.
May throw an exception if dimension 3 do not exist.
return  double
double getW ()


Convenient method to get values at ordinate [0,1].
May throw an exception if ordinates do not exist
return  double
Tuple getXY ()


Convenient method to get values at ordinate [0,1,2].
May throw an exception if ordinates do not exist
return  double
Tuple getXYZ ()


Convenient method to get values at ordinate [0,1,2,3].
May throw an exception if ordinates do not exist
return  double
Tuple getXYZW ()


Convenient method to set value at ordinate 0.
May throw an exception if dimension 0 do not exist.
param  x first ordinate value
void setX (double x)


Convenient method to set value at ordinate 1.
May throw an exception if dimension 1 do not exist.
param  y second ordinate value
void setY (double y)


Convenient method to set value at ordinate 2.
May throw an exception if dimension 2 do not exist.
param  z third ordinate value
void setZ (double z)


Convenient method to set value at ordinate 3.
May throw an exception if dimension 3 do not exist.
param  w fourth ordinate value
void setW (double w)


Convenient method to set value at ordinate 0,1.
May throw an exception if a dimension do not exist.
param  x first ordinate value
param  y second ordinate value
void setXY (double x, double y)


Convenient method to set value at ordinate 0,1,3.
May throw an exception if a dimension do not exist.
param  x first ordinate value
param  y second ordinate value
param  z third ordinate value
void setXYZ (double x, double y, double z)


Convenient method to set value at ordinate 0,1,2,3.
May throw an exception if a dimension do not exist.
param  x first ordinate value
param  y second ordinate value
param  z third ordinate value
param  w fourth ordinate value
void setXYZW (double x, double y, double z, double w)


Set all values to given value.
param  v new value for all elements.
void setAll (double v)


Reset all values to 0.
void setToZero ()


return  true if all values are set to zero.
boolean isZero ()


return  true if all values are set to given value.
boolean isAll (double value)


Reset all values to NaN.
void setToNaN ()


Check that all values are not NaN or Infinites.
return  true if valid
boolean isValid ()


Get the back array used by this tuple.
This is a direct access, modify with care.
return  back array
double[] getValues ()


Get value at ordinate.
param  indice ordinate
return  ordinate value
double get (int indice)


Set value at given ordinate.
param  indice ordinate
param  value new value
void set (int indice, double value)


Copy values from tuple.
If toCopy.values.length superior to this.values.length, then the only
this.values.length values of toCopy are copied.
param  toCopy tuple to copy
void set (Tuple toCopy)


Copy values from array.
If values.length superior to this.values.length, then the only
this.values.length values of values are copied.
param  values array to copy
void set (double[] values)


Copy values from array.
If values.length superior to this.values.length, then the only
this.values.length values of values are copied.
param  values array to copy
void set (float[] values)


Get a copy of the tuple values.
return  double array
double[] toArrayDouble ()


Copies and returns the array values.
param  buffer a buffer object, not null
return  a copy of the array values.
double[] toArrayDouble (double[] buffer)


Get a copy of the tuple values as floats.
return  float array
float[] toArrayFloat ()


Returns a copy of the array values casted to float.
param  buffer a buffer object, not null
return  a copy of the array values casted to float.
float[] toArrayFloat (float[] buffer)


Copy this Tuple.
return  new tuple copy
Tuple copy ()