Class ConstantGenerator<O>

  • Type Parameters:
    O - type of the object returned by the draw method
    All Implemented Interfaces:
    Generator<O>
    Direct Known Subclasses:
    FixedRouteGenerator

    public class ConstantGenerator<O>
    extends Object
    implements Generator<O>
    Generator implementation for a constant value.

    Copyright (c) 2013-2022 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
    BSD-style license. See OpenTrafficSim License.

    Version:
    $Revision$, $LastChangedDate$, by $Author$, initial version 9 dec. 2017
    Author:
    Alexander Verbraeck, Peter Knoppers, Wouter Schakel
    • Constructor Detail

      • ConstantGenerator

        public ConstantGenerator​(O value)
        Constructor.
        Parameters:
        value - O; value
    • Method Detail

      • draw

        public O draw()
        Generate the next object.
        Specified by:
        draw in interface Generator<O>
        Returns:
        O; an object randomly selected from the stored collection
      • getValue

        public O getValue()
        Returns the value.
        Returns:
        O; value