numericalMethods.util
Class TupleSequences

java.lang.Object
  |
  +--numericalMethods.util.TupleSequences

public final class TupleSequences
extends java.lang.Object

This class provides utilities for arrays as static methods with a special structure, namely for sequences of tuples with a common size, the tupleSize. /bf Most operation performed on the target array or targetTuple can imply a change of its length. Those methods create a new array and return this instead of the original which is only returned if it has already the right length.


Constructor Summary
TupleSequences()
           
 
Method Summary
static void fill(double[] target, double[] tupleValue)
          Fills target with value.
static void fill(double[] target, int tupleSize, double value)
          Fills target with value.
static double getComponent(double[] target, int tupleSize, int tupleNumber, int componentNumber)
          Returns a component of a tuple.
static double[] getMax(double[] target, int tupleSize, double[] targetTuple)
          Returns the maximum in each component of the target.
static double[] getMin(double[] target, int tupleSize, double[] targetTuple)
          Returns the minimum in each component of the target.
static double[] getTuple(double[] target, int tupleSize, int tupleNumber, double[] targetTuple)
          Returns a tupble of the target.
static double[] resize(double[] target, int tupleSize, int size)
          Like newSize but copies also the contents of the target if nesescary.
static double[] size(double[] target, int tupleSize, int size)
          Just returns target if its length equals tupleSize times size.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TupleSequences

public TupleSequences()
Method Detail

size

public static final double[] size(double[] target,
                                  int tupleSize,
                                  int size)
Just returns target if its length equals tupleSize times size. Otherwise, this includes target is null, it creates an array of the right length and returns that instead.

resize

public static final double[] resize(double[] target,
                                    int tupleSize,
                                    int size)
Like newSize but copies also the contents of the target if nesescary.

fill

public static final void fill(double[] target,
                              double[] tupleValue)
Fills target with value.

fill

public static final void fill(double[] target,
                              int tupleSize,
                              double value)
Fills target with value.
Throws:
throws - an IllegalArgumentException if the target is not multiple of tupleSize.

getComponent

public static final double getComponent(double[] target,
                                        int tupleSize,
                                        int tupleNumber,
                                        int componentNumber)
Returns a component of a tuple.
Throws:
throws - an IllegalArgumentException if the target is not multiple of tupleSize.
throws - ArrayIndexOutOfBoundsException for illegal tuple or component numbers.

getTuple

public static final double[] getTuple(double[] target,
                                      int tupleSize,
                                      int tupleNumber,
                                      double[] targetTuple)
Returns a tupble of the target. The targetTuple is used if it has the right size otherwise a new array for the tupble is created.
Throws:
throws - ArrayIndexOutOfBoundsException for illegal tupleNumbers.

getMin

public static final double[] getMin(double[] target,
                                    int tupleSize,
                                    double[] targetTuple)
Returns the minimum in each component of the target. The targetTuple is used if it has the right size otherwise a new array for the minimum is created.

getMax

public static final double[] getMax(double[] target,
                                    int tupleSize,
                                    double[] targetTuple)
Returns the maximum in each component of the target. The targetTuple is used if it has the right size otherwise a new array for the maximum is created.