public class PairedValuesExt extends java.lang.Object implements AsciiSerializable, java.lang.Cloneable
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
INTERP_CUBIC |
static int |
INTERP_CUBIC_ID |
static java.lang.String |
INTERP_LINEAR |
static int |
INTERP_LINEAR_ID |
static java.lang.String |
INTERP_STEP |
static int |
INTERP_STEP_ID |
static java.lang.String[] |
INTERP_STRINGS |
| Constructor and Description |
|---|
PairedValuesExt()
create a new PairedValuesExt
|
| Modifier and Type | Method and Description |
|---|---|
void |
addPair(double xval,
double yval)
add an X and Y pair
|
void |
addPair(double xval,
double[] yval)
add an X value and Y values
|
boolean |
canInterpX()
return whether X interpolation can take place.
|
void |
clearValues()
clears all values
|
PairedValuesExt |
clone()
Implementation of the public clone interface
|
int |
findInterval(double xval)
find interval for interpolation
|
int |
findInterval(double[] array,
double val)
find interval for interpolation
|
PairedValues |
getCurve(int icurve)
return a PairedValues with y data from icurve
|
java.lang.String[] |
getCurveLabels()
get the curve labels
|
double[] |
getCurveLabelValues()
get the curve labels as double values
|
java.lang.String |
getData() |
java.util.Vector<ValueSet> |
getDataVector()
get the data Vector
|
DSSIdentifier |
getDssIdentifier() |
java.lang.Object |
getFieldObject(java.lang.reflect.Field fld)
required AsciiSerialized method.
|
int |
getInterpolationType()
return the interpolation type
|
double |
getLargestValue()
gets the largest value greater than zero from the y arrays
|
int |
getNumberCurves()
get the number of Y curves
|
int |
getNumY()
get the number of Y values
|
PairedDataContainer |
getPairedDataContainer()
Copy values, units, labels and parameters into a PairedDataContainer
|
int |
getParametersId(int icol)
get the parameter id for either X or Y values
|
int[] |
getParametersIds()
Returns an array the parameter ID's in the order of {XPARAMID, YPARAMID}.
|
int |
getParamXId()
get the X parameter id.
|
java.lang.String |
getParamXString()
get the parameter string (i.e.
|
java.lang.String |
getParamXUnitsString()
get the units string for the X parameter.
|
int |
getParamYId()
get the Y parameter id.
|
java.lang.String |
getParamYString()
get the parameter string (i.e.
|
java.lang.String |
getParamYUnitsString()
get the units string for the Y parameter.
|
int |
getParamZId()
parameter id for curves parameter
|
java.lang.String |
getParamZString()
get the parameter string for the Z parameter.
|
java.lang.String |
getParamZUnitsString()
get the units string for the Z parameter.
|
int |
getUnitSystem()
Returns the unit system that this data is defined in or hec.data.Units.UNDEF_ID if no unit system has been set
|
double[] |
getXArray()
get an array of the X Values
|
double |
getXValue(double yval)
get a single x value - given yvalue
|
double |
getXValue(int i)
get a single x value
|
void |
getXValue(int i,
hec.data.ParamDouble pd)
Gets an x value at location i.
|
double[] |
getYArray()
get an array of Y values from the first Y curve
implemented as
getYArray(0) |
double[] |
getYArray(int iset)
get an array of Y values from the Y curve iset.
|
double[][] |
getYData()
get the Y data array
|
double |
getYValue(double xval)
get a single y value - given xvalue
|
double |
getYValue(double xval,
int iset)
get a single y value - given xvalue
|
double |
getYValue(int i)
get the first y value in curve i
|
double |
getYValue(int i,
int iset)
get a single y value
|
void |
getYValue(int i,
int iset,
hec.data.ParamDouble pd)
get the iset Y value in curve i.
|
void |
getYValue(int i,
hec.data.ParamDouble pd)
Gets first Y value at location i.
|
boolean |
hasCurveLabels()
return whether the curve labels have been set.
|
void |
init()
initialize the PairedValueExt object.
|
void |
insertCurve(int index,
double value)
Inserts a curve into the array of curves, where each point on the curve has the same
value
|
double |
interpolate(double xval)
interpolate a value at the given time based on the default interpolation method
|
double |
interpolate(double xvalue,
double zvalue)
2-variable interpolation
|
double |
interpolate(double xval,
int iset)
interpolate a value at the given time based on the default interpolation method
|
double |
interpolateStepValue(double xval)
step interpolation, return Y for the given X value
implemented as
interpolate(xval, 0) |
double |
interpolateStepValue(double xval,
int iset)
step interpolation, return Y for the given X value
|
double |
interpolateValue(double xval)
linear interpolation, return y for given x value
implemented as
interpolateValue(xval,0) |
double |
interpolateValue(double xval,
int iset) |
double |
interpolateValueCubicSpline(double xval)
cubic spline interpolation.
|
double |
interpolateValueCubicSpline(double xval,
int iset)
cubic spline interpolation.
|
double |
interpolateY(double yval)
interpolate a value at the given time based on the default interpolation method
implemented as
interpolateY(yval,0) |
double |
interpolateY(double yval,
int iset)
interpolate a value at the given time based on the default interpolation method
|
boolean |
isXValueOutOfRange(double xval) |
boolean |
isZValueOutOfRange(double zval) |
void |
removeCurve(int index)
Removes an entire curve from the set of curves located at
|
void |
removePair(int i)
Removes a value pair at the given index
|
void |
setArrays(double[][] values)
fill the X and Y arrays with values
the array is expected to have the form
[x1][y1]
or
[x1][y11][y12]...
the Y arrays are expected to all be the same length. |
void |
setArrays(double[] xarray,
double[] yarray)
fill the X and Y arrays with values.
|
void |
setArrays(double[] xarray,
double[][] yarray)
fill the X and Y arrays with data.
|
void |
setCurveLabels(java.lang.String[] curveLabels)
set the curve labels
|
boolean |
setData(PairedDataContainer pdc)
Transfer data from the PairedDataContainer into the PairedValuesExt
|
int |
setData(java.lang.String values) |
void |
setDssIdentifier(DSSIdentifier dssId)
set the DSSIdentifier.
|
boolean |
setFieldObject(java.lang.reflect.Field fld,
java.lang.Object fobj)
required AsciiSerialized method.
|
void |
setInterpolationType(int type)
set the interpolation type to use.
|
void |
setNumY(int n) |
void |
setParamXId(int paramId)
set the X parameter ID.
|
void |
setParamYId(int paramId)
set the Y parameter ID.
|
void |
setParamZId(int paramId)
set the curves (Z) parameter ID.
|
void |
setUnitSystem(int us)
set the unit system.
|
int |
size()
Returns the number of data points in the list
|
java.lang.String |
toString()
return the String representation.
|
java.lang.String |
toTableForm(int precision) |
public static final java.lang.String INTERP_LINEAR
public static final java.lang.String INTERP_CUBIC
public static final java.lang.String INTERP_STEP
public static final int INTERP_LINEAR_ID
public static final int INTERP_CUBIC_ID
public static final int INTERP_STEP_ID
public static final java.lang.String[] INTERP_STRINGS
public PairedValuesExt()
public int getNumY()
public void setNumY(int n)
public DSSIdentifier getDssIdentifier()
public void setDssIdentifier(DSSIdentifier dssId)
dssId - public int getUnitSystem()
hec.data.Units.SI_ID,
hec.data.Units.ENGLISH_ID or if not set hec.data.Units.UNDEF_IDpublic int getParametersId(int icol)
icol - 0 for X parameter Id, anything else for Y parameter idpublic java.lang.String getParamXUnitsString()
public java.lang.String getParamYUnitsString()
public java.lang.String getParamXString()
public java.lang.String getParamYString()
public int[] getParametersIds()
public void setUnitSystem(int us)
hec.data.Units.SI_ID or hec.data.Units.ENGLISH_ID
the data is not converted on a change of unit systemus - one of hec.data.Units.SI_ID or hec.data.Units.ENGLISH_IDpublic void setParamXId(int paramId)
hec.data.Parameter
class. So the parameter for elevation is hec.data.Parameter.PARAMID_ELEVparamId - the X parameter id.public void setParamYId(int paramId)
hec.data.Parameter
class. So the parameter for flow is hec.data.Parameter.PARAMID_FLOWparamId - the Y parameter id.public int getParamXId()
Parameterpublic int getParamYId()
Parameterpublic int getParamZId()
Parameterpublic void setParamZId(int paramId)
hec.data.Parameter
class. So the parameter for flow is hec.data.Parameter.PARAMID_FLOWparamId - the Z parameter id.public java.lang.String getParamZString()
public int getNumberCurves()
public java.lang.String getParamZUnitsString()
public void removeCurve(int index)
index - the curve index to removepublic void insertCurve(int index,
double value)
index - the index to insert the curve atvalue - the value to insert into each curvepublic PairedValues getCurve(int icurve)
icurve - the curve number to return data forpublic void getXValue(int i,
hec.data.ParamDouble pd)
i - the X indexpd - the ParamDouble to fill data into. Can't be nullpublic void getYValue(int i,
hec.data.ParamDouble pd)
i - the first Y value in the curve ipd - the ParamDouble to fill data into. Can't be nullpublic void getYValue(int i,
int iset,
hec.data.ParamDouble pd)
i - iset - pd - the ParamDouble to fill data into. Can't be null.public double getXValue(int i)
i - the X index to get the value forpublic double getYValue(int i)
i - thepublic double getYValue(int i,
int iset)
i - iset - public double getXValue(double yval)
yval - public double getYValue(double xval)
xval - public double getYValue(double xval,
int iset)
xval - iset - public boolean isXValueOutOfRange(double xval)
public boolean isZValueOutOfRange(double zval)
public double interpolate(double xval)
xval - public double interpolate(double xval,
int iset)
xval - iset - public double interpolate(double xvalue,
double zvalue)
xvalue - zvalue - public double interpolateY(double yval)
interpolateY(yval,0)yval - the y valueinterpolateY(double, int)public double interpolateY(double yval,
int iset)
yval - the y valueiset - public double interpolateValue(double xval)
interpolateValue(xval,0)xval - the xvalueinterpolateValue(double, int)public double interpolateValue(double xval,
int iset)
public double interpolateStepValue(double xval)
interpolate(xval, 0)xval - the x valueinterpolateStepValue(double, int)public double interpolateStepValue(double xval,
int iset)
xval - the x valueiset - public double interpolateValueCubicSpline(double xval)
interpolateValueCubicSpline(xval,0)xval - the X valueinterpolateValueCubicSpline(double, int)public double interpolateValueCubicSpline(double xval,
int iset)
xval - the X valueiset - the Y curve to usepublic int findInterval(double xval)
public int findInterval(double[] array,
double val)
public void setInterpolationType(int type)
type - one of PairedValuesExt.INTERP_LINEAR_ID
PairedValuesExt.INTERP_CUBIC_ID PairedValuesExt.INTERP_STEP_IDpublic int getInterpolationType()
PairedValuesExt.INTERP_LINEAR_ID
PairedValuesExt.INTERP_CUBIC_ID PairedValuesExt.INTERP_STEP_IDpublic int size()
public void clearValues()
public void removePair(int i)
i - the index to remove the ValuePair atpublic java.lang.String toString()
toString in class java.lang.ObjectObject.toString()public java.lang.String toTableForm(int precision)
i - public void addPair(double xval,
double yval)
xval - the X valueyval - the Y valuepublic void addPair(double xval,
double[] yval)
xval - the X valueyval - the Y valuespublic void setArrays(double[] xarray,
double[] yarray)
xarray - the X arrayyarray - the Y arraypublic void setArrays(double[][] values)
[x1][y1]
[x2][y2]
[x3][y3]
[x4][y4]
[x5][y5]
[x1][y11][y12]...
[x2][y21][y22]...
[x3][y31][y32]...
[x4][y41][y42]...
[x5][y51][y52]...
the Y arrays are expected to all be the same length.
This method will also take a Jython tuple defined like so:
stageFlowRating=(
[0, 10],
[38., 3500],
[38.5,4180],
[39.,4900],
[39.5,5670],
[40.,6480],
[40.5,7320],
[41.,8200],
[41.5,9120],
[42.,10100],
[42.5,11000],
[43.,12100],
[43.5,13100],
[44,14200],
[44.5,15300],
[45.,16400],
[45.5,17500],
[46.,18700],
[46.5,19900],
[47.,21200])
values - the X and Y valuespublic void setArrays(double[] xarray,
double[][] yarray)
xarray - the X datayarray - the Y data.public java.util.Vector<ValueSet> getDataVector()
public PairedValuesExt clone()
clone in class java.lang.Objectpublic void init()
public double[] getXArray()
public double[] getYArray()
getYArray(0)public double[] getYArray(int iset)
iset - the Y curve numberpublic double[][] getYData()
public double getLargestValue()
public boolean canInterpX()
public boolean setData(PairedDataContainer pdc)
pdc - the PairedDataContainer to copy the data frompublic PairedDataContainer getPairedDataContainer()
public java.lang.String[] getCurveLabels()
public void setCurveLabels(java.lang.String[] curveLabels)
curveLabels - the new curve labelspublic boolean hasCurveLabels()
public double[] getCurveLabelValues()
public java.lang.String getData()
public int setData(java.lang.String values)
public java.lang.Object getFieldObject(java.lang.reflect.Field fld)
getFieldObject in interface FieldAccessorfld - The field to get.public boolean setFieldObject(java.lang.reflect.Field fld,
java.lang.Object fobj)
setFieldObject in interface FieldAccessorfld - The java field object representing the member field to be setfobj - The data to set in that field