Class DrawnLotteryNumbersExtensions


  • public final class DrawnLotteryNumbersExtensions
    extends java.lang.Object
    The class DrawnLotteryNumbersExtensions provides utility methods to draw lottery numbers with different algorithms
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Set<java.lang.Integer> draw​(int maxNumbers, int volume)
      Draw of lottery numbers.
      static java.util.Set<java.lang.Integer> draw​(int maxNumbers, int minVolume, int maxVolume)
      Draw of lottery numbers.
      static java.util.Set<java.lang.Integer> drawDefaultAlgorithm​(int maxNumbers, int minVolume, int maxVolume)
      This draw algorithm simulates the real world.
      static java.util.Set<java.lang.Integer> drawFromMultiMap​(int maxNumbers, int minVolume, int maxVolume, int drawCount)
      Draw of lottery numbers from given drawCount and take the numbers that are drawn the most times and return a new set.
      static java.util.Set<java.lang.Integer> drawFromMultiMap​(int maxNumbers, int minVolume, int maxVolume, int drawCount, boolean mostDrawn)
      Draw of lottery numbers from given drawCount and take the numbers that are drawn the most times and return a new set.
      static java.util.Set<java.lang.Integer> drawFromMultiMap​(int maxNumbers, int minVolume, int maxVolume, int drawCount, boolean mostDrawn, boolean paranoid)
      Draw of lottery numbers from given drawCount and take the numbers that are drawn the most times and return a new set.
      static java.util.Comparator<java.lang.Integer> drawFromMultiMap​(int maxNumbers, int minVolume, int maxVolume, int drawCount, boolean mostDrawn, boolean paranoid, java.util.Map<java.lang.Integer,​java.lang.Integer> numberCounterMap)
      Factory method for create a comparator for sort the lottery numbers
      static int drawGameSeventySeven()
      Draw the number of the game seventy seven
      static java.util.Set<java.lang.Integer> drawParanoidFromMultiMap​(int maxNumbers, int minVolume, int maxVolume, int drawCount)
      Draw of paranoid lottery numbers from given drawCount and take the numbers that are drawn the most times and return a new set.
      static int drawSuperNumber​(java.util.Set<java.lang.Integer> alreadyDrawnNumbers, int volume)
      Draws a super number that is not in the given already drawn numbers Set.
      static int drawSuperNumber​(java.util.Set<java.lang.Integer> alreadyDrawnNumbers, int minVolume, int maxVolume)
      Draws a super number that is not in the given already drawn numbers Set.
      static java.util.Set<java.lang.Integer> resolveLotteryNumbers​(int maxNumbers, java.util.Comparator<java.lang.Integer> mostDrawn, java.util.Map<java.lang.Integer,​java.lang.Integer> numberCounterMap)
      Resolves the lottery numbers from the given number counter map in the order from the given comparator limited to maxNumbers
      • Methods inherited from class java.lang.Object

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

      • draw

        public static java.util.Set<java.lang.Integer> draw​(int maxNumbers,
                                                            int volume)
        Draw of lottery numbers.
        Parameters:
        maxNumbers - the max number to draw
        volume - the volume of the numbers starts from 1 till volume
        Returns:
        the sets the
      • draw

        public static java.util.Set<java.lang.Integer> draw​(int maxNumbers,
                                                            int minVolume,
                                                            int maxVolume)
        Draw of lottery numbers.
        Parameters:
        maxNumbers - the maximum of numbers to draw
        minVolume - the min volume
        maxVolume - the max volume
        Returns:
        the sets of the drawn numbers
      • drawDefaultAlgorithm

        public static java.util.Set<java.lang.Integer> drawDefaultAlgorithm​(int maxNumbers,
                                                                            int minVolume,
                                                                            int maxVolume)
        This draw algorithm simulates the real world.
        Parameters:
        maxNumbers - the max number to draw
        minVolume - the min volume
        maxVolume - the volume of the numbers starts from 1 till volume
        Returns:
        the sets the
      • drawFromMultiMap

        public static java.util.Set<java.lang.Integer> drawFromMultiMap​(int maxNumbers,
                                                                        int minVolume,
                                                                        int maxVolume,
                                                                        int drawCount)
        Draw of lottery numbers from given drawCount and take the numbers that are drawn the most times and return a new set.
        Parameters:
        maxNumbers - the maximum of numbers to draw
        minVolume - the min volume
        maxVolume - the max volume
        drawCount - the draw count defines how many times to draw numbers
        Returns:
        the sets of the drawn numbers
      • drawFromMultiMap

        public static java.util.Set<java.lang.Integer> drawFromMultiMap​(int maxNumbers,
                                                                        int minVolume,
                                                                        int maxVolume,
                                                                        int drawCount,
                                                                        boolean mostDrawn)
        Draw of lottery numbers from given drawCount and take the numbers that are drawn the most times and return a new set.
        Parameters:
        maxNumbers - the maximum of numbers to draw
        minVolume - the min volume
        maxVolume - the max volume
        drawCount - the draw count defines how many times to draw numbers
        mostDrawn - the flag that indicates if the most drawn numbers should be taken if true, otherwise the reverse order will be taken
        Returns:
        the sets of the drawn numbers
      • drawFromMultiMap

        public static java.util.Set<java.lang.Integer> drawFromMultiMap​(int maxNumbers,
                                                                        int minVolume,
                                                                        int maxVolume,
                                                                        int drawCount,
                                                                        boolean mostDrawn,
                                                                        boolean paranoid)
        Draw of lottery numbers from given drawCount and take the numbers that are drawn the most times and return a new set.
        Parameters:
        maxNumbers - the maximum of numbers to draw
        minVolume - the min volume
        maxVolume - the max volume
        drawCount - the draw count defines how many times to draw numbers
        mostDrawn - the flag that indicates if the most drawn numbers should be taken if true, otherwise the reverse order will be taken
        paranoid - the flag paranoid indicates to create a custom comparator from the counter map and define a random defined order to draw if true, otherwise the flag mostDrawn will define the order to draw
        Returns:
        the sets of the drawn numbers
      • drawFromMultiMap

        public static java.util.Comparator<java.lang.Integer> drawFromMultiMap​(int maxNumbers,
                                                                               int minVolume,
                                                                               int maxVolume,
                                                                               int drawCount,
                                                                               boolean mostDrawn,
                                                                               boolean paranoid,
                                                                               java.util.Map<java.lang.Integer,​java.lang.Integer> numberCounterMap)
        Factory method for create a comparator for sort the lottery numbers
        Parameters:
        maxNumbers - the maximum of numbers to draw
        minVolume - the min volume
        maxVolume - the max volume
        drawCount - the draw count defines how many times to draw numbers
        mostDrawn - the flag that indicates if the most drawn numbers should be taken if true, otherwise the reverse order will be taken
        paranoid - the flag paranoid indicates to create a custom comparator from the counter map and define a random defined order to draw if true, otherwise the flag mostDrawn will define the order to draw
        numberCounterMap - the counter map for generate statistics of the drawn lottery numbers
        Returns:
        the comparator for sort the lottery numbers
      • drawGameSeventySeven

        public static int drawGameSeventySeven()
        Draw the number of the game seventy seven
        Returns:
        the drawn number of the game seventy seven
      • drawParanoidFromMultiMap

        public static java.util.Set<java.lang.Integer> drawParanoidFromMultiMap​(int maxNumbers,
                                                                                int minVolume,
                                                                                int maxVolume,
                                                                                int drawCount)
        Draw of paranoid lottery numbers from given drawCount and take the numbers that are drawn the most times and return a new set.
        Parameters:
        maxNumbers - the maximum of numbers to draw
        minVolume - the min volume
        maxVolume - the max volume
        drawCount - the draw count defines how many times to draw numbers
        Returns:
        the sets of the drawn numbers
      • drawSuperNumber

        public static int drawSuperNumber​(java.util.Set<java.lang.Integer> alreadyDrawnNumbers,
                                          int volume)
        Draws a super number that is not in the given already drawn numbers Set.
        Parameters:
        alreadyDrawnNumbers - the already drawn numbers
        volume - the volume of the numbers starts from 1 till volume
        Returns:
        the drawn super number
      • drawSuperNumber

        public static int drawSuperNumber​(java.util.Set<java.lang.Integer> alreadyDrawnNumbers,
                                          int minVolume,
                                          int maxVolume)
        Draws a super number that is not in the given already drawn numbers Set.
        Parameters:
        alreadyDrawnNumbers - the already drawn numbers
        minVolume - the min volume
        maxVolume - the max volume
        Returns:
        the drawn super number
      • resolveLotteryNumbers

        public static java.util.Set<java.lang.Integer> resolveLotteryNumbers​(int maxNumbers,
                                                                             java.util.Comparator<java.lang.Integer> mostDrawn,
                                                                             java.util.Map<java.lang.Integer,​java.lang.Integer> numberCounterMap)
        Resolves the lottery numbers from the given number counter map in the order from the given comparator limited to maxNumbers
        Parameters:
        maxNumbers - the max numbers
        mostDrawn - the comparator that defines in which order to take the drawn numbers. For instance if you want to have the reverse order you can simply give the Comparator.reverseOrder() or you can define your custom order
        numberCounterMap - the number counter map
        Returns:
        the sets of the lottery numbers