Interface IProbabilityFunctionFactory

  • All Known Implementing Classes:
    ProbabilityFunctionFactoryImpl

    public interface IProbabilityFunctionFactory
    Factory. Provides a set of methods to create all kinds of probability functions and related objects. It also allows the transformation of different function types.
    • Method Detail

      • createContinuousSample

        IContinuousSample createContinuousSample​(double value,
                                                 double probability)
        Creates a new ContinuousSample with the attributes value and probability set.
        Parameters:
        Value - domain (x) value of the sample.
        Probability - range (y) value of the sample.
        Returns:
        New ContinuousSample instance.
      • transformToModelContinuousSample

        ContinuousSample transformToModelContinuousSample​(IContinuousSample sample)
        Converts a function object to a model object with the same attributes.
        Parameters:
        sample - Object to transform.
        Returns:
        New ContinuousSample instance.
      • transformToContinuousSample

        IContinuousSample transformToContinuousSample​(ContinuousSample eSample)
        Converts a model object to a function object with the same attributes.
        Parameters:
        eSample - Object to transform.
        Returns:
        New ContinuousSample instance.
      • createSample

        ISample createSample​(Object value,
                             double probability)
        Creates a new Sample with the attributes value and probability set.
        Parameters:
        Value - domain (x) value of the sample.
        Probability - range (y) value of the sample.
        Returns:
        New Sample instance.
      • transformToModelSample

        Sample transformToModelSample​(ISample sample)
        Converts a function object to a model object with the same attributes.
        Parameters:
        sample - Object to transform.
        Returns:
        New Sample instance.
      • transformToSample

        ISample transformToSample​(Sample eSample)
        Converts a model object to a function object with the same attributes.
        Parameters:
        eSample - Object to transform.
        Returns:
        New Sample instance.
      • createUnit

        IUnit createUnit​(String unitName)
        Creates new Unit with name unitName.
        Parameters:
        unitName - Name of the unit.
        Returns:
        New Unit instance.
      • createDefaultUnit

        IUnit createDefaultUnit()
        Creates new Unit with name DEFAULT_UNIT_NAME, which is "ms".
        Parameters:
        unitName - Name of the unit.
        Returns:
        New Unit instance.
      • transformToModelUnitSpecification

        String transformToModelUnitSpecification​(IUnit unit)
        Converts a function object to a model object with the same attributes.
        Parameters:
        unit - Object to transform.
        Returns:
        New Unit instance.
      • transformToUnit

        IUnit transformToUnit​(String unitSpecification)
        Converts a model object to a function object with the same attributes.
        Parameters:
        eUnit - Object to transform.
        Returns:
        New Unit instance.
      • createSamplePDFFromDouble

        ISamplePDF createSamplePDFFromDouble​(double distance,
                                             List<Double> samples,
                                             IUnit unit)
        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.
        Parameters:
        distance - Distance between the sampling points stored in samples.
        samples - Sampling points of the approximated PDF.
        unit - TODO
        Returns:
        New instance of SamplePDF with set attributes.
      • createSamplePDFFromDouble

        ISamplePDF createSamplePDFFromDouble​(double distance,
                                             List<Double> samples,
                                             boolean isInFrequencyDomain,
                                             IUnit unit)
        Parameters:
        distance -
        samples -
        isInFrequencyDomain -
        unit -
        Returns:
      • createSamplePDFFromDouble

        ISamplePDF createSamplePDFFromDouble​(double distance,
                                             List<Double> values,
                                             IUnit unit,
                                             IRandomGenerator generator)
        Parameters:
        distance -
        values -
        unit -
        generator -
        Returns:
      • createSamplePDFFromDouble

        ISamplePDF createSamplePDFFromDouble​(double distance,
                                             List<Double> values,
                                             boolean isInFrequencyDomain,
                                             IUnit unit,
                                             IRandomGenerator generator)
        Parameters:
        distance -
        values -
        isInFrequencyDomain -
        unit -
        generator -
        Returns:
      • createSamplePDFFromComplex

        ISamplePDF createSamplePDFFromComplex​(double distance,
                                              List<org.apache.commons.math.complex.Complex> samples,
                                              IUnit unit)
        Parameters:
        distance -
        samples -
        unit -
        Returns:
      • createSamplePDFFromComplex

        ISamplePDF createSamplePDFFromComplex​(double distance,
                                              List<org.apache.commons.math.complex.Complex> samples,
                                              IUnit unit,
                                              IRandomGenerator generator)
        Parameters:
        distance -
        samples -
        unit -
        generator -
        Returns:
      • createSamplePDFFromComplex

        ISamplePDF createSamplePDFFromComplex​(double distance,
                                              List<org.apache.commons.math.complex.Complex> samples,
                                              boolean isInFrequencyDomain,
                                              IUnit unit,
                                              IRandomGenerator generator)
        Parameters:
        distance -
        samples -
        isInFrequencyDomain -
        unit -
        generator -
        Returns:
      • createSamplePDFFromComplex

        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.
        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.
      • createSamplePDFFromMeasurements

        ISamplePDF createSamplePDFFromMeasurements​(double distance,
                                                   List<Double> measurements,
                                                   IUnit unit)
        Parameters:
        distance -
        measurements -
        Returns:
      • createDiracImpulse

        ISamplePDF createDiracImpulse​(int numOfSamplingPoints,
                                      double distance,
                                      IUnit unit)
        creates a distribution function, wich represents a dirac impulse. The returned function consists of numOfSamplingPoints equidistant points.
        Parameters:
        numOfSamplingPoints - number of points.
        distance - distance between each two points.
        unit - TODO
        Returns:
        a new probability density function with entered parameters.
      • createImpulseAt

        ISamplePDF createImpulseAt​(int pos,
                                   int numOfSamplingPoints,
                                   double distance,
                                   IUnit unit)
        Creates a distribution function, which describes a random variable with a constant outcome. In this case, it is given by distance * pos.
        Parameters:
        pos -
        numOfSamplingPoints -
        distance -
        unit -
        Returns:
        a new probability density function with entered parameters.
      • createZeroFunction

        ISamplePDF createZeroFunction​(int numOfSamplingPoints,
                                      double distance,
                                      IUnit unit)
        creates a distribution function, wich consists of numOfSamplingspoints zeros.
        Parameters:
        numOfSamplingPoints - number of points.
        distance - distance between each two points.
        Returns:
        a new "zeros" DistributionFunction.
      • transformToSamplePDF

        ISamplePDF transformToSamplePDF​(IProbabilityDensityFunction pdf)
                                 throws UnknownPDFTypeException
        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.
        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.
      • createProbabilityMassFunction

        IProbabilityMassFunction createProbabilityMassFunction​(List<ISample> samples,
                                                               IUnit unit,
                                                               boolean hasOrderedDomain)
        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.
        Parameters:
        samples - List of samples for the PMF.
        hasOrderedDomain - Marks a set as ordered.
        Returns:
        New ProbabilityMassFunction instance.
      • createPMFFromMeasurements

        IProbabilityMassFunction createPMFFromMeasurements​(Double[] measurements,
                                                           double epsilon,
                                                           IUnit unit,
                                                           boolean hasOrderedDomain)
        Parameters:
        measurements -
        unit -
        hasOrderedDomain -
        Returns:
      • createPMFFromMeasurements

        IProbabilityMassFunction createPMFFromMeasurements​(Integer[] measurements,
                                                           IUnit unit,
                                                           boolean hasOrderedDomain)
        Parameters:
        measurements -
        unit -
        hasOrderedDomain -
        Returns:
      • createPMFFromMeasurements

        IProbabilityMassFunction createPMFFromMeasurements​(String[] measurements,
                                                           IUnit unit,
                                                           boolean hasOrderedDomain)
        Parameters:
        measurements -
        unit -
        hasOrderedDomain -
        Returns:
      • createPMFFromMeasurements

        IProbabilityMassFunction createPMFFromMeasurements​(Boolean[] measurements,
                                                           IUnit unit,
                                                           boolean hasOrderedDomain)
        Parameters:
        measurements -
        unit -
        hasOrderedDomain -
        Returns:
      • transformToPMF

        IProbabilityMassFunction transformToPMF​(ProbabilityMassFunction ePMF)
        Converts a model object to a function object with the same attributes.
        Parameters:
        ePMF - Object to transform.
        Returns:
        New ProbabilityMassFunction instance.
      • transformToModelPMF

        ProbabilityMassFunction transformToModelPMF​(IProbabilityMassFunction pmf)
        Converts a function object to a model object with the same attributes.
        Parameters:
        pmf - Object to transform.
        Returns:
        New ProbabilityMassFunction instance.
      • setRandomGenerator

        void setRandomGenerator​(IRandomGenerator randomGenerator)
        Set the random generator to use to the passed one. If this method is never called, the DefaultRandomGenerator 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.
        Parameters:
        randomGenerator -