Package hec.io

Class PairedDataContainer

java.lang.Object
hec.io.DataContainer
hec.io.PairedDataContainer
All Implemented Interfaces:
IVerticalDatumOperations<PairedDataContainer,mil.army.usace.hec.metadata.VerticalDatumException>, Serializable, Cloneable
Direct Known Subclasses:
PairedDataContainerVertDatum

public class PairedDataContainer extends DataContainer implements Cloneable, Serializable, IVerticalDatumOperations<PairedDataContainer,mil.army.usace.hec.metadata.VerticalDatumException>
This is a simple generic container class that holds paired data, and some related information The purpose of this class is to pass paired data to plot and tabulate functions. The class does not know where the data came from (or is going). It does not contain any reference or connection to any database. Note, the base class has data stored as floats. If you want data to be stored as doubles, you need to set the flag public boolean storedAsdoubles to true
See Also:
  • Field Details

    • NORMAL_WRITE

      public static final int NORMAL_WRITE
      normal write. fill in the xOrdinates and the yOrdinates and other fields and write the record.
      See Also:
    • ALLOCATE

      public static final int ALLOCATE
      allocate and write the X axis, type, units etc. everything but the y curves. The total number of y ordinates and curves must be specified at this time so that the correct amount of space can be allocated. If labels are used, set the labelsUsed to true and pass in the longest label (or some string) so that the label space can be allocated also.
      See Also:
    • CURVE_WRITE

      public static final int CURVE_WRITE
      to write individual curve, set the first yOrdinates array to the curve values and the curve number in numberCurves. Pass the label in as as the first label in the labels array. Set the writeMethod to CURVE_WRITE. The number of values and double or float must be the same as the original curve.
      See Also:
    • xOrdinates

      public double[] xOrdinates
    • yOrdinates

      public double[][] yOrdinates
    • curveVisible

      public boolean[] curveVisible
    • numberCurves

      public int numberCurves
    • numberOrdinates

      public int numberOrdinates
    • startingCurve

      public int startingCurve
    • endingCurve

      public int endingCurve
    • startingOrdinate

      public int startingOrdinate
    • endingOrdinate

      public int endingOrdinate
    • labels

      public String[] labels
    • labelsUsed

      public boolean labelsUsed
    • xunits

      public String xunits
    • yunits

      public String yunits
    • xtype

      public String xtype
    • ytype

      public String ytype
    • units

      public String[] units
    • types

      public String[] types
    • parameters

      public String[] parameters
    • precisions

      public int[] precisions
    • xprecision

      public int xprecision
    • yprecision

      public int yprecision
    • switchXyAxis

      public boolean switchXyAxis
    • writeMethod

      public int writeMethod
      one of NORMAL_WRITE (default), ALLOCATE, or CURVE_WRITE
    • xparameter

      public String xparameter
    • yparameter

      public String yparameter
    • other

      public String other
      the d part
    • date

      public String date
      the e part
    • datum

      public double datum
    • shift

      public double shift
    • offset

      public double offset
    • transformType

      public int transformType
  • Constructor Details

    • PairedDataContainer

      public PairedDataContainer()
      construct a new empty PairedDataContainer
  • Method Details

    • setValues

      public void setValues(double[] xOrdinates, double[][] yOrdinates)
    • setNumberOrdinates

      public void setNumberOrdinates(int numberOrdinates)
      set the number of ordinates for the PairedDataContainer. this will not set the X or Y values array sizes
      Parameters:
      numberOrdinates - the number of X values and also the length of each of the Y values arrays
    • setNumberCurves

      public void setNumberCurves(int numberCurves)
      sets the number of Y value curves (length of the Y value array). this method does not change the size of the Y value curves array
      Parameters:
      numberCurves - the number of Y value curves
    • getNumberCurves

      public int getNumberCurves()
      get the number of Y Value curves.
      Returns:
      the number of Y value curves
    • getNumberOrdinates

      public int getNumberOrdinates()
      get the number of X/Y value pairs....the length of the X value array and the length of each Y value curve
      Returns:
    • getXOridnates

      public double[] getXOridnates()
      get the X values
      Returns:
      the X values
    • getYOridnates

      public double[][] getYOridnates()
      get the Y values
      Returns:
      the Y values
    • setXUnits

      public void setXUnits(String Xunits)
      set the units for the X values
      Parameters:
      Xunits - the X value units
    • setXType

      public void setXType(String Xtype)
      set the type for the X values
      Parameters:
      Xtype - the X type
    • setYUnits

      public void setYUnits(String Yunits)
      set the units for the Y values
      Parameters:
      Yunits - the Y Units
    • setYType

      public void setYType(String Ytype)
      set the type for the Y values
      Parameters:
      Ytype - the Y type
    • getXUnits

      public String getXUnits()
      get the units for the X values
      Returns:
      the X Units
    • getXType

      public String getXType()
      get the type for the X values
      Returns:
      the X type
    • getYUnits

      public String getYUnits()
      get the units for the Y values
      Returns:
      the Y Units
    • getYType

      public String getYType()
      get the type for the Y values
      Returns:
      the Y type
    • setLabels

      public void setLabels(String[] labels)
      set the labels for the curves. the label length should match the number of curves.
      Parameters:
      labels - the new labels.
    • getLabels

      public String[] getLabels()
      get the labels for the curves
      Returns:
      the curve labels or null if the labels aren't used or set
    • allocateSpace

      public void allocateSpace(double[] xOrdinates, int numberCurves)
      set the number of xOrdinates, also need to set the Y arrays.
      Parameters:
      xOrdinates -
      numberCurves -
    • setXOrdinates

      public void setXOrdinates(double[] xOrdinates)
      set the X values. the new XOrdinates length should match the numberOrdindates if its already set or setNumberOrdinates() should also be called.
      Parameters:
      xOrdinates - the new xOrdinates
    • setYOrdinates

      public void setYOrdinates(double[][] yOrdinates)
      set the Y values. the new yOrdinates length should match the numberCurves if its set or setNumberCurves() should be also be called. the length of each yOrdinates memeber should be the same and match numberOrdinates or setNumberOrdinates() should also be called.
      Parameters:
      yOrdinates - the new Y values
    • setStartingEndingCurve

      public void setStartingEndingCurve(int startingCurve, int endingCurve)
      set the starting and ending curves
      Parameters:
      startingCurve - the first curve
      endingCurve - the last curve
    • setStartingEndingOrdinage

      public void setStartingEndingOrdinage(int startingOrdinate, int endingOrdinate)
      set the starting and ending ordinates
      Parameters:
      startingOrdinate - the first ordinate to use
      endingOrdinate - the last ordinate to use
    • getStartingCurve

      public int getStartingCurve()
      get the starting curve index
      Returns:
      the ending curve
    • getEndingCurve

      public int getEndingCurve()
      get the ending curve index
      Returns:
      the starting curve
    • getStartingOrdinate

      public int getStartingOrdinate()
      get the starting ordinate index
      Returns:
      the ending ordinate
    • getEndingOrdinate

      public int getEndingOrdinate()
      get the ending ordinate index
      Returns:
      the starting ordinate
    • clone

      public void clone(PairedDataContainer pdc)
      copy this PairedDataContainer into pdc
      Parameters:
      pdc - the PairedDataContainer to copy into
    • clone

      public Object clone()
      create a copy of this PairedDataContainer
      Overrides:
      clone in class Object
      Returns:
      a copy of this PairedDataContainer
    • getAsString

      public String getAsString()
      get the PairedDataContainer as a newline (\n) separated string
      Returns:
      the String representation of the PairedDataContainer
    • getAsXML

      public String getAsXML()
      get the PairedDataContainer as a XML formatted String
      Returns:
      the XML String representation of the PairedDataContainer
    • ensureXOrdCapacity

      public static void ensureXOrdCapacity(PairedDataContainer pdc, int minimumCapacity)
      ensure that the pdc X ordinates are at least minimumCapacity in size
      Parameters:
      pdc - the the PairedDataContainer
      minimumCapacity - the minimum size for the X ordinate array
    • getXOrdCapacity

      public static int getXOrdCapacity(PairedDataContainer pdc)
      the X ordinate capacity for the PairedDataContainer
      Parameters:
      pdc - the PairedDataContainer
      Returns:
      the X ordinate capacity
    • enlargeXOrds

      public static void enlargeXOrds(PairedDataContainer pdc, int minimumCapacity)
      enlarge the X ordinate array to minimumCapacity
      Parameters:
      pdc - the PairedDataContainer J
      minimumCapacity - the new minium X ordinate size
    • ensureCurvesCapacity

      public static void ensureCurvesCapacity(PairedDataContainer pdc, int minimumCapacity)
      ensure that the pdc curves are at least minimumCapacity in size
      Parameters:
      pdc - the the PairedDataContainer
      minimumCapacity - the minimum size for the Y value curves
    • ensureCurveCapacity

      public static void ensureCurveCapacity(PairedDataContainer pdc, int curveIndex, int minimumCapacity)
      enlarge the Y curves to minimumCapacity
      Parameters:
      pdc - the PairedDataContainer J
      minimumCapacity - the new minium Y curve size
    • getCurveCapacity

      public static int getCurveCapacity(PairedDataContainer pdc, int curveIndex)
      the Y curve capacity for the PairedDataContainer
      Parameters:
      pdc - the PairedDataContainer
      Returns:
      the Y curve number
    • curveExists

      public static boolean curveExists(PairedDataContainer pdcFrom, int fromIndex)
      check to see if curve number fromIndex exists
      Parameters:
      pdcFrom - the PairedDataContainer
      fromIndex - the index (0 based) of the curve to check on
      Returns:
    • ensureCurveExists

      public static void ensureCurveExists(PairedDataContainer pdc, int curveIndex)
      ensure that the curve number curveIndex exists
      Parameters:
      pdc - the PairedDataContainer
      curveIndex - the index (0 based) of the curve to check on
    • guessLabelTemplate

      public static String guessLabelTemplate(PairedDataContainer pdc, int curveIndex)
    • ensureLabelsCapacity

      public static void ensureLabelsCapacity(PairedDataContainer pdc, int curveIndex)
      ensure that the label number curveIndex exists
      Parameters:
      pdc - the PairedDataContainer
      curveIndex - the index (0 based) of the label to check on
    • enlargeCurve

      public static void enlargeCurve(PairedDataContainer pdc, int curveIndex, int minimumCapacity)
      enlarge the Y data curve specified by curveIndex to be at least minimumCapacity
      Parameters:
      pdc - the PairedDataContainer
      curveIndex - the curve index (0 based) to ensure the capacity on
      minimumCapacity - the minimum capacity of the Y data curve
    • copyCurve

      public static void copyCurve(PairedDataContainer pdcFrom, int fromIndex, PairedDataContainer pdcTo, int toIndex)
      copy the fromIndex curve from pdcFrom to pdcTo's curve toIndex
      Parameters:
      pdcFrom - the source PairedDataContainer
      fromIndex - the source curve index (0 based)
      pdcTo - the destination PairedDataContainer
      toIndex - the destination curve index (0 based)
    • copyCurves

      public static void copyCurves(PairedDataContainer pdcFrom, PairedDataContainer pdcTo)
      copy all the curve's from pdcFrom to pdcTo
      Parameters:
      pdcFrom - the source PairedDataContainer
      pdcTo - the destination PairedDataContainer
    • copyXOrdinates

      public static void copyXOrdinates(PairedDataContainer pdcFrom, PairedDataContainer pdcTo)
      copy the X ordinates from pdcFrom to pdcTo
      Parameters:
      pdcFrom - the source PairedDataContainer
      pdcTo - the destination PairedDataContainer
    • copyLabels

      public static void copyLabels(PairedDataContainer pdcFrom, PairedDataContainer pdcTo)
      copy the curve labels from pdcFrom to pdcTo
      Parameters:
      pdcFrom - the source PairedDataContainer
      pdcTo - the destination PairedDataContainer
    • expandVerticalDatum

      public PairedDataContainer expandVerticalDatum()
      Returns a new PairedDataContainerVertDatum object constructed from this object and the vertical datum info in the supplementalInfo field of this object. The vertical datum info is removed from the supplementalInfo field of the new object.
      Specified by:
      expandVerticalDatum in interface IVerticalDatumOperations<PairedDataContainer,mil.army.usace.hec.metadata.VerticalDatumException>
      Returns:
      Either the new object as described above or a clone of this object. In either case this object is not modified. A clone of this object is returned if it is already a PairedDataContainerVertDatum object, if the supplementalInfo field doesn't contain vertical datum information, or if an error occurs during the operation.
    • collapseVerticalDatum

      public PairedDataContainer collapseVerticalDatum()
      Returns a new PairedDataContainer object constructed from this object, with the TimeSeiresContainerVertDatum.vdc field collapsed into vertical datum info in the supplementalInfo field (overwriting any existing vertical datum info there)
      Specified by:
      collapseVerticalDatum in interface IVerticalDatumOperations<PairedDataContainer,mil.army.usace.hec.metadata.VerticalDatumException>
      Returns:
      Either the new object as described above or this object. In either case this object is not modified. This object is returned if it is not a PairedDataContainerVertDatum object or an exception occurs during the operation.
    • printToConsole

      public void printToConsole()
      prints values from this PairedDataContainer to the console.