Class StaticIntGenerator

  • All Implemented Interfaces:
    IntGenerator

    public class StaticIntGenerator
    extends java.lang.Object
    implements IntGenerator
    Generate a static set of integers.
    Since:
    0.7.5
    Author:
    Erich Schubert
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int max
      Maximum value.
      private int min
      Minimum.
      private int[] values
      Data to process.
    • Constructor Summary

      Constructors 
      Constructor Description
      StaticIntGenerator​(int... values)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void forEach​(java.util.function.IntConsumer c)
      Process the entire series once.
      int getMax()
      Maximum value of the stream.
      int getMin()
      Minimum value of the stream.
      java.lang.StringBuilder serializeTo​(java.lang.StringBuilder buf)
      Produce a textual representation.
      java.lang.String toString()  
      private void updateMinMax()
      Compute the minimum and maximum.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • min

        private int min
        Minimum.
      • max

        private int max
        Maximum value.
      • values

        private int[] values
        Data to process.
    • Constructor Detail

      • StaticIntGenerator

        public StaticIntGenerator​(int... values)
        Constructor.
        Parameters:
        values - Values to generate. Will not be defensively copied, so do not modify afterwards anymore!
    • Method Detail

      • getMin

        public int getMin()
        Description copied from interface: IntGenerator
        Minimum value of the stream.
        Specified by:
        getMin in interface IntGenerator
        Returns:
        Minimum
      • getMax

        public int getMax()
        Description copied from interface: IntGenerator
        Maximum value of the stream.
        Specified by:
        getMax in interface IntGenerator
        Returns:
        Maximum
      • updateMinMax

        private void updateMinMax()
        Compute the minimum and maximum.
      • forEach

        public void forEach​(java.util.function.IntConsumer c)
        Description copied from interface: IntGenerator
        Process the entire series once.
        Specified by:
        forEach in interface IntGenerator
        Parameters:
        c - Consumer
      • serializeTo

        public java.lang.StringBuilder serializeTo​(java.lang.StringBuilder buf)
        Description copied from interface: IntGenerator
        Produce a textual representation.
        Specified by:
        serializeTo in interface IntGenerator
        Parameters:
        buf - Output buffer.
        Returns:
        Buffer
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object