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:
-
Nested Class Summary
Nested classes/interfaces inherited from class hec.io.DataContainer
DataContainer.VERTICAL_DATUM, DataContainer.VERTICAL_UNITS
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
allocate and write the X axis, type, units etc.static final int
to write individual curve, set the firstyOrdinates
array to the curve values and the curve number innumberCurves
.boolean[]
the e partdouble
int
int
String[]
boolean
static final int
normal write.int
int
double
the d partString[]
int[]
double
int
int
boolean
int
String[]
String[]
int
one ofNORMAL_WRITE
(default),ALLOCATE
, orCURVE_WRITE
double[]
int
double[][]
int
Fields inherited from class hec.io.DataContainer
coordinateID, coordinateSystem, CURRENT_VERTICAL_DATUM_HEADER, CURRENT_VERTICAL_DATUM_KEY, dataType, fileLastWriteTimeMillis, fileName, fullName, horizontalDatum, horizontalUnits, lastWriteTimeMillis, location, locationTimezone, modified, otherInfo, storedAsdoubles, subVersion, supplementalInfo, version, VERTICAL_DATUM_INFO_HEADER, VERTICAL_DATUM_INFO_KEY, verticalDatum, verticalUnits, watershed, xOrdinate, yOrdinate, zOrdinate
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
allocateSpace
(double[] xOrdinates, int numberCurves) set the number of xOrdinates, also need to set the Y arrays.clone()
create a copy of this PairedDataContainervoid
clone
(PairedDataContainer pdc) copy this PairedDataContainer into pdcReturns 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)static void
copyCurve
(PairedDataContainer pdcFrom, int fromIndex, PairedDataContainer pdcTo, int toIndex) copy the fromIndex curve from pdcFrom to pdcTo's curve toIndexstatic void
copyCurves
(PairedDataContainer pdcFrom, PairedDataContainer pdcTo) copy all the curve's from pdcFrom to pdcTostatic void
copyLabels
(PairedDataContainer pdcFrom, PairedDataContainer pdcTo) copy the curve labels from pdcFrom to pdcTostatic void
copyXOrdinates
(PairedDataContainer pdcFrom, PairedDataContainer pdcTo) copy the X ordinates from pdcFrom to pdcTostatic boolean
curveExists
(PairedDataContainer pdcFrom, int fromIndex) check to see if curve number fromIndex existsstatic void
enlargeCurve
(PairedDataContainer pdc, int curveIndex, int minimumCapacity) enlarge the Y data curve specified by curveIndex to be at least minimumCapacitystatic void
enlargeXOrds
(PairedDataContainer pdc, int minimumCapacity) enlarge the X ordinate array to minimumCapacitystatic void
ensureCurveCapacity
(PairedDataContainer pdc, int curveIndex, int minimumCapacity) enlarge the Y curves to minimumCapacitystatic void
ensureCurveExists
(PairedDataContainer pdc, int curveIndex) ensure that the curve number curveIndex existsstatic void
ensureCurvesCapacity
(PairedDataContainer pdc, int minimumCapacity) ensure that the pdc curves are at least minimumCapacity in sizestatic void
ensureLabelsCapacity
(PairedDataContainer pdc, int curveIndex) ensure that the label number curveIndex existsstatic void
ensureXOrdCapacity
(PairedDataContainer pdc, int minimumCapacity) ensure that the pdc X ordinates are at least minimumCapacity in sizeReturns a new PairedDataContainerVertDatum object constructed from this object and the vertical datum info in the supplementalInfo field of this object.get the PairedDataContainer as a newline (\n) separated stringgetAsXML()
get the PairedDataContainer as a XML formatted Stringstatic int
getCurveCapacity
(PairedDataContainer pdc, int curveIndex) the Y curve capacity for the PairedDataContainerint
get the ending curve indexint
get the ending ordinate indexString[]
get the labels for the curvesint
get the number of Y Value curves.int
get the number of X/Y value pairs....the length of the X value array and the length of each Y value curveint
get the starting curve indexint
get the starting ordinate indexstatic int
the X ordinate capacity for the PairedDataContainerdouble[]
get the X valuesgetXType()
get the type for the X valuesget the units for the X valuesdouble[][]
get the Y valuesgetYType()
get the type for the Y valuesget the units for the Y valuesstatic String
guessLabelTemplate
(PairedDataContainer pdc, int curveIndex) void
prints values from this PairedDataContainer to the console.void
set the labels for the curves.void
setNumberCurves
(int numberCurves) sets the number of Y value curves (length of the Y value array).void
setNumberOrdinates
(int numberOrdinates) set the number of ordinates for the PairedDataContainer.void
setStartingEndingCurve
(int startingCurve, int endingCurve) set the starting and ending curvesvoid
setStartingEndingOrdinage
(int startingOrdinate, int endingOrdinate) set the starting and ending ordinatesvoid
setValues
(double[] xOrdinates, double[][] yOrdinates) void
setXOrdinates
(double[] xOrdinates) set the X values.void
set the type for the X valuesvoid
set the units for the X valuesvoid
setYOrdinates
(double[][] yOrdinates) set the Y values.void
set the type for the Y valuesvoid
set the units for the Y valuesMethods inherited from class hec.io.DataContainer
clone, extractVerticalDatum, getFullName, getHorizontalDatum, getLatLong, getName, getStoreAsDoubles, getSupplementalInfo, getVerticalDatum, getVerticalUnits, insertVerticalDatum, setFullName, setHorizontalDatum, setLatLong, setName, setStoreAsDoubles, setSupplementalInfo, setVerticalDatum, setVerticalDatum, setVerticalUnits, setVerticalUnits, toString
-
Field Details
-
NORMAL_WRITE
public static final int NORMAL_WRITEnormal write. fill in thexOrdinates
and theyOrdinates
and other fields and write the record.- See Also:
-
ALLOCATE
public static final int ALLOCATEallocate 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 thelabelsUsed
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_WRITEto write individual curve, set the firstyOrdinates
array to the curve values and the curve number innumberCurves
. Pass the label in as as the first label in the labels array. Set thewriteMethod
toCURVE_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
-
labelsUsed
public boolean labelsUsed -
xunits
-
yunits
-
xtype
-
ytype
-
units
-
types
-
parameters
-
precisions
public int[] precisions -
xprecision
public int xprecision -
yprecision
public int yprecision -
switchXyAxis
public boolean switchXyAxis -
writeMethod
public int writeMethodone ofNORMAL_WRITE
(default),ALLOCATE
, orCURVE_WRITE
-
xparameter
-
yparameter
-
other
the d part -
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
set the units for the X values- Parameters:
Xunits
- the X value units
-
setXType
set the type for the X values- Parameters:
Xtype
- the X type
-
setYUnits
set the units for the Y values- Parameters:
Yunits
- the Y Units
-
setYType
set the type for the Y values- Parameters:
Ytype
- the Y type
-
getXUnits
get the units for the X values- Returns:
- the X Units
-
getXType
get the type for the X values- Returns:
- the X type
-
getYUnits
get the units for the Y values- Returns:
- the Y Units
-
getYType
get the type for the Y values- Returns:
- the Y type
-
setLabels
set the labels for the curves. the label length should match the number of curves.- Parameters:
labels
- the new labels.
-
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 curveendingCurve
- the last curve
-
setStartingEndingOrdinage
public void setStartingEndingOrdinage(int startingOrdinate, int endingOrdinate) set the starting and ending ordinates- Parameters:
startingOrdinate
- the first ordinate to useendingOrdinate
- 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
copy this PairedDataContainer into pdc- Parameters:
pdc
- the PairedDataContainer to copy into
-
clone
create a copy of this PairedDataContainer -
getAsString
get the PairedDataContainer as a newline (\n) separated string- Returns:
- the String representation of the PairedDataContainer
-
getAsXML
get the PairedDataContainer as a XML formatted String- Returns:
- the XML String representation of the PairedDataContainer
-
ensureXOrdCapacity
ensure that the pdc X ordinates are at least minimumCapacity in size- Parameters:
pdc
- the the PairedDataContainerminimumCapacity
- the minimum size for the X ordinate array
-
getXOrdCapacity
the X ordinate capacity for the PairedDataContainer- Parameters:
pdc
- the PairedDataContainer- Returns:
- the X ordinate capacity
-
enlargeXOrds
enlarge the X ordinate array to minimumCapacity- Parameters:
pdc
- the PairedDataContainer JminimumCapacity
- the new minium X ordinate size
-
ensureCurvesCapacity
ensure that the pdc curves are at least minimumCapacity in size- Parameters:
pdc
- the the PairedDataContainerminimumCapacity
- 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 JminimumCapacity
- the new minium Y curve size
-
getCurveCapacity
the Y curve capacity for the PairedDataContainer- Parameters:
pdc
- the PairedDataContainer- Returns:
- the Y curve number
-
curveExists
check to see if curve number fromIndex exists- Parameters:
pdcFrom
- the PairedDataContainerfromIndex
- the index (0 based) of the curve to check on- Returns:
-
ensureCurveExists
ensure that the curve number curveIndex exists- Parameters:
pdc
- the PairedDataContainercurveIndex
- the index (0 based) of the curve to check on
-
guessLabelTemplate
-
ensureLabelsCapacity
ensure that the label number curveIndex exists- Parameters:
pdc
- the PairedDataContainercurveIndex
- the index (0 based) of the label to check on
-
enlargeCurve
enlarge the Y data curve specified by curveIndex to be at least minimumCapacity- Parameters:
pdc
- the PairedDataContainercurveIndex
- the curve index (0 based) to ensure the capacity onminimumCapacity
- 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 PairedDataContainerfromIndex
- the source curve index (0 based)pdcTo
- the destination PairedDataContainertoIndex
- the destination curve index (0 based)
-
copyCurves
copy all the curve's from pdcFrom to pdcTo- Parameters:
pdcFrom
- the source PairedDataContainerpdcTo
- the destination PairedDataContainer
-
copyXOrdinates
copy the X ordinates from pdcFrom to pdcTo- Parameters:
pdcFrom
- the source PairedDataContainerpdcTo
- the destination PairedDataContainer
-
copyLabels
copy the curve labels from pdcFrom to pdcTo- Parameters:
pdcFrom
- the source PairedDataContainerpdcTo
- the destination 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 interfaceIVerticalDatumOperations<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
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 interfaceIVerticalDatumOperations<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.
-