Commit ce7712d0 authored by Manoel Campos's avatar Manoel Campos

Improved documentation of classes from package org.cloudbus.cloudsim.distributions.

It was made clear that the classes are generators of pseudo random numbers following a given distribution.
A link to the distribution's Wikipedia page was included for each class.
parent c1fcece5
......@@ -17,9 +17,10 @@ package org.cloudbus.cloudsim.distributions;
public interface ContinuousDistribution {
/**
* Sample the random number generator.
* Generate a new pseudo random number.
*
* @return The sample
* @return the next pseudo random number in the sequence,
* following the implemented distribution.
*/
double sample();
......
......@@ -11,19 +11,20 @@ package org.cloudbus.cloudsim.distributions;
import org.apache.commons.math3.distribution.ExponentialDistribution;
/**
* An exponential number generator.
* A pseudo random number generator following the
* <a href="https://en.wikipedia.org/wiki/Exponential_distribution">Exponential distribution</a>.
*
* @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0
*/
public class ExponentialDistr implements ContinuousDistribution {
/** The num gen. */
/** The internal exponential number generator. */
private final ExponentialDistribution numGen;
/**
* Creates a new exponential number generator.
* Creates a new exponential pseudo random number generator.
*
* @param seed the seed to be used.
* @param mean the mean for the distribution.
......@@ -34,7 +35,7 @@ public class ExponentialDistr implements ContinuousDistribution {
}
/**
* Creates a new exponential number generator.
* Creates a new exponential pseudo random number generator.
*
* @param mean the mean for the distribution.
*/
......@@ -42,11 +43,6 @@ public class ExponentialDistr implements ContinuousDistribution {
numGen = new ExponentialDistribution(mean);
}
/**
* Generate a new random number.
*
* @return the next random number in the sequence
*/
@Override
public double sample() {
return numGen.sample();
......
......@@ -14,18 +14,19 @@ import java.util.Random;
import org.apache.commons.math3.distribution.GammaDistribution;
/**
* The Class GammaDistr.
* A pseudo random number generator following the
* <a href="https://en.wikipedia.org/wiki/Gamma_distribution">Gamma</a> distribution.
*
* @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0
*/
public class GammaDistr implements ContinuousDistribution {
/** The num gen. */
/** The internal Gamma pseudo random number generator. */
private final GammaDistribution numGen;
/**
* Instantiates a new gamma distr.
* Instantiates a new Gamma pseudo random number generator.
*
* @param seed the seed
* @param alpha the alpha
......@@ -37,7 +38,7 @@ public class GammaDistr implements ContinuousDistribution {
}
/**
* Instantiates a new gamma distr.
* Instantiates a new Gamma pseudo random number generator.
*
* @param alpha the alpha
* @param beta the beta
......@@ -46,10 +47,6 @@ public class GammaDistr implements ContinuousDistribution {
numGen = new GammaDistribution(shape, scale);
}
/*
* (non-Javadoc)
* @see cloudsim.distributions.ContinuousDistribution#sample()
*/
@Override
public double sample() {
return numGen.sample();
......
......@@ -13,7 +13,8 @@ import java.util.Random;
import org.apache.commons.math3.distribution.LogNormalDistribution;
/**
* The Class LognormalDistr.
* A pseudo random number generator following the
* <a href="https://en.wikipedia.org/wiki/Log-normal_distribution">Lognormal</a> distribution.
*
* @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0
......@@ -21,12 +22,12 @@ import org.apache.commons.math3.distribution.LogNormalDistribution;
public class LognormalDistr implements ContinuousDistribution {
/** The num gen. */
/** The internal Log-normal pseudo random number generator. */
private final LogNormalDistribution numGen;
/**
* Instantiates a new lognormal distr.
* Instantiates a new Log-normal pseudo random number generator.
*
* @param seed the seed
* @param mean the mean
......@@ -38,7 +39,7 @@ public class LognormalDistr implements ContinuousDistribution {
}
/**
* Instantiates a new lognormal distr.
* Instantiates a new Log-normal pseudo random number generator.
*
* @param mean the mean
* @param dev the dev
......@@ -47,10 +48,6 @@ public class LognormalDistr implements ContinuousDistribution {
numGen = new LogNormalDistribution(scale, shape);
}
/*
* (non-Javadoc)
* @see cloudsim.distributions.ContinuousDistribution#sample()
*/
@Override
public double sample() {
return numGen.sample();
......
......@@ -11,7 +11,9 @@ package org.cloudbus.cloudsim.distributions;
import java.util.Random;
/**
* The Class LomaxDistribution.
* A pseudo random number generator following the
* <a href="https://en.wikipedia.org/wiki/Lomax_distribution">
* Lomax distribution</a>.
*
* @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0
......@@ -22,7 +24,7 @@ public class LomaxDistribution extends ParetoDistr implements ContinuousDistribu
private final double shift;
/**
* Instantiates a new lomax distribution.
* Instantiates a new lomax pseudo random number generator.
*
* @param shape the shape
* @param location the location
......@@ -39,7 +41,7 @@ public class LomaxDistribution extends ParetoDistr implements ContinuousDistribu
}
/**
* Instantiates a new lomax distribution.
* Instantiates a new lomax pseudo random number generator.
*
* @param seed the seed
* @param shape the shape
......@@ -56,10 +58,6 @@ public class LomaxDistribution extends ParetoDistr implements ContinuousDistribu
this.shift = shift;
}
/*
* (non-Javadoc)
* @see cloudsim.distributions.ParetoDistr#sample()
*/
@Override
public double sample() {
return super.sample() - shift;
......
......@@ -14,18 +14,19 @@ import java.util.Random;
import org.apache.commons.math3.distribution.ParetoDistribution;
/**
* The Class ParetoDistr.
* A pseudo random number generator following the
* <a href="https://en.wikipedia.org/wiki/Pareto_distribution">Pareto</a> distribution.
*
* @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0
*/
public class ParetoDistr implements ContinuousDistribution {
/** The num gen. */
/** The internal Pareto pseudo random number generator. */
private final ParetoDistribution numGen;
/**
* Instantiates a new pareto distr.
* Instantiates a new Pareto pseudo random number generator.
*
* @param seed the seed
* @param shape the shape
......@@ -37,7 +38,7 @@ public class ParetoDistr implements ContinuousDistribution {
}
/**
* Instantiates a new pareto distr.
* Instantiates a new Pareto pseudo random number generator.
*
* @param shape the shape
* @param location the location
......@@ -46,10 +47,6 @@ public class ParetoDistr implements ContinuousDistribution {
numGen = new ParetoDistribution(location, shape);
}
/*
* (non-Javadoc)
* @see cloudsim.distributions.ContinuousDistribution#sample()
*/
@Override
public double sample() {
return numGen.sample();
......
......@@ -13,18 +13,20 @@ import java.util.Random;
import org.apache.commons.math3.distribution.UniformRealDistribution;
/**
* A random number generator based on the Uniform distribution.
* A pseudo random number generator following the
* <a href="https://en.wikipedia.org/wiki/Uniform_distribution_(continuous)">
* Uniform continuous distribution</a>.
*
* @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0
*/
public class UniformDistr implements ContinuousDistribution {
/** The num gen. */
/** The internal uniform pseudo random number generator. */
private final UniformRealDistribution numGen;
/**
* Creates new uniform distribution.
* Creates new uniform pseudo random number generator.
*
* @param min minimum value
* @param max maximum value
......@@ -34,7 +36,7 @@ public class UniformDistr implements ContinuousDistribution {
}
/**
* Creates new uniform distribution.
* Creates new uniform pseudo random number generator.
*
* @param min minimum value
* @param max maximum value
......@@ -45,18 +47,13 @@ public class UniformDistr implements ContinuousDistribution {
numGen.reseedRandomGenerator(seed);
}
/**
* Generate a new random number.
*
* @return the next random number in the sequence
*/
@Override
public double sample() {
return numGen.sample();
}
/**
* Generates a new random number based on the number generator and values provided as
* Generates a new pseudo random number based on the generator and values provided as
* parameters.
*
* @param rd the random number generator
......@@ -73,7 +70,7 @@ public class UniformDistr implements ContinuousDistribution {
}
/**
* Set the random number generator's seed.
* Sets the random number generator's seed.
*
* @param seed the new seed for the generator
*/
......
......@@ -14,18 +14,19 @@ import java.util.Random;
import org.apache.commons.math3.distribution.WeibullDistribution;
/**
* The Class WeibullDistr.
* A pseudo random number generator following the
* <a href="https://en.wikipedia.org/wiki/Weibull_distribution">Weibull distribution</a>.
*
* @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0
*/
public class WeibullDistr implements ContinuousDistribution {
/** The num gen. */
/** The internal Weibull pseudo random number generator. */
private final WeibullDistribution numGen;
/**
* Instantiates a new weibull distr.
* Instantiates a new Weibull pseudo random number generator.
*
* @param seed the seed
* @param alpha the alpha
......@@ -37,7 +38,7 @@ public class WeibullDistr implements ContinuousDistribution {
}
/**
* Instantiates a new weibull distr.
* Instantiates a new Weibull pseudo random number generator.
*
* @param alpha the alpha
* @param beta the beta
......@@ -46,10 +47,6 @@ public class WeibullDistr implements ContinuousDistribution {
numGen = new WeibullDistribution(alpha, beta);
}
/*
* (non-Javadoc)
* @see cloudsim.distributions.ContinuousDistribution#sample()
*/
@Override
public double sample() {
return numGen.sample();
......
......@@ -12,14 +12,15 @@ package org.cloudbus.cloudsim.distributions;
import java.util.Random;
/**
* The Class ZipfDistr.
* A pseudo random number generator following the
* <a href="http://en.wikipedia.org/wiki/Zipf's_law">Zipf</a> distribution.
*
* @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0
*/
public class ZipfDistr implements ContinuousDistribution {
/** The num gen. */
/** The internal random number generator. */
private final Random numGen;
/** The shape. */
......@@ -29,7 +30,7 @@ public class ZipfDistr implements ContinuousDistribution {
private double den;
/**
* Instantiates a new zipf distr.
* Instantiates a new Zipf pseudo random number generator.
*
* @param seed the seed
* @param shape the shape
......@@ -46,7 +47,7 @@ public class ZipfDistr implements ContinuousDistribution {
}
/**
* Instantiates a new zipf distr.
* Instantiates a new Zipf pseudo random number generator.
*
* @param shape the shape
* @param population the population
......@@ -60,11 +61,6 @@ public class ZipfDistr implements ContinuousDistribution {
computeDen(shape, population);
}
/**
* Generate a new random number.
*
* @return the next random number in the sequence
*/
@Override
public double sample() {
double variate = numGen.nextDouble();
......@@ -82,7 +78,7 @@ public class ZipfDistr implements ContinuousDistribution {
}
/**
* Compute den.
* Compute the den.
*
* @param shape the shape
* @param population the population
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment