Class Random.CompositeEngine

  • All Implemented Interfaces:
    Random.Engine
    Enclosing class:
    Random

    public static final class Random.CompositeEngine
    extends java.lang.Object
    implements Random.Engine
    The Random.CompositeEngine class is a reusable implementation of the Engine interface. It uses a set of objects that provide facilities to set up the randomizer and to generate data of specific types.
    • Constructor Summary

      Constructors 
      Constructor Description
      CompositeEngine​(Random.Initializer initializer)
      Constructs a CompositeEngine object that uses the specified initializer.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Data random​(DataTypeId typeId, int size)
      Generated random data of the specified type and size.
      void setGenerator​(DataTypeId typeId, Random.TypedGenerator generator)
      Sets a generator responsible for generating data of the specified type.
      void setSeed​(int seed)
      Sets a new seed of the random data generation engine.
      void setUp()
      Sets up the generation engine (if it requires some setup before being used).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CompositeEngine

        public CompositeEngine​(Random.Initializer initializer)
        Constructs a CompositeEngine object that uses the specified initializer.
        Parameters:
        initializer - Initializer to be used to set up the randomizer.
    • Method Detail

      • setGenerator

        public void setGenerator​(DataTypeId typeId,
                                 Random.TypedGenerator generator)
        Sets a generator responsible for generating data of the specified type.
        Parameters:
        typeId - Type identifier.
        generator - Generator to the specified type.
        Throws:
        java.lang.IllegalArgumentException - if any of the parameters equals null.
      • setUp

        public void setUp()
        Description copied from interface: Random.Engine
        Sets up the generation engine (if it requires some setup before being used).
        Specified by:
        setUp in interface Random.Engine
      • setSeed

        public void setSeed​(int seed)
        Description copied from interface: Random.Engine
        Sets a new seed of the random data generation engine.
        Specified by:
        setSeed in interface Random.Engine
        Parameters:
        seed - The seed to be set.
      • random

        public Data random​(DataTypeId typeId,
                           int size)
        Generated random data of the specified type and size.
        Specified by:
        random in interface Random.Engine
        Parameters:
        typeId - Data type identifier.
        size - Data type size (in bits).
        Returns:
        A random data.
        Throws:
        java.lang.IllegalArgumentException - if the typeId parameter equals null.
        java.lang.UnsupportedOperationException - if random data generation is not supported by the given data type.