Package de.gsi.math.functions
Class AbstractFunction
- java.lang.Object
-
- de.gsi.math.functions.AbstractFunction
-
- All Implemented Interfaces:
Function
- Direct Known Subclasses:
AbstractFunction1D,AbstractFunctionND,EllipseFunction
public abstract class AbstractFunction extends java.lang.Object implements Function
abstract class implementing a global function list and local function change listener interface- Author:
- rstein
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanfitterModeprotected double[]fparameterprotected double[]fparameterCopyprotected boolean[]fparameterFixedprotected double[]fparameterMaxprotected double[]fparameterMinprotected java.lang.String[]fparameterName
-
Constructor Summary
Constructors Constructor Description AbstractFunction(java.lang.String name, double... parameter)AbstractFunction(java.lang.String name, double[] parameters, java.lang.String... parameterNames)AbstractFunction(java.lang.String name, int nparm)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFunction(Function object)add object to global function listvoidaddListener(UpdateListener object)add object to update listener listvoidclearParameterValues()resets all parameter values to zerovoidfixParameter(int id, boolean state)setsintgetFreeParameterCount()Function[]getFunctions()java.lang.StringgetID()java.lang.StringgetName()intgetParameterCount()java.lang.StringgetParameterName(int id)doublegetParameterRangeMaximum(int id)doublegetParameterRangeMinimum(int id)doublegetParameterValue(int id)double[]getParameterValues()a convenience method to return all parameter valuesvoidinvokeListener()invoke object within update listener listbooleanisFitterMode()returns whether function is in use by fitting routine <expert function>booleanisParameterFixed(int id)returns whether given parameter is fixed (static) or notvoidprintParameters()voidprintParameters(boolean fullDebug)voidremoveFunction(Function object)remove object to global function listvoidremoveListener(UpdateListener object)remove object to update listener listvoidsetFitterMode(boolean state)sets whether function is in use by fitting routine <expert function>voidsetParameterCount(int count)voidsetParameterName(int id, java.lang.String paramName)sets the name of a by 'id' given parametervoidsetParameterRange(int id, double minRange, double maxRange)sets the range of a by 'id' given parameter N.B.voidsetParameterValue(int id, double value)sets the value of a by 'id' given parametervoidsetParameterValues(double[] value)sets the parameter values using an array the array is required to have at most getParameterCount() indices-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.gsi.math.functions.Function
getInputDimension, getOutputDimension
-
-
-
-
Field Detail
-
fparameter
protected double[] fparameter
-
fparameterMin
protected double[] fparameterMin
-
fparameterMax
protected double[] fparameterMax
-
fparameterCopy
protected double[] fparameterCopy
-
fparameterFixed
protected boolean[] fparameterFixed
-
fparameterName
protected java.lang.String[] fparameterName
-
fitterMode
protected boolean fitterMode
-
-
Constructor Detail
-
AbstractFunction
public AbstractFunction(java.lang.String name, double... parameter)- Parameters:
name- function nameparameter- parameter vector
-
AbstractFunction
public AbstractFunction(java.lang.String name, double[] parameters, java.lang.String... parameterNames)- Parameters:
name- function nameparameters- parameter arrayparameterNames- parameter name array
-
AbstractFunction
public AbstractFunction(java.lang.String name, int nparm)- Parameters:
name- function namenparm- number of free parameter
-
-
Method Detail
-
addFunction
public void addFunction(Function object)
add object to global function list- Parameters:
object- function to be added
-
addListener
public void addListener(UpdateListener object)
add object to update listener list- Parameters:
object- update listener to be added
-
clearParameterValues
public void clearParameterValues()
Description copied from interface:Functionresets all parameter values to zero- Specified by:
clearParameterValuesin interfaceFunction
-
fixParameter
public void fixParameter(int id, boolean state)Description copied from interface:Functionsets- Specified by:
fixParameterin interfaceFunction- Parameters:
id- the parameter idstate- true: parameter is fixed, false: parameter is free
-
getFreeParameterCount
public int getFreeParameterCount()
- Specified by:
getFreeParameterCountin interfaceFunction- Returns:
- the number of free parameter
-
getFunctions
public Function[] getFunctions()
- Returns:
- all registered functions
-
getID
public java.lang.String getID()
-
getName
public java.lang.String getName()
-
getParameterCount
public int getParameterCount()
- Specified by:
getParameterCountin interfaceFunction- Returns:
- the number of parameter
-
getParameterName
public java.lang.String getParameterName(int id)
- Specified by:
getParameterNamein interfaceFunction- Parameters:
id- the parameter id- Returns:
- the name of a by 'id' given parameter
-
getParameterRangeMaximum
public double getParameterRangeMaximum(int id)
- Specified by:
getParameterRangeMaximumin interfaceFunction- Parameters:
id- the parameter id- Returns:
- the maximum value of a by 'id' given parameter range N.B. depending on the fitter, the range may be used only as a hint
-
getParameterRangeMinimum
public double getParameterRangeMinimum(int id)
- Specified by:
getParameterRangeMinimumin interfaceFunction- Parameters:
id- the parameter id- Returns:
- the minimum value of a by 'id' given parameter range N.B. depending on the fitter, the range may be used only as a hint
-
getParameterValue
public double getParameterValue(int id)
- Specified by:
getParameterValuein interfaceFunction- Parameters:
id- parameter id- Returns:
- the value of a by 'id' given parameter
-
getParameterValues
public double[] getParameterValues()
a convenience method to return all parameter values- Returns:
- get array with parameter values
-
invokeListener
public void invokeListener()
invoke object within update listener list
-
isFitterMode
public boolean isFitterMode()
Description copied from interface:Functionreturns whether function is in use by fitting routine <expert function>- Specified by:
isFitterModein interfaceFunction- Returns:
- true: function is used within a fitting routine
-
isParameterFixed
public boolean isParameterFixed(int id)
Description copied from interface:Functionreturns whether given parameter is fixed (static) or not- Specified by:
isParameterFixedin interfaceFunction- Parameters:
id- parameter id- Returns:
- true: if parameter is fixed
-
printParameters
public void printParameters()
-
printParameters
public void printParameters(boolean fullDebug)
-
removeFunction
public void removeFunction(Function object)
remove object to global function list- Parameters:
object- function to be removed
-
removeListener
public void removeListener(UpdateListener object)
remove object to update listener list- Parameters:
object- update listener to be removed
-
setFitterMode
public void setFitterMode(boolean state)
Description copied from interface:Functionsets whether function is in use by fitting routine <expert function>- Specified by:
setFitterModein interfaceFunction- Parameters:
state- true: function is used within a fitting routine
-
setParameterCount
public void setParameterCount(int count)
- Specified by:
setParameterCountin interfaceFunction- Parameters:
count- number of free parameter
-
setParameterName
public void setParameterName(int id, java.lang.String paramName)Description copied from interface:Functionsets the name of a by 'id' given parameter- Specified by:
setParameterNamein interfaceFunction- Parameters:
id- the parameter idparamName- name for the given pararameter 'id'
-
setParameterRange
public void setParameterRange(int id, double minRange, double maxRange)Description copied from interface:Functionsets the range of a by 'id' given parameter N.B. depending on the fitter, the range may be used only as a hint- Specified by:
setParameterRangein interfaceFunction- Parameters:
id- the parameter idminRange- minimum parameter rangemaxRange- maximum parameter range
-
setParameterValue
public void setParameterValue(int id, double value)Description copied from interface:Functionsets the value of a by 'id' given parameter- Specified by:
setParameterValuein interfaceFunction- Parameters:
id- the parameter idvalue- new value of parameter
-
setParameterValues
public void setParameterValues(double[] value)
Description copied from interface:Functionsets the parameter values using an array the array is required to have at most getParameterCount() indices- Specified by:
setParameterValuesin interfaceFunction- Parameters:
value- new parameter values
-
-