org.opengts.util
Class XYPair

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

public class XYPair
extends java.lang.Object

Container for an X/Y pair.
Used by CurveFit as a point container.


Field Summary
protected  boolean isValid
           
protected  double X
           
protected  double Y
           
 
Constructor Summary
XYPair(double x, double y)
          X/Y Constructor
XYPair(java.lang.String xyStr)
          String Constructor
XYPair(XYPair xyPair)
          Copy Constructor
 
Method Summary
static XYPair Copy(XYPair xy)
          Returns a deep copy of the specified XYPair instance
static XYPair[] CreateList(double[][] xyList)
          Returns a deep copy of the specified XYPair list
static XYPair[] CreateList(XYPair[] xyPair)
          Returns a deep copy of the specified XYPair list
static double GetMaximumX(XYPair[] xyPair)
          Minimum value for X in the specified list
static double GetMinimumX(XYPair[] xyPair)
          Minimum value for X in the specified list
static double GetRangeX(XYPair[] xyPair)
          Range of X in the specified list
 double getX()
          Gets the value for X
 double getY()
          Gets the value for Y
static int IndexOfListEndChar(java.lang.String xyListStr, int fromNdx)
          Gets the index of the end-of-list character
static int IndexOfListStartChar(java.lang.String xyListStr, int fromNdx)
          Gets the index of the start-of-list character
static boolean IsSortedByX(XYPair[] xyPair, boolean dupOK)
          Returns true if the list is sorted by X in ascending order, with no duplicates
 boolean isValid()
          Returns true if 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.
static XYPair[] SortByX(XYPair[] xyPair)
          Sorts the XYPair list by the X value
static boolean startsWithListChar(java.lang.String xyListStr)
          Returns true if the specified list starts with a XYPair list character
static java.lang.String ToListString(XYPair[] xyList)
          Returns a properly formatted XYPair list String
static java.lang.StringBuffer ToListString(XYPair[] xyList, java.lang.StringBuffer sb)
          Appends a properly formatted XYPair list to the specified StringBuffer
 java.lang.String toString()
          Returns a String representation of this instance
 java.lang.StringBuffer toString(java.lang.StringBuffer sb)
          Appends a String representation of this instance to the specified StringBuffer
 double X()
          Gets the value for X
 double Y()
          Gets the value for Y
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

X

protected double X

Y

protected double Y

isValid

protected boolean isValid
Constructor Detail

XYPair

public XYPair(XYPair xyPair)
Copy Constructor


XYPair

public XYPair(double x,
              double y)
X/Y Constructor


XYPair

public XYPair(java.lang.String xyStr)
String Constructor

Method Detail

IndexOfListStartChar

public static int IndexOfListStartChar(java.lang.String xyListStr,
                                       int fromNdx)
Gets the index of the start-of-list character


IndexOfListEndChar

public static int IndexOfListEndChar(java.lang.String xyListStr,
                                     int fromNdx)
Gets the index of the end-of-list character


startsWithListChar

public static boolean startsWithListChar(java.lang.String xyListStr)
Returns true if the specified list starts with a XYPair list character


ParseXYPair

public static XYPair[] ParseXYPair(java.lang.String xyListStr)
Parse XY pair list. Leading/Trailing list characters (..) or [..], are optional. Does not return 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 return null.


Copy

public static XYPair Copy(XYPair xy)
Returns a deep copy of the specified XYPair instance


CreateList

public static XYPair[] CreateList(XYPair[] xyPair)
Returns a deep copy of the specified XYPair list


CreateList

public static XYPair[] CreateList(double[][] xyList)
Returns a deep copy of the specified XYPair list


IsSortedByX

public static boolean IsSortedByX(XYPair[] xyPair,
                                  boolean dupOK)
Returns true if the list is sorted by X in ascending order, with no duplicates

Parameters:
xyPair - An array of XYPair's
dupOK - True to allow duplicate X entries

SortByX

public static XYPair[] SortByX(XYPair[] xyPair)
Sorts the XYPair list by the X value


GetMinimumX

public static double GetMinimumX(XYPair[] xyPair)
Minimum value for X in the specified list


GetMaximumX

public static double GetMaximumX(XYPair[] xyPair)
Minimum value for X in the specified list


GetRangeX

public static double GetRangeX(XYPair[] xyPair)
Range of X in the specified list


isValid

public boolean isValid()
Returns true if valid.


getX

public double getX()
Gets the value for X


X

public double X()
Gets the value for X


getY

public double getY()
Gets the value for Y


Y

public double Y()
Gets the value for Y


toString

public java.lang.StringBuffer toString(java.lang.StringBuffer sb)
Appends a String representation of this instance to the specified StringBuffer


toString

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

Overrides:
toString in class java.lang.Object

ToListString

public static java.lang.StringBuffer ToListString(XYPair[] xyList,
                                                  java.lang.StringBuffer sb)
Appends a properly formatted XYPair list to the specified StringBuffer


ToListString

public static java.lang.String ToListString(XYPair[] xyList)
Returns a properly formatted XYPair list String


main

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