org.opensha.commons.data.function
Class ArbDiscrFuncWithParams

java.lang.Object
  extended by org.opensha.commons.data.function.AbstractXY_DataSet
      extended by org.opensha.commons.data.function.AbstractDiscretizedFunc
          extended by org.opensha.commons.data.function.ArbitrarilyDiscretizedFunc
              extended by org.opensha.commons.data.function.ArbDiscrFuncWithParams
All Implemented Interfaces:
Serializable, Iterable<Point2D>, DiscretizedFunc, FuncWithParams, XY_DataSet, Named, PlotElement, XMLSaveable

public class ArbDiscrFuncWithParams
extends ArbitrarilyDiscretizedFunc
implements FuncWithParams

Title: ArbDiscrFuncWithParams

Description: Subclass of the ArbitrarlyDiscretizedFunc that also includes a ParameterList of paramters associated with the function. Not much different that parent class but provides methods for dealing with the parameter list and overides such methods as toString(), equals(), etc. These extra methods are put in an interface FuncWithParamsAPI. Therefore this class implements that interface as well as the DiscretizedFuncAPI.

This function implements FuncWithParamsAPI so it maintains a ParameterList internally. These parameters are the values of the input variables that went into calculating this function.

Version:
1.0
Author:
Steven W. Rock
See Also:
DiscretizedFunction2D, XYDiscretizedFunction2DAPI, DiscretizedFunction2DAPI, ParameterList, Serialized Form

Field Summary
protected  ParameterList list
          This parameter list is the set of parameters that went into calculation this DiscretizedFunction.
 
Fields inherited from class org.opensha.commons.data.function.ArbitrarilyDiscretizedFunc
C, D, points
 
Fields inherited from class org.opensha.commons.data.function.AbstractDiscretizedFunc
tolerance, XML_METADATA_NAME, XML_METADATA_POINT_NAME, XML_METADATA_POINTS_NAME
 
Fields inherited from class org.opensha.commons.data.function.AbstractXY_DataSet
info, name, xAxisName, yAxisName
 
Constructor Summary
ArbDiscrFuncWithParams()
          basic No-Arg constructor
ArbDiscrFuncWithParams(ParameterList list)
          Sets all values for this special type of DiscretizedFunction
ArbDiscrFuncWithParams(Point2DComparator comparator)
          The passed in comparator must be an implementor of DataPoint2DComparatorAPI.
 
Method Summary
 ArbDiscrFuncWithParams deepClone()
          This function returns a new copy of this list, including copies of all the points.
 boolean equalParameterNames(FuncWithParams function)
          Returns true if the second function has the same named parameters in it's list, values may be different
 boolean equalParameterNamesAndValues(FuncWithParams function)
          Returns true if the second function has the same named parameter values.
 boolean equalParameters(FuncWithParams function)
          Determines if two functions are the same with respect to the parameters that were used to calculate the function, NOT THAT EACH POINT IS THE SAME.
 String getInfo()
          Returns the info of this function.
 ParameterList getParameterList()
          This parameter list is the set of parameters that went into calculation this DiscretizedFunction.
 String getParametersString()
          Returns name/value pairs, separated with commas, as one string, usefule for legends, etc.
 void setParameterList(ParameterList list)
          Set the parameter list from an external source
 
Methods inherited from class org.opensha.commons.data.function.ArbitrarilyDiscretizedFunc
clear, equalXValues, get, getFirstInterpolatedX_inLogXLogYDomain, getFirstInterpolatedX, getIndex, getInterpExterpY_inLogYDomain, getInterpolatedY_inLogXLogYDomain, getInterpolatedY_inLogYDomain, getInterpolatedY, getMaxX, getMaxY, getMetadataString, getMinX, getMinY, getNum, getPointsIterator, getX, getXIndex, getXVals, getY, getY, getYVals, getYY_Function, hasPoint, hasPoint, iterator, main, set, set, set, setTolerance, toDebugString, toString
 
Methods inherited from class org.opensha.commons.data.function.AbstractDiscretizedFunc
calcSumOfY_Vals, equals, fromXMLMetadata, getTolerance, loadFuncFromSimpleFile, loadFuncFromSimpleFile, scale, toXMLMetadata, toXMLMetadata, writeSimpleFuncFile, writeSimpleFuncFile
 
Methods inherited from class org.opensha.commons.data.function.AbstractXY_DataSet
areAllXValuesInteger, getClosestX, getClosestY, getDatasetsToPlot, getName, getPlotNumColorList, getXAxisName, getXValuesIterator, getYAxisName, getYValuesIterator, setInfo, setName, setXAxisName, setYAxisName, xValues, yValues
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.opensha.commons.data.function.XY_DataSet
areAllXValuesInteger, getClosestX, getClosestY, getXAxisName, getXValuesIterator, getYAxisName, getYValuesIterator, setInfo, setName, setXAxisName, setYAxisName, xValues, yValues
 
Methods inherited from interface org.opensha.commons.gui.plot.PlotElement
getDatasetsToPlot, getPlotNumColorList
 
Methods inherited from interface org.opensha.commons.data.Named
getName
 

Field Detail

list

protected ParameterList list
This parameter list is the set of parameters that went into calculation this DiscretizedFunction. Useful for determining if two data sets are the same, i.e. have the same x/y axis and the same set of independent parameters. Bypasses the more numerically intensive task of comparing each Point2D of two DiscretizedFunction2D.

Constructor Detail

ArbDiscrFuncWithParams

public ArbDiscrFuncWithParams(Point2DComparator comparator)
The passed in comparator must be an implementor of DataPoint2DComparatorAPI. These comparators know they are dealing with a Point2D and usually only compare the x-values for sorting. Special comparators may wish to sort on both the x and y values, i.e. the data points are geographical locations.


ArbDiscrFuncWithParams

public ArbDiscrFuncWithParams()
basic No-Arg constructor


ArbDiscrFuncWithParams

public ArbDiscrFuncWithParams(ParameterList list)
Sets all values for this special type of DiscretizedFunction

Method Detail

getInfo

public String getInfo()
Returns the info of this function. This subclass proxys this method to the lsit by returning list.toString(). THis is useful for plot legends, comparisions, etc. These field getters and setters provide the basic information to describe a function. All functions have a name, information string, and a tolerance level that specifies how close two points have to be along the x axis to be considered equal.

Specified by:
getInfo in interface XY_DataSet
Specified by:
getInfo in interface PlotElement
Overrides:
getInfo in class AbstractXY_DataSet
Returns:

getParameterList

public ParameterList getParameterList()
This parameter list is the set of parameters that went into calculation this DiscretizedFunction. Useful for determining if two data sets are the same, i.e. have the same x/y axis and the same set of independent parameters. Bypasses the more numerically intensive task of comparing each Point2D of two DiscretizedFunction2D.

Specified by:
getParameterList in interface FuncWithParams

setParameterList

public void setParameterList(ParameterList list)
Set the parameter list from an external source

Specified by:
setParameterList in interface FuncWithParams

getParametersString

public String getParametersString()
Returns name/value pairs, separated with commas, as one string, usefule for legends, etc.

Specified by:
getParametersString in interface FuncWithParams

equalParameterNamesAndValues

public boolean equalParameterNamesAndValues(FuncWithParams function)
Returns true if the second function has the same named parameter values. One current use is to determine if two XYDiscretizedFunction2DAPIs are the same.

Specified by:
equalParameterNamesAndValues in interface FuncWithParams

equalParameterNames

public boolean equalParameterNames(FuncWithParams function)
Returns true if the second function has the same named parameters in it's list, values may be different

Specified by:
equalParameterNames in interface FuncWithParams

deepClone

public ArbDiscrFuncWithParams deepClone()
This function returns a new copy of this list, including copies of all the points. Paramters are also cloned.

A shallow clone would only create a new DiscretizedFunc instance, but would maintain a reference to the original points.

Since this is a clone, you can modify it without changing the original.

Specified by:
deepClone in interface DiscretizedFunc
Specified by:
deepClone in interface XY_DataSet
Overrides:
deepClone in class ArbitrarilyDiscretizedFunc
Returns:

equalParameters

public boolean equalParameters(FuncWithParams function)
Determines if two functions are the same with respect to the parameters that were used to calculate the function, NOT THAT EACH POINT IS THE SAME. This is used by the DiscretizedFunction2DAPIList to determine if it should add a new function to the list.