Class Burst

All Implemented Interfaces:
Distribution, StorableDistribution

public class Burst extends NetNode implements Distribution
This is the Burst distribution.

Copyright (c) 2003
Politecnico di Milano - dipartimento di Elettronica e Informazione
Author:
Federico Dal Castello
  • Constructor Details

    • Burst

      public Burst(Double probability, DistributionContainer distrContA, DistributionContainer distrContB, Boolean isRoundRobin) throws IncorrectDistributionParameterException
      Creates a new Burst distribution with the specified probability of having events of type A. distrContA is the DistributionContainer containing the length distribution A and the related parameters, while distrContB is the same of distrContA but for distribution B.
      Parameters:
      probability - the probability of having events of type A
      distrContA - the DistributionContainer containing the length distribution A and the related parameter
      distrContB - the DistributionContainer containing the length distribution A and the related parameter
      isRoundRobin - if true, the behavior of the interval change is set to Round-Robin. That is, there is a pure alternation of the interval types, starting with interval A: A-B-A-B-A-B-A-B... In this case, the probability parameter is ignored. If false, the interval type is changed according to the probability parameter
      Throws:
      IncorrectDistributionParameterException - if the probability is not a value comprised between 0 and 1
    • Burst

      public Burst(Double probability, DistributionContainer distrContA, DistributionContainer distrContB) throws IncorrectDistributionParameterException
      Creates a new non-Round-Robin Burst distribution with the specified probability of having events of type A. distrContA is the DistributionContainer containing the length distribution A and the related parameters, while distrContB is the same of distrContA but for distribution B.
      Parameters:
      probability - the probability of having events of type A
      distrContA - the DistributionContainer containing the length distribution A and the related parameter
      distrContB - the DistributionContainer containing the length distribution A and the related parameter
      Throws:
      IncorrectDistributionParameterException - if the probability is not a value comprised between 0 and 1
  • Method Details

    • setRandomEngine

      public void setRandomEngine(RandomEngine engine)
      Specified by:
      setRandomEngine in interface Distribution
    • initialize

    • check

      public boolean check(Double probability)
      Verifies if the parameters are correct. For the burst distribution the parameters are correct if the value of the probability is comprised between 0 and 1.
      Parameters:
      probability - the probability
      Returns:
      true if the probability is correct; false otherwise
    • cdf

      public double cdf(double x, Parameter p) throws IncorrectDistributionParameterException
      Description copied from interface: Distribution
      This method is used to obtain from the distribution its cumulative distribution function evaluated where required by the user.
      Specified by:
      cdf in interface Distribution
      Parameters:
      x - the x value
      p - the p value
      Returns:
      always 0 because in this type of distribution it has no sense to request the cdf of the distribution.
      Throws:
      IncorrectDistributionParameterException - if the operation cannot be completed
    • pdf

      public double pdf(double x, Parameter p) throws IncorrectDistributionParameterException
      Description copied from interface: Distribution
      This method is used to obtain from the distribution its probability distribution function evaluated where required by the user.
      Specified by:
      pdf in interface Distribution
      Parameters:
      x - the x value
      p - the p value
      Returns:
      always 0 because in this type of distribution it has no sense to request the pdf of the distribution.
      Throws:
      IncorrectDistributionParameterException - if the operation cannot be completed
    • theorMean

      public double theorMean(Parameter p) throws IncorrectDistributionParameterException
      This method is used to obtain from the distribution the value of its own theoretic mean.
      Specified by:
      theorMean in interface Distribution
      Parameters:
      p - parameter of the constant distribution.
      Returns:
      double with the theoretic mean of the distribution.
      Throws:
      IncorrectDistributionParameterException
    • theorVariance

      public double theorVariance(Parameter p) throws IncorrectDistributionParameterException
      Description copied from interface: Distribution
      This method is used to obtain from the distribution the value of its own theoretic variance.
      Specified by:
      theorVariance in interface Distribution
      Parameters:
      p - the p value
      Returns:
      always 0 because in this type of distribution it has no sense to request the variance of the distribution.
      Throws:
      IncorrectDistributionParameterException - if the operation cannot be completed
    • nextRand

      public double nextRand(Parameter p) throws IncorrectDistributionParameterException
      This method is used to obtain from the distribution the next number distributed according to the distribution parameter and the actual interval (A or B).
      Specified by:
      nextRand in interface Distribution
      Parameters:
      p - parameter of the burst distribution
      Returns:
      double with the next random number of this distribution, according to the actual interval (A or B)
      Throws:
      IncorrectDistributionParameterException - if the value distributions parameter are not correct
    • sendMe

      protected void sendMe(double delay, int eventType)
      Send an event to this entity with no data, specifying the delivery delay and the event type.
      Parameters:
      delay - how long from the current simulation time the event should be sent
      eventType - an user-defined number representing the type of event
    • dispatch

      protected void dispatch(NetMessage message) throws NetException
      Message dispatcher for Burst distribution. When an EVENT_DISTRIBUTION_CHANGE message arrives, it chooses the new interval type based on the probability and sends to itself a new EVENT_DISTRIBUTION_CHANGE message with a delay generated by the chosen interval. Otherwise it discards the message, if it is set to discard.
      Overrides:
      dispatch in class NetNode
      Throws:
      NetException