Class ProbabilityFunctionFactoryImpl
- java.lang.Object
-
- de.uka.ipd.sdq.probfunction.math.impl.ProbabilityFunctionFactoryImpl
-
- All Implemented Interfaces:
IProbabilityFunctionFactory
public class ProbabilityFunctionFactoryImpl extends Object implements IProbabilityFunctionFactory
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_UNIT_NAME
protected static ProbabilityFunctionFactoryImpl
factoryInstance
-
Fields inherited from interface de.uka.ipd.sdq.probfunction.math.IProbabilityFunctionFactory
eINSTANCE
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ProbabilityFunctionFactoryImpl(IPDFFactory pdfFactory)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IBoxedPDF
createBoxedPDF(List<IContinuousSample> samples, IRandomGenerator randomGenerator, IUnit unit)
IBoxedPDF
createBoxedPDF(List<IContinuousSample> samples, IUnit unit)
Creates a new BoxedPDF, whose boxes are defined by 'samples'.IBoxedPDF
createBoxedPDF(List<IContinuousSample> samples, IUnit unit, IRandomGenerator generator)
IContinuousSample
createContinuousSample(double value, double d)
Creates a new ContinuousSample with the attributes value and probability set.IUnit
createDefaultUnit()
Creates new Unit with name DEFAULT_UNIT_NAME, which is "ms".ISamplePDF
createDiracImpulse(int numOfSamplingPoints, double distance, IUnit unit)
creates a distribution function, wich represents a dirac impulse.ISamplePDF
createImpulseAt(int pos, int numOfSamplingPoints, double distance, IUnit unit)
Creates a distribution function, which describes a random variable with a constant outcome.IProbabilityMassFunction
createPMFFromMeasurements(Boolean[] measurements, IUnit unit, boolean hasOrderedDomain)
IProbabilityMassFunction
createPMFFromMeasurements(Double[] measurements, double epsilon, IUnit unit, boolean hasOrderedDomain)
IProbabilityMassFunction
createPMFFromMeasurements(Integer[] measurements, IUnit unit, boolean hasOrderedDomain)
IProbabilityMassFunction
createPMFFromMeasurements(String[] measurements, IUnit unit, boolean hasOrderedDomain)
IProbabilityMassFunction
createProbabilityMassFunction(List<ISample> samples, IUnit unit, boolean hasOrderedDomain)
Creates a new ProbabilityMassFunction whose samples are set to 'samples'.ISample
createSample(Object value, double probability)
Creates a new Sample with the attributes value and probability set.ISamplePDF
createSamplePDFFromComplex(double distance, List<org.apache.commons.math.complex.Complex> samples, boolean isInFrequencyDomain, IUnit unit)
Creates a new SamplePDF instace whose distance is set to 'distance' and whose sampling points are set to samples.ISamplePDF
createSamplePDFFromComplex(double distance, List<org.apache.commons.math.complex.Complex> samples, boolean isInFrequencyDomain, IUnit unit, IRandomGenerator generator)
ISamplePDF
createSamplePDFFromComplex(double distance, List<org.apache.commons.math.complex.Complex> values, IUnit unit)
ISamplePDF
createSamplePDFFromComplex(double distance, List<org.apache.commons.math.complex.Complex> samples, IUnit unit, IRandomGenerator generator)
ISamplePDF
createSamplePDFFromDouble(double distance, List<Double> values, boolean isInFrequencyDomain, IUnit unit)
ISamplePDF
createSamplePDFFromDouble(double distance, List<Double> values, boolean isInFrequencyDomain, IUnit unit, IRandomGenerator generator)
ISamplePDF
createSamplePDFFromDouble(double distance, List<Double> values, IUnit unit)
Creates a new SamplePDF instace whose distance is set to 'distance' and whose sampling points are set to samples.ISamplePDF
createSamplePDFFromDouble(double distance, List<Double> values, IUnit unit, IRandomGenerator generator)
ISamplePDF
createSamplePDFFromMeasurements(double distance, List<Double> measurements, IUnit unit)
IUnit
createUnit(String unitName)
Creates new Unit with name unitName.ISamplePDF
createZeroFunction(int numOfSamplingPoints, double distance, IUnit unit)
creates a distribution function, wich consists of numOfSamplingspoints zeros.static ProbabilityFunctionFactoryImpl
getInstance()
IPDFFactory
getPDFFactory()
IRandomGenerator
getRandomGenerator()
void
setPDFFactory(IPDFFactory pdfFactory)
void
setRandomGenerator(IRandomGenerator randomGenerator)
Set the random generator to use to the passed one.ISamplePDF
transformBoxedToSamplePDF(IBoxedPDF bpdf, double distance)
IBoxedPDF
transformToBoxedPDF(IProbabilityDensityFunction pdf)
Converts a arbitrary PDF to a BoxedPDF.IBoxedPDF
transformToBoxedPDF(ProbabilityDensityFunction epdf)
Converts a model object to a function object with the same attributes.IBoxedPDF
transformToBoxedPDF(ProbabilityDensityFunction epdf, IRandomGenerator randomNumberGenerator)
Converts a model object to a function object with the same attributes.IContinuousSample
transformToContinuousSample(ContinuousSample eSample)
Converts a model object to a function object with the same attributes.BoxedPDF
transformToModelBoxedPDF(IProbabilityDensityFunction pdf)
Converts a function object to a model object with the same attributes.ContinuousSample
transformToModelContinuousSample(IContinuousSample sample)
Converts a function object to a model object with the same attributes.ProbabilityDensityFunction
transformToModelPDF(IProbabilityDensityFunction pdf)
Converts a function object to a model object with the same attributes.ProbabilityMassFunction
transformToModelPMF(IProbabilityMassFunction pmf)
Converts a function object to a model object with the same attributes.Sample
transformToModelSample(ISample sample)
Converts a function object to a model object with the same attributes.SamplePDF
transformToModelSamplePDF(IProbabilityDensityFunction pdf)
Converts a function object to a model object with the same attributes.String
transformToModelUnitSpecification(IUnit unit)
Converts a function object to a model object with the same attributes.IProbabilityDensityFunction
transformToPDF(ProbabilityDensityFunction ePDF)
Converts a model object to a function object with the same attributes.IProbabilityDensityFunction
transformToPDF(ProbabilityDensityFunction ePDF, IRandomGenerator randomGenerator)
TODO: support Pois, Binom, UniInt and UniDouble.IProbabilityMassFunction
transformToPMF(ProbabilityMassFunction epmf)
Converts a model object to a function object with the same attributes.IProbabilityMassFunction
transformToPMF(ProbabilityMassFunction epmf, IRandomGenerator randomGenerator)
Converts a model object to a function object with the same attributes.ISample
transformToSample(Sample eSample)
Converts a model object to a function object with the same attributes.ISamplePDF
transformToSamplePDF(IProbabilityDensityFunction pdf)
Converts a arbitrary PDF to a SamplePDF.ISamplePDF
transformToSamplePDF(IProbabilityDensityFunction pdf, double newDistance)
Converts a arbitrary PDF to a SamplePDF.ISamplePDF
transformToSamplePDF(ProbabilityDensityFunction epdf)
Converts a model object to a function object with the same attributes.ISamplePDF
transformToSamplePDF(ProbabilityDensityFunction epdf, IRandomGenerator randomGenerator)
IUnit
transformToUnit(String unitSpecification)
Converts a model object to a function object with the same attributes.
-
-
-
Field Detail
-
DEFAULT_UNIT_NAME
public static final String DEFAULT_UNIT_NAME
- See Also:
- Constant Field Values
-
factoryInstance
protected static final ProbabilityFunctionFactoryImpl factoryInstance
-
-
Constructor Detail
-
ProbabilityFunctionFactoryImpl
protected ProbabilityFunctionFactoryImpl(IPDFFactory pdfFactory)
-
-
Method Detail
-
getPDFFactory
public IPDFFactory getPDFFactory()
- Specified by:
getPDFFactory
in interfaceIProbabilityFunctionFactory
-
setPDFFactory
public void setPDFFactory(IPDFFactory pdfFactory)
-
transformToBoxedPDF
public IBoxedPDF transformToBoxedPDF(ProbabilityDensityFunction epdf) throws ProbabilitySumNotOneException, DoubleSampleException
Description copied from interface:IProbabilityFunctionFactory
Converts a model object to a function object with the same attributes.- Specified by:
transformToBoxedPDF
in interfaceIProbabilityFunctionFactory
- Parameters:
epdf
- Object to transform.- Returns:
- New BoxedPDF instance.
- Throws:
ProbabilitySumNotOneException
DoubleSampleException
-
transformToBoxedPDF
public IBoxedPDF transformToBoxedPDF(ProbabilityDensityFunction epdf, IRandomGenerator randomNumberGenerator) throws ProbabilitySumNotOneException, DoubleSampleException
Description copied from interface:IProbabilityFunctionFactory
Converts a model object to a function object with the same attributes.- Specified by:
transformToBoxedPDF
in interfaceIProbabilityFunctionFactory
- Parameters:
epdf
- Object to transform.randomNumberGenerator
- Number generator to use- Returns:
- New BoxedPDF instance.
- Throws:
ProbabilitySumNotOneException
DoubleSampleException
-
transformToSamplePDF
public ISamplePDF transformToSamplePDF(ProbabilityDensityFunction epdf) throws UnknownPDFTypeException, ProbabilitySumNotOneException, DoubleSampleException
Description copied from interface:IProbabilityFunctionFactory
Converts a model object to a function object with the same attributes.- Specified by:
transformToSamplePDF
in interfaceIProbabilityFunctionFactory
- Parameters:
epdf
- Object to transform.- Returns:
- New SamplePDF instance.
- Throws:
UnknownPDFTypeException
- Thrown in case pdf is neither a BoxedPDF nor a SamplePDFProbabilitySumNotOneException
DoubleSampleException
-
transformToSamplePDF
public ISamplePDF transformToSamplePDF(ProbabilityDensityFunction epdf, IRandomGenerator randomGenerator) throws UnknownPDFTypeException, ProbabilitySumNotOneException, DoubleSampleException
-
transformToPMF
public IProbabilityMassFunction transformToPMF(ProbabilityMassFunction epmf)
Description copied from interface:IProbabilityFunctionFactory
Converts a model object to a function object with the same attributes.- Specified by:
transformToPMF
in interfaceIProbabilityFunctionFactory
- Parameters:
epmf
- Object to transform.- Returns:
- New ProbabilityMassFunction instance.
-
transformToPMF
public IProbabilityMassFunction transformToPMF(ProbabilityMassFunction epmf, IRandomGenerator randomGenerator)
Description copied from interface:IProbabilityFunctionFactory
Converts a model object to a function object with the same attributes.- Specified by:
transformToPMF
in interfaceIProbabilityFunctionFactory
- Parameters:
epmf
- Object to transform.- Returns:
- New ProbabilityMassFunction instance.
-
createBoxedPDF
public IBoxedPDF createBoxedPDF(List<IContinuousSample> samples, IUnit unit) throws DoubleSampleException
Description copied from interface:IProbabilityFunctionFactory
Creates a new BoxedPDF, whose boxes are defined by 'samples'.- Specified by:
createBoxedPDF
in interfaceIProbabilityFunctionFactory
- Parameters:
samples
- List of ContinuousSamples, which defines the upper right corners of the PDF's boxes. The list may be unsorted. The values of all samples must be greater or equal to zero.- Returns:
- New BoxedPDF instance.
- Throws:
DoubleSampleException
-
createBoxedPDF
public IBoxedPDF createBoxedPDF(List<IContinuousSample> samples, IRandomGenerator randomGenerator, IUnit unit) throws DoubleSampleException
- Throws:
DoubleSampleException
-
createBoxedPDF
public IBoxedPDF createBoxedPDF(List<IContinuousSample> samples, IUnit unit, IRandomGenerator generator) throws DoubleSampleException
- Throws:
DoubleSampleException
-
createContinuousSample
public IContinuousSample createContinuousSample(double value, double d)
Description copied from interface:IProbabilityFunctionFactory
Creates a new ContinuousSample with the attributes value and probability set.- Specified by:
createContinuousSample
in interfaceIProbabilityFunctionFactory
- Returns:
- New ContinuousSample instance.
-
createDefaultUnit
public IUnit createDefaultUnit()
Description copied from interface:IProbabilityFunctionFactory
Creates new Unit with name DEFAULT_UNIT_NAME, which is "ms".- Specified by:
createDefaultUnit
in interfaceIProbabilityFunctionFactory
- Returns:
- New Unit instance.
-
createDiracImpulse
public ISamplePDF createDiracImpulse(int numOfSamplingPoints, double distance, IUnit unit)
Description copied from interface:IProbabilityFunctionFactory
creates a distribution function, wich represents a dirac impulse. The returned function consists of numOfSamplingPoints equidistant points.- Specified by:
createDiracImpulse
in interfaceIProbabilityFunctionFactory
- Parameters:
numOfSamplingPoints
- number of points.distance
- distance between each two points.unit
- TODO- Returns:
- a new probability density function with entered parameters.
-
createImpulseAt
public ISamplePDF createImpulseAt(int pos, int numOfSamplingPoints, double distance, IUnit unit)
Description copied from interface:IProbabilityFunctionFactory
Creates a distribution function, which describes a random variable with a constant outcome. In this case, it is given by distance * pos.- Specified by:
createImpulseAt
in interfaceIProbabilityFunctionFactory
- Returns:
- a new probability density function with entered parameters.
-
createProbabilityMassFunction
public IProbabilityMassFunction createProbabilityMassFunction(List<ISample> samples, IUnit unit, boolean hasOrderedDomain)
Description copied from interface:IProbabilityFunctionFactory
Creates a new ProbabilityMassFunction whose samples are set to 'samples'. If the samples are marked as ordered, they will be sorted and stochastic values such as median and percentile are available.- Specified by:
createProbabilityMassFunction
in interfaceIProbabilityFunctionFactory
- Parameters:
samples
- List of samples for the PMF.hasOrderedDomain
- Marks a set as ordered.- Returns:
- New ProbabilityMassFunction instance.
-
createPMFFromMeasurements
public IProbabilityMassFunction createPMFFromMeasurements(Boolean[] measurements, IUnit unit, boolean hasOrderedDomain)
- Specified by:
createPMFFromMeasurements
in interfaceIProbabilityFunctionFactory
- Returns:
-
createPMFFromMeasurements
public IProbabilityMassFunction createPMFFromMeasurements(Double[] measurements, double epsilon, IUnit unit, boolean hasOrderedDomain)
- Specified by:
createPMFFromMeasurements
in interfaceIProbabilityFunctionFactory
- Returns:
-
createPMFFromMeasurements
public IProbabilityMassFunction createPMFFromMeasurements(String[] measurements, IUnit unit, boolean hasOrderedDomain)
- Specified by:
createPMFFromMeasurements
in interfaceIProbabilityFunctionFactory
- Returns:
-
createPMFFromMeasurements
public IProbabilityMassFunction createPMFFromMeasurements(Integer[] measurements, IUnit unit, boolean hasOrderedDomain)
- Specified by:
createPMFFromMeasurements
in interfaceIProbabilityFunctionFactory
- Returns:
-
createSample
public ISample createSample(Object value, double probability)
Description copied from interface:IProbabilityFunctionFactory
Creates a new Sample with the attributes value and probability set.- Specified by:
createSample
in interfaceIProbabilityFunctionFactory
- Returns:
- New Sample instance.
-
createSamplePDFFromComplex
public ISamplePDF createSamplePDFFromComplex(double distance, List<org.apache.commons.math.complex.Complex> values, IUnit unit)
- Specified by:
createSamplePDFFromComplex
in interfaceIProbabilityFunctionFactory
- Returns:
-
createSamplePDFFromComplex
public ISamplePDF createSamplePDFFromComplex(double distance, List<org.apache.commons.math.complex.Complex> samples, boolean isInFrequencyDomain, IUnit unit)
Description copied from interface:IProbabilityFunctionFactory
Creates a new SamplePDF instace whose distance is set to 'distance' and whose sampling points are set to samples.- Specified by:
createSamplePDFFromComplex
in interfaceIProbabilityFunctionFactory
- Parameters:
distance
- Distance between the sampling points stored in samples.samples
- Sampling points of the approximated PDF.isInFrequencyDomain
- Indicates whether the values are in frequency domain (true) or time domain (false).unit
- TODO- Returns:
- New instance of SamplePDF with set attributes.
-
createSamplePDFFromComplex
public ISamplePDF createSamplePDFFromComplex(double distance, List<org.apache.commons.math.complex.Complex> samples, IUnit unit, IRandomGenerator generator)
- Specified by:
createSamplePDFFromComplex
in interfaceIProbabilityFunctionFactory
- Returns:
-
createSamplePDFFromComplex
public ISamplePDF createSamplePDFFromComplex(double distance, List<org.apache.commons.math.complex.Complex> samples, boolean isInFrequencyDomain, IUnit unit, IRandomGenerator generator)
- Specified by:
createSamplePDFFromComplex
in interfaceIProbabilityFunctionFactory
- Returns:
-
createSamplePDFFromDouble
public ISamplePDF createSamplePDFFromDouble(double distance, List<Double> values, IUnit unit)
Description copied from interface:IProbabilityFunctionFactory
Creates a new SamplePDF instace whose distance is set to 'distance' and whose sampling points are set to samples. As the sampling points are complex values in general, this function sets only the real part of the values. The imaginary part is set to zero.- Specified by:
createSamplePDFFromDouble
in interfaceIProbabilityFunctionFactory
- Parameters:
distance
- Distance between the sampling points stored in samples.values
- Sampling points of the approximated PDF.unit
- TODO- Returns:
- New instance of SamplePDF with set attributes.
-
createSamplePDFFromDouble
public ISamplePDF createSamplePDFFromDouble(double distance, List<Double> values, boolean isInFrequencyDomain, IUnit unit)
- Specified by:
createSamplePDFFromDouble
in interfaceIProbabilityFunctionFactory
- Returns:
-
createSamplePDFFromDouble
public ISamplePDF createSamplePDFFromDouble(double distance, List<Double> values, IUnit unit, IRandomGenerator generator)
- Specified by:
createSamplePDFFromDouble
in interfaceIProbabilityFunctionFactory
- Returns:
-
createSamplePDFFromDouble
public ISamplePDF createSamplePDFFromDouble(double distance, List<Double> values, boolean isInFrequencyDomain, IUnit unit, IRandomGenerator generator)
- Specified by:
createSamplePDFFromDouble
in interfaceIProbabilityFunctionFactory
- Returns:
-
createSamplePDFFromMeasurements
public ISamplePDF createSamplePDFFromMeasurements(double distance, List<Double> measurements, IUnit unit)
- Specified by:
createSamplePDFFromMeasurements
in interfaceIProbabilityFunctionFactory
- Returns:
-
createUnit
public IUnit createUnit(String unitName)
Description copied from interface:IProbabilityFunctionFactory
Creates new Unit with name unitName.- Specified by:
createUnit
in interfaceIProbabilityFunctionFactory
- Parameters:
unitName
- Name of the unit.- Returns:
- New Unit instance.
-
createZeroFunction
public ISamplePDF createZeroFunction(int numOfSamplingPoints, double distance, IUnit unit)
Description copied from interface:IProbabilityFunctionFactory
creates a distribution function, wich consists of numOfSamplingspoints zeros.- Specified by:
createZeroFunction
in interfaceIProbabilityFunctionFactory
- Parameters:
numOfSamplingPoints
- number of points.distance
- distance between each two points.- Returns:
- a new "zeros" DistributionFunction.
-
transformToBoxedPDF
public IBoxedPDF transformToBoxedPDF(IProbabilityDensityFunction pdf) throws UnknownPDFTypeException, DoubleSampleException, FunctionNotInTimeDomainException
Description copied from interface:IProbabilityFunctionFactory
Converts a arbitrary PDF to a BoxedPDF. So far, only two cases are supported: The input PDF is a BoxedPDF, then a reference to the original PDF is returned or the input pdf is a SamplePDF, then the a new BoxedPDF is created from the SamplePDF.- Specified by:
transformToBoxedPDF
in interfaceIProbabilityFunctionFactory
- Parameters:
pdf
- PDF to transform.- Returns:
- Either a reference to the input PDF or a new BoxedPDF with the same properties as the input pdf.
- Throws:
UnknownPDFTypeException
- Thrown in case pdf is neither a BoxedPDF nor a SamplePDF.DoubleSampleException
FunctionNotInTimeDomainException
-
transformToModelBoxedPDF
public BoxedPDF transformToModelBoxedPDF(IProbabilityDensityFunction pdf) throws UnknownPDFTypeException, DoubleSampleException, FunctionNotInTimeDomainException
Description copied from interface:IProbabilityFunctionFactory
Converts a function object to a model object with the same attributes.- Specified by:
transformToModelBoxedPDF
in interfaceIProbabilityFunctionFactory
- Parameters:
pdf
- Object to transform.- Returns:
- New BoxedPDF instance.
- Throws:
DoubleSampleException
FunctionNotInTimeDomainException
UnknownPDFTypeException
-
transformToModelPDF
public ProbabilityDensityFunction transformToModelPDF(IProbabilityDensityFunction pdf) throws UnknownPDFTypeException, DoubleSampleException, FunctionNotInTimeDomainException
Description copied from interface:IProbabilityFunctionFactory
Converts a function object to a model object with the same attributes.- Specified by:
transformToModelPDF
in interfaceIProbabilityFunctionFactory
- Parameters:
pdf
- Object to transform.- Returns:
- New ProbabilityDensityFunction instance.
- Throws:
DoubleSampleException
FunctionNotInTimeDomainException
UnknownPDFTypeException
-
transformToModelPMF
public ProbabilityMassFunction transformToModelPMF(IProbabilityMassFunction pmf)
Description copied from interface:IProbabilityFunctionFactory
Converts a function object to a model object with the same attributes.- Specified by:
transformToModelPMF
in interfaceIProbabilityFunctionFactory
- Parameters:
pmf
- Object to transform.- Returns:
- New ProbabilityMassFunction instance.
-
transformToModelSamplePDF
public SamplePDF transformToModelSamplePDF(IProbabilityDensityFunction pdf) throws UnknownPDFTypeException
Description copied from interface:IProbabilityFunctionFactory
Converts a function object to a model object with the same attributes.- Specified by:
transformToModelSamplePDF
in interfaceIProbabilityFunctionFactory
- Parameters:
pdf
- Object to transform.- Returns:
- New SamplePDF instance.
- Throws:
UnknownPDFTypeException
-
transformToPDF
public IProbabilityDensityFunction transformToPDF(ProbabilityDensityFunction ePDF) throws UnknownPDFTypeException, ProbabilitySumNotOneException, DoubleSampleException
Description copied from interface:IProbabilityFunctionFactory
Converts a model object to a function object with the same attributes. (BoxedPDF -> IBoxedPDF, SamplePDF -> ISamplePDF)- Specified by:
transformToPDF
in interfaceIProbabilityFunctionFactory
- Parameters:
ePDF
- Object to transform.- Returns:
- New ProbabilityDensityFunction instance.
- Throws:
ProbabilitySumNotOneException
DoubleSampleException
UnknownPDFTypeException
-
transformToPDF
public IProbabilityDensityFunction transformToPDF(ProbabilityDensityFunction ePDF, IRandomGenerator randomGenerator) throws UnknownPDFTypeException, ProbabilitySumNotOneException, DoubleSampleException
TODO: support Pois, Binom, UniInt and UniDouble. They need to be added to the probfunction metamodel and then handled here.- Specified by:
transformToPDF
in interfaceIProbabilityFunctionFactory
- Parameters:
ePDF
- Object to transform.- Returns:
- New ProbabilityDensityFunction instance.
- Throws:
ProbabilitySumNotOneException
DoubleSampleException
UnknownPDFTypeException
-
transformToSamplePDF
public ISamplePDF transformToSamplePDF(IProbabilityDensityFunction pdf) throws UnknownPDFTypeException
Description copied from interface:IProbabilityFunctionFactory
Converts a arbitrary PDF to a SamplePDF. So far, only two cases are supported: The input PDF is a SamplePDF, then a reference to the original PDF is returned or the input pdf is a BoxedPDF, then the a new SamplePDF is created from the BoxedPDF.- Specified by:
transformToSamplePDF
in interfaceIProbabilityFunctionFactory
- Parameters:
pdf
- PDF to transform.- Returns:
- Either a reference to the input PDF or a new SamplePDF with the same properties as the input pdf.
- Throws:
UnknownPDFTypeException
- Thrown in case pdf is neither a BoxedPDF nor a SamplePDF.
-
transformToSamplePDF
public ISamplePDF transformToSamplePDF(IProbabilityDensityFunction pdf, double newDistance) throws UnknownPDFTypeException, NegativeDistanceException, FunctionNotInTimeDomainException
Description copied from interface:IProbabilityFunctionFactory
Converts a arbitrary PDF to a SamplePDF. So far, only two cases are supported: The input PDF is a SamplePDF, then a reference to a new Sample PDF with the given distance is returned or the input pdf is a BoxedPDF, then a new SamplePDF is created from the BoxedPDF.- Specified by:
transformToSamplePDF
in interfaceIProbabilityFunctionFactory
- Parameters:
pdf
- PDF to transform.newDistance
- the new distance- Returns:
- Either a reference to the input PDF or a new SamplePDF with the same properties as the input pdf.
- Throws:
UnknownPDFTypeException
- Thrown in case pdf is neither a BoxedPDF nor a SamplePDF.NegativeDistanceException
FunctionNotInTimeDomainException
-
transformToContinuousSample
public IContinuousSample transformToContinuousSample(ContinuousSample eSample)
Description copied from interface:IProbabilityFunctionFactory
Converts a model object to a function object with the same attributes.- Specified by:
transformToContinuousSample
in interfaceIProbabilityFunctionFactory
- Parameters:
eSample
- Object to transform.- Returns:
- New ContinuousSample instance.
-
transformToModelContinuousSample
public ContinuousSample transformToModelContinuousSample(IContinuousSample sample)
Description copied from interface:IProbabilityFunctionFactory
Converts a function object to a model object with the same attributes.- Specified by:
transformToModelContinuousSample
in interfaceIProbabilityFunctionFactory
- Parameters:
sample
- Object to transform.- Returns:
- New ContinuousSample instance.
-
transformToModelSample
public Sample transformToModelSample(ISample sample)
Description copied from interface:IProbabilityFunctionFactory
Converts a function object to a model object with the same attributes.- Specified by:
transformToModelSample
in interfaceIProbabilityFunctionFactory
- Parameters:
sample
- Object to transform.- Returns:
- New Sample instance.
-
transformToModelUnitSpecification
public String transformToModelUnitSpecification(IUnit unit)
Description copied from interface:IProbabilityFunctionFactory
Converts a function object to a model object with the same attributes.- Specified by:
transformToModelUnitSpecification
in interfaceIProbabilityFunctionFactory
- Parameters:
unit
- Object to transform.- Returns:
- New Unit instance.
-
transformToSample
public ISample transformToSample(Sample eSample)
Description copied from interface:IProbabilityFunctionFactory
Converts a model object to a function object with the same attributes.- Specified by:
transformToSample
in interfaceIProbabilityFunctionFactory
- Parameters:
eSample
- Object to transform.- Returns:
- New Sample instance.
-
transformToUnit
public IUnit transformToUnit(String unitSpecification)
Description copied from interface:IProbabilityFunctionFactory
Converts a model object to a function object with the same attributes.- Specified by:
transformToUnit
in interfaceIProbabilityFunctionFactory
- Returns:
- New Unit instance.
-
getInstance
public static ProbabilityFunctionFactoryImpl getInstance()
-
transformBoxedToSamplePDF
public ISamplePDF transformBoxedToSamplePDF(IBoxedPDF bpdf, double distance)
-
setRandomGenerator
public void setRandomGenerator(IRandomGenerator randomGenerator)
Description copied from interface:IProbabilityFunctionFactory
Set the random generator to use to the passed one. If this method is never called, theDefaultRandomGenerator
is used. This method can be called at any time, however, to get consistent results it should be called before retrieving any functions from this factory.- Specified by:
setRandomGenerator
in interfaceIProbabilityFunctionFactory
-
getRandomGenerator
public IRandomGenerator getRandomGenerator()
- Specified by:
getRandomGenerator
in interfaceIProbabilityFunctionFactory
-
-