Class Distribution
java.lang.Object
common.distributions.Distribution
- All Implemented Interfaces:
ServiceStrategy, Cloneable
- Direct Known Subclasses:
Batch, Bernoulli, Binomial, Burst, Coxian, Deterministic, DiscreteUniform, Erlang, Exponential, Gamma, Hyperexponential, Lognormal, MAP, MMPP2, Normal, Pareto, PhaseType, Poisson, Poisson, Replayer, ShiftedGeometric, StudentT, Uniform, Weibull, Zipf
Title: Distribution
Description: This abstract class provides a generic pattern used to specify a distribution.
- Author:
- Bertoli Marco Date: 25-giu-2005 Time: 14.47.12
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassThis class describes a parameter.static interfaceThis interface is used to specify a custom check method on parameter's value (for example value's range). -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static Distribution[]protected static Distribution[]protected doubleprotected Distribution.ValueCheckerprotected Stringprotected Stringprotected static DecimalFormatprotected static Distribution[]protected booleanprotected booleanprotected ImageIconprotected booleanprotected doubleprotected Stringprotected static Distribution[]protected Stringprotected Distribution.Parameter[]protected String -
Constructor Summary
ConstructorsConstructorDescriptionDistribution(String name, String classpath, String parameterClasspath, String description) Constructs a new Distribution object. -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckInfinitesimalGeneratorMatrix(Object[][] m0, Object[][] m1) Checks if the entries in each row of an infinitesimal generator matrix sum up to zero.booleancheckProbabilityVector(Object[][] v) Checks if the entries of an probability vector sum up to one.booleancheckTransitionRateMatrix(Object[][] m) Checks if the diagonal of a transition rate matrix only contains negative entries and if the entries in each row of the matrix sum up to a non-positive value.booleanChecks if all parameters' values are correct for this distribution typeclone()Returns a deep copy of this DistributionbooleanTells if this distribution is equivalent to another one.static Distribution[]findAll()Returns an array with an instance of every allowed Distribution.static Distribution[]Returns an array with an instance of every discrete Distribution.static Distribution[]Returns an array with an instance of every Distribution that allows mean setting.static Distribution[]Returns an array with an instance of every nestable Distribution.formatNumber(double d) Helper method used to format given number into string according to default rules.doublegetC()Returns distribution variation coefficient C only ifhasC()is trueGets engine's classpath for this distributionGets this distribution descriptiongetImage()Gets explicative image of this distribution used, together with description, to help the user to understand meaning of parameters.doublegetMean()Returns distribution mean only ifhasMean()is truegetName()Gets this distribution's nameintReturns number of parameters for this distributiongetParameter(int num) Gets a parameter data structure of this distribution, given its indexgetParameter(String name) Gets a parameter data structure of this distribution, given its nameGets engine's classpath for this distribution's parameters (This is needed as each distribution in the engine has a Distribution object and a Parameter object which are distinct classes)Returns precondition that parameters' values must satisfy for this distribution to be valid Every Distribution that provides a checker must provide a valid precondition message too.booleanhasC()Returns if this distribution can be initialized providing variation coefficient CbooleanhasMean()Returns if this distribution can be initialized providing its mean valuebooleanReturns whether a distribution can be used as nested distribution inside another distributionvoidnormalizeProbabilityVector(Object[][] v) Normalizes the entries of a probability vector to sum up to one.voidsetC(double value) Sets the variation coefficient C for this distributionprotected abstract ImageIconsetImage()Sets explicative image of this distribution used, together with description, to help the user to understand meaning of parametersvoidsetMean(double value) Sets the mean for this distributionprotected abstract Distribution.Parameter[]Used to set parameters of this distributionprotected voidsetValueChecker(Distribution.ValueChecker checker) Sets a value checker for this entire distribution (checks intra-parameters preconditions)abstract StringtoString()Returns this distribution's short descriptionvoidupdateCM()This method has to be called whenever a parameter changes andhasMeanorhasCis true
-
Field Details
-
all
-
allWithMean
-
nestableDistributions
-
discreteDistributions
-
df
-
classpath
-
name
-
parameterClasspath
-
parameters
-
description
-
image
-
checker
-
precondition
-
hasMean
protected boolean hasMean -
hasC
protected boolean hasC -
mean
protected double mean -
c
protected double c -
isNestable
protected boolean isNestable
-
-
Constructor Details
-
Distribution
Constructs a new Distribution object. Initialize all internal objects calling abstract methods setParameterNames(), setParameterClasses(), setParameterValues().- Parameters:
name- Name of the distributionclasspath- engine's classpath for this distributionparameterClasspath- engine's classpath for this distribution's parametersdescription- description of this distribution
-
-
Method Details
-
getClassPath
-
getParameterClassPath
Gets engine's classpath for this distribution's parameters (This is needed as each distribution in the engine has a Distribution object and a Parameter object which are distinct classes)- Returns:
- parameter's classpath
-
getName
-
getDescription
Gets this distribution description- Returns:
- distribution's description
-
getNumberOfParameters
public int getNumberOfParameters()Returns number of parameters for this distribution- Returns:
- number of parameters
-
getParameter
Gets a parameter data structure of this distribution, given its index- Parameters:
num- index of requested parameter- Returns:
- requested parameter
- Throws:
ArrayIndexOutOfBoundsException- if num is not inside bounds
-
getParameter
Gets a parameter data structure of this distribution, given its name- Parameters:
name- name of parameter to be retrieved- Returns:
- requested parameter or null if a parameter with specified name does not exist
-
getImage
Gets explicative image of this distribution used, together with description, to help the user to understand meaning of parameters.- Returns:
- explicative image
-
checkValue
public boolean checkValue()Checks if all parameters' values are correct for this distribution type- Returns:
- true if no check has to be performed or parameters are correct, false otherwise.
-
getPrecondition
Returns precondition that parameters' values must satisfy for this distribution to be valid Every Distribution that provides a checker must provide a valid precondition message too.- Returns:
- Message describing distribution's preconditions
-
clone
Returns a deep copy of this Distribution- Specified by:
clonein interfaceServiceStrategy- Overrides:
clonein classObject- Returns:
- a clone of this distribution
-
hasMean
public boolean hasMean()Returns if this distribution can be initialized providing its mean value- Returns:
- true iff this distribution can be initialized using its mean value
-
hasC
public boolean hasC()Returns if this distribution can be initialized providing variation coefficient C- Returns:
- true iff this distribution can be initialized using variation coefficient C
-
getMean
public double getMean()Returns distribution mean only ifhasMean()is true- Returns:
- distribution Mean
-
getC
public double getC()Returns distribution variation coefficient C only ifhasC()is true- Returns:
- variation coefficient C
-
setValueChecker
Sets a value checker for this entire distribution (checks intra-parameters preconditions)- Parameters:
checker- checker to be set to this distribution
-
isNestable
public boolean isNestable()Returns whether a distribution can be used as nested distribution inside another distribution- Returns:
- true if it can be nested. false otherwise
-
formatNumber
Helper method used to format given number into string according to default rules.- Parameters:
d- double to be converted- Returns:
- string representation of given number
-
findAll
Returns an array with an instance of every allowed Distribution. Uses internal caching to search for distributions only the first time that this method is called. Note: this method is used to get all continuous distributions. If you need discrete distributions, usefindAllDiscrete().- Returns:
- an array with an instance of every allowed Distribution
-
findAllWithMean
Returns an array with an instance of every Distribution that allows mean setting. Uses internal caching to search for distributions only the first time that this method is called.- Returns:
- an array with an instance of every Distribution in which mean value can be specified
-
findNestableDistributions
Returns an array with an instance of every nestable Distribution. Uses internal caching to search for distributions only the first time that this method is called.- Returns:
- an array with an instance of every nestable Distribution
-
findAllDiscrete
Returns an array with an instance of every discrete Distribution. Uses internal caching to search for distributions only the first time that this method is called.- Returns:
- an array with an instance of every discrete Distribution
-
checkProbabilityVector
Checks if the entries of an probability vector sum up to one.- Parameters:
v- vector to be checked- Returns:
- true if the vector satisfies the condition, false otherwise
-
normalizeProbabilityVector
Normalizes the entries of a probability vector to sum up to one.- Parameters:
v- vector to be normalized
-
checkTransitionRateMatrix
Checks if the diagonal of a transition rate matrix only contains negative entries and if the entries in each row of the matrix sum up to a non-positive value.- Parameters:
m- matrix to be checked- Returns:
- true if the matrix satisfies the condition, false otherwise
-
checkInfinitesimalGeneratorMatrix
Checks if the entries in each row of an infinitesimal generator matrix sum up to zero.- Parameters:
m0- hidden matrix to be checkedm1- observable matrix to be checked- Returns:
- true if the matrix satisfies the condition, false otherwise
-
equals
-
setParameters
Used to set parameters of this distribution- Returns:
- distribution parameters
-
setImage
Sets explicative image of this distribution used, together with description, to help the user to understand meaning of parameters- Returns:
- explicative image
-
toString
-
setMean
public void setMean(double value) Sets the mean for this distribution- Parameters:
value- mean value
-
setC
public void setC(double value) Sets the variation coefficient C for this distribution- Parameters:
value- variation coefficient C value
-
updateCM
public void updateCM()This method has to be called whenever a parameter changes andhasMeanorhasCis true
-