Class Triangular

  • All Implemented Interfaces:
    adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.Randomizable, adams.core.ShallowCopySupporter<adams.data.random.RandomNumberGenerator>, adams.core.SizeOfHandler, adams.data.random.RandomDoubleRangeGenerator<Double>, adams.data.random.RandomNumberGenerator<Double>, adams.data.random.SeededRandomNumberGenerator<Double>, Serializable

    public class Triangular
    extends adams.data.random.AbstractSeededRandomNumberGenerator<Double>
    implements adams.data.random.RandomDoubleRangeGenerator<Double>
    Generates random numbers from a symetric triangular random variable.

    Valid options are:

    -D <int> (property: debugLevel)
        The greater the number the more additional info the scheme may output to
        the console (0 = off).
        default: 0
        minimum: 0
     
    -seed <long> (property: seed)
        The seed value for the random number generator.
        default: 1
     
    -min-value <double> (property: minValue)
        The smallest number that could be generated.
        default: 0.0
     
    -max-value <double> (property: maxValue)
        The largest number that could be generated.
        default: 1.0
     
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Random.triangular(double, double), Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected double m_MaxValue
      the maximum value for the numbers to generate.
      protected double m_MinValue
      the minimum value for the numbers to generate.
      protected Random m_Random
      the random number generator to use.
      • Fields inherited from class adams.data.random.AbstractSeededRandomNumberGenerator

        m_Seed
      • Fields inherited from class adams.core.option.AbstractOptionHandler

        m_OptionManager
      • Fields inherited from class adams.core.logging.LoggingObject

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • Constructor Summary

      Constructors 
      Constructor Description
      Triangular()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void check()
      Performs optional checks.
      void defineOptions()
      Adds options to the internal list of options.
      protected Double doNext()
      Returns the next random number.
      double getMaxValue()
      Returns the maximum value of the numbers to generate.
      double getMinValue()
      Returns the minimum value of the numbers to generate.
      String globalInfo()
      Returns a string describing the object.
      String maxValueTipText()
      Returns the tip text for this property.
      String minValueTipText()
      Returns the tip text for this property.
      void reset()
      Resets the generator.
      void setMaxValue​(double value)
      Sets the maximum value of the numbers to generate.
      void setMinValue​(double value)
      Sets the minimum value of the numbers to generate.
      • Methods inherited from class adams.data.random.AbstractSeededRandomNumberGenerator

        getSeed, seedTipText, setSeed
      • Methods inherited from class adams.data.random.AbstractRandomNumberGenerator

        forCommandLine, forName, getGenerators, next, shallowCopy, shallowCopy
      • Methods inherited from class adams.core.option.AbstractOptionHandler

        cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
      • Methods inherited from class adams.core.logging.LoggingObject

        configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
      • Methods inherited from interface adams.core.Destroyable

        destroy
      • Methods inherited from interface adams.core.logging.LoggingLevelHandler

        getLoggingLevel
      • Methods inherited from interface adams.core.option.OptionHandler

        cleanUpOptions, getOptionManager, toCommandLine
      • Methods inherited from interface adams.data.random.RandomNumberGenerator

        next
      • Methods inherited from interface adams.core.ShallowCopySupporter

        shallowCopy, shallowCopy
    • Field Detail

      • m_MinValue

        protected double m_MinValue
        the minimum value for the numbers to generate.
      • m_MaxValue

        protected double m_MaxValue
        the maximum value for the numbers to generate.
      • m_Random

        protected Random m_Random
        the random number generator to use.
    • Constructor Detail

      • Triangular

        public Triangular()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing the object.
        Specified by:
        globalInfo in interface adams.core.GlobalInfoSupporter
        Specified by:
        globalInfo in class adams.core.option.AbstractOptionHandler
        Returns:
        a description suitable for displaying in the gui
      • defineOptions

        public void defineOptions()
        Adds options to the internal list of options.
        Specified by:
        defineOptions in interface adams.core.option.OptionHandler
        Overrides:
        defineOptions in class adams.data.random.AbstractSeededRandomNumberGenerator<Double>
      • reset

        public void reset()
        Resets the generator.
        Specified by:
        reset in interface adams.data.random.RandomNumberGenerator<Double>
        Overrides:
        reset in class adams.data.random.AbstractRandomNumberGenerator<Double>
      • setMinValue

        public void setMinValue​(double value)
        Sets the minimum value of the numbers to generate.
        Specified by:
        setMinValue in interface adams.data.random.RandomDoubleRangeGenerator<Double>
        Parameters:
        value - the minimum
      • getMinValue

        public double getMinValue()
        Returns the minimum value of the numbers to generate.
        Specified by:
        getMinValue in interface adams.data.random.RandomDoubleRangeGenerator<Double>
        Returns:
        the minimum
      • minValueTipText

        public String minValueTipText()
        Returns the tip text for this property.
        Specified by:
        minValueTipText in interface adams.data.random.RandomDoubleRangeGenerator<Double>
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setMaxValue

        public void setMaxValue​(double value)
        Sets the maximum value of the numbers to generate.
        Specified by:
        setMaxValue in interface adams.data.random.RandomDoubleRangeGenerator<Double>
        Parameters:
        value - the maximum
      • getMaxValue

        public double getMaxValue()
        Returns the maximum value of the numbers to generate.
        Specified by:
        getMaxValue in interface adams.data.random.RandomDoubleRangeGenerator<Double>
        Returns:
        the maximum
      • maxValueTipText

        public String maxValueTipText()
        Returns the tip text for this property.
        Specified by:
        maxValueTipText in interface adams.data.random.RandomDoubleRangeGenerator<Double>
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • check

        protected void check()
        Performs optional checks.

        Initializes the random number generator.
        Overrides:
        check in class adams.data.random.AbstractRandomNumberGenerator<Double>
      • doNext

        protected Double doNext()
        Returns the next random number. Does the actual computation.
        Specified by:
        doNext in class adams.data.random.AbstractRandomNumberGenerator<Double>
        Returns:
        the next number