org.opengts.util
Class CurveFit

java.lang.Object
  extended by org.opengts.util.CurveFit

public class CurveFit
extends java.lang.Object

Curve-fit profile matrix


Nested Class Summary
static class CurveFit.Precision
          Precision Enum
 
Field Summary
static java.lang.String[] ARG_POINTS
           
static java.lang.String[] ARG_PRECISION
           
static java.lang.String[] ARG_VALUE
           
protected  java.math.MathContext bdMathCtx
           
protected  java.math.BigDecimal[] bigCoeff
           
protected  double[] dblCoeff
           
protected  XYPair maxXY
           
protected  XYPair minXY
           
protected  CurveFit.Precision precision
           
static java.lang.String PROP_CurveFit_defaultPrecision
           
protected  XYPair[] XY
           
 
Constructor Summary
protected CurveFit()
          Protected constructor.
  CurveFit(CurveFit cf)
          Clone constructor (deep copy)
  CurveFit(java.lang.String xyListStr)
          String constructor
  CurveFit(java.lang.String xyListStr, CurveFit.Precision P)
          String constructor
  CurveFit(XYPair[] xy)
          XYPair constructor
  CurveFit(XYPair[] xy, CurveFit.Precision P)
          XYPair constructor
 
Method Summary
protected static java.math.BigDecimal[] _CalculateCoefficients(java.math.BigDecimal[][] M, java.math.BigDecimal[] V, java.math.MathContext mc)
          Calculates the polynomial coefficients as "BigDecimal" values
protected static double[] _CalculateCoefficients(double[][] M, double[] V)
          Calculates the polynomial coefficients as "double" values
 double FTN(double X)
          Returns the value of Y based on the specified value for X.
static CurveFit.Precision GetDefaultPrecision(int pointSize)
          Gets the default precision type
 double getMaximumX()
          Gets the maximum "X" value
 double getMinimumX()
          Gets the minimum "X" value
static CurveFit.Precision GetPrecisionByName(java.lang.String name, CurveFit.Precision dft)
          Parses the specified precision type string
 double getRangeX()
          Gets the range of X
 boolean isValid()
          Returns true if this CurveFit is valid
static boolean isValid(CurveFit cf)
          Returns true if the specified CurveFit is valid
static void main(java.lang.String[] argv)
           
static XYPair[] ParseXYPair(java.lang.String xyListStr)
          Parse XY pair list.
static XYPair[] ParseXYPair(java.lang.String xyListStr, int fromNdx)
          Parse XY pair list.
 void print(java.lang.String msg, double[][] M, double[] V)
          (Debug) Prints the matrix, values, and coefficients (for debug purposes only)
 int size()
          Returns the size of this CurveFit
 java.lang.String toString()
          Gets a String representation of this instance
 java.lang.StringBuffer toString(java.lang.StringBuffer sb, java.lang.String fmt)
          Gets a String representation of this instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROP_CurveFit_defaultPrecision

public static final java.lang.String PROP_CurveFit_defaultPrecision
See Also:
Constant Field Values

XY

protected XYPair[] XY

minXY

protected XYPair minXY

maxXY

protected XYPair maxXY

precision

protected CurveFit.Precision precision

dblCoeff

protected double[] dblCoeff

bigCoeff

protected java.math.BigDecimal[] bigCoeff

bdMathCtx

protected java.math.MathContext bdMathCtx

ARG_POINTS

public static final java.lang.String[] ARG_POINTS

ARG_VALUE

public static final java.lang.String[] ARG_VALUE

ARG_PRECISION

public static final java.lang.String[] ARG_PRECISION
Constructor Detail

CurveFit

protected CurveFit()
Protected constructor. Only allowed for subclasses


CurveFit

public CurveFit(CurveFit cf)
Clone constructor (deep copy)


CurveFit

public CurveFit(XYPair[] xy)
XYPair constructor


CurveFit

public CurveFit(XYPair[] xy,
                CurveFit.Precision P)
XYPair constructor


CurveFit

public CurveFit(java.lang.String xyListStr)
String constructor


CurveFit

public CurveFit(java.lang.String xyListStr,
                CurveFit.Precision P)
String constructor

Method Detail

GetDefaultPrecision

public static CurveFit.Precision GetDefaultPrecision(int pointSize)
Gets the default precision type


GetPrecisionByName

public static CurveFit.Precision GetPrecisionByName(java.lang.String name,
                                                    CurveFit.Precision dft)
Parses the specified precision type string


ParseXYPair

public static XYPair[] ParseXYPair(java.lang.String xyListStr)
Parse XY pair list. Leading/Trailing list characters (..) or [..], are optional. Does not reutrn null.


ParseXYPair

public static XYPair[] ParseXYPair(java.lang.String xyListStr,
                                   int fromNdx)
Parse XY pair list. Leading/Trailing list characters (..) or [..], are required. Does not reutrn null.


_CalculateCoefficients

protected static double[] _CalculateCoefficients(double[][] M,
                                                 double[] V)
Calculates the polynomial coefficients as "double" values


_CalculateCoefficients

protected static java.math.BigDecimal[] _CalculateCoefficients(java.math.BigDecimal[][] M,
                                                               java.math.BigDecimal[] V,
                                                               java.math.MathContext mc)
Calculates the polynomial coefficients as "BigDecimal" values


isValid

public boolean isValid()
Returns true if this CurveFit is valid


isValid

public static boolean isValid(CurveFit cf)
Returns true if the specified CurveFit is valid


getMinimumX

public double getMinimumX()
Gets the minimum "X" value


getMaximumX

public double getMaximumX()
Gets the maximum "X" value


getRangeX

public double getRangeX()
Gets the range of X


size

public int size()
Returns the size of this CurveFit


FTN

public double FTN(double X)
Returns the value of Y based on the specified value for X. This function is valid only over the range specified by the originally specified set of points. Values of X less than the minimum range will return the minimum value for Y, ans X value greater than the maximum range will return the maximum X value for Y.


toString

public java.lang.String toString()
Gets a String representation of this instance

Overrides:
toString in class java.lang.Object

toString

public java.lang.StringBuffer toString(java.lang.StringBuffer sb,
                                       java.lang.String fmt)
Gets a String representation of this instance


print

public void print(java.lang.String msg,
                  double[][] M,
                  double[] V)
(Debug) Prints the matrix, values, and coefficients (for debug purposes only)


main

public static void main(java.lang.String[] argv)