Class EmpiricalPar
java.lang.Object
random.AbstractParameter
random.EmpiricalPar
This is the parameter that should be passed to the empirical
distribution.
Copyright (c) 2003
Politecnico di Milano - dipartimento di Elettronica e Informazione
Copyright (c) 2003
Politecnico di Milano - dipartimento di Elettronica e Informazione
- Author:
- Fabrizio Frontera - ffrontera@yahoo.it
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionThis is the default constructor.EmpiricalPar(double[] pdf) It creates a new empirical parameter.EmpiricalPar(Double[] wpdf) It creates a new empirical parameter.EmpiricalPar(EmpiricalEntry[] entries) Creates an empirical parameter with these entries (each entry contains a value and a probability). -
Method Summary
Modifier and TypeMethodDescriptionbooleancheck()It controls if the parameter is correct or not.double[]getCDF()It returns the value of the parameters for the empirical distribution, that is the vector of double representing the cumulative distribution function tabulated.double[]getPDF()It returns the value of the parameters for the empirical distribution, that is the vector of double representing the probabilities provided by the user.getValue(int position) Returns the value in the corresponding position: generally only the empirical distribution needs to access this method (generates the random number then ask for the corresponding value).Object[]Returns all the values.static booleanChecks whether a parameter value is correct.static StringguiGetErrorMsg(String parameterName) voidsetPDF(double[] pdf) It allows the user to change the value of the parameter of the empirical distribution.Methods inherited from class AbstractParameter
setMean
-
Field Details
-
cdf
protected double[] cdfcumulative distribution function -
pdf
protected double[] pdfprobability distribution function -
values
values of the parameter
-
-
Constructor Details
-
EmpiricalPar
public EmpiricalPar()This is the default constructor. It creates a new empty empirical parameter that must be set with the setPDF method before being used. -
EmpiricalPar
It creates a new empirical parameter. It accepts an array of double greater or equal to zero and verifies that the sum of all these data is one or zero.- Parameters:
pdf- array ofdoublefor the new empirical distribution.- Throws:
IncorrectDistributionParameterException- when any of the provided data is less than zero or the sum of all of them is not one or zero.
-
EmpiricalPar
It creates a new empirical parameter. It accepts an array of Double greater or equal to zero and verifies that the sum of all these data is one or zero.- Parameters:
wpdf- array ofDoublefor the new empirical distribution.- Throws:
IncorrectDistributionParameterException- when any of the provided data is less than zero or the sum of all of them is not one or zero.
-
EmpiricalPar
Creates an empirical parameter with these entries (each entry contains a value and a probability). The Empirical can return not only an integer, but also directly an object, given the right probability table.- Parameters:
entries- Empirical entries.- Throws:
IncorrectDistributionParameterException
-
-
Method Details
-
getPDF
public double[] getPDF()It returns the value of the parameters for the empirical distribution, that is the vector of double representing the probabilities provided by the user.- Returns:
- array of double with the probability distribution function tabulated.
-
getCDF
public double[] getCDF()It returns the value of the parameters for the empirical distribution, that is the vector of double representing the cumulative distribution function tabulated.- Returns:
- array of double with the cumulative distribution function tabulated.
-
setPDF
It allows the user to change the value of the parameter of the empirical distribution. Takes an existent array of pdf and tries to convert it in a pdf for an empirical distribution, checking the conditions which must be respected.- Parameters:
pdf- array of double containing an existent pdf.- Throws:
IncorrectDistributionParameterException- if, among the provided data, there is a value less than zero or the sum of all of them is not one or zero.
-
check
public boolean check()It controls if the parameter is correct or not. For the empirical distribution, the parameter is correct if the values in the pdf array are equal to or greater than zero and they sum up to one or zero. -
guiCheck
-
guiGetErrorMsg
-
getValue
Returns the value in the corresponding position: generally only the empirical distribution needs to access this method (generates the random number then ask for the corresponding value).- Parameters:
position-- Returns:
- value
-
getValues
-