visad.data.in
Class LonArithProg

java.lang.Object
  extended by visad.data.in.ArithProg
      extended by visad.data.in.LonArithProg

public final class LonArithProg
extends ArithProg

Provides support for determining if a sequence of values is an arithmetic progression of longitude values and, if so, the progression parameters.

Author:
Steven R. Emmerson

Field Summary
 
Fields inherited from class visad.data.in.ArithProg
dEps, fEps, first, isConsistent, last, meanDel, n
 
Constructor Summary
LonArithProg()
           
 
Method Summary
 boolean accumulate(double[] values)
          Accumulates a set of doubles.
 boolean accumulate(float[] values)
          Accumulates a set of floats.
static void main(String[] args)
          Tests this class.
 
Methods inherited from class visad.data.in.ArithProg
accumulate, accumulate, getCommonDifference, getFirst, getLast, getNumber, isConsistent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LonArithProg

public LonArithProg()
Method Detail

accumulate

public boolean accumulate(float[] values)
                   throws VisADException
Accumulates a set of floats. Indicates whether or not the sequence is consistent with the arithmetic progression so far.

Overrides:
accumulate in class ArithProg
Parameters:
values - The values to accumulate.
Returns:
False if the difference between any current and previous value normalized by the current increment differs from unity by more than the nearness threshold; otherwise, true.
Throws:
VisADException - ArithProg.isConsistent() was false before this method was invoked.
Precondition:
isConsistent() is true.
Postcondition:
A subsequent getNumber() will return values.length more than previously if the function returns true., A subsequent getLast() will return the value argument if the function returns true.

accumulate

public boolean accumulate(double[] values)
                   throws VisADException
Accumulates a set of doubles. Indicates whether or not the sequence is consistent with the arithmetic progression so far.

Overrides:
accumulate in class ArithProg
Parameters:
values - The values to accumulate.
Returns:
False if the difference between any current and previous value normalized by the current increment differs from unity by more than the nearness threshold; otherwise, true.
Throws:
VisADException - ArithProg.isConsistent() was false before this method was invoked.
Precondition:
isConsistent() is true.
Postcondition:
A subsequent getNumber() will return values.length more than previously if the function returns true., A subsequent getLast() will return the value argument if the function returns true.

main

public static void main(String[] args)
                 throws Exception
Tests this class.

Parameters:
args - Runtime arguments. Ignored.
Throws:
Exception - Something went wrong.