Class LotteryExtensions


  • public final class LotteryExtensions
    extends java.lang.Object
    The class LotteryExtensions provides utility methods for draw lottery, super numbers and other gambling algorithms.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int calculateDraws​(de.alpharogroup.lottery.played.LotteryPlayedNumbers lotteryPlayedNumbers, int winningNumbersCount)
      Calculate draws for statistics.
      static int calculateDraws​(de.alpharogroup.lottery.played.LotteryPlayedNumbers lotteryPlayedNumbers, int winningNumbersCount, int maxIterations)
      Calculate draws for statistics.
      static int calculateDraws​(de.alpharogroup.lottery.ticket.LotteryTicket lotteryTicket, de.alpharogroup.lottery.wincategories.LotteryWinCategory lotteryWinCategory)
      Calculate how much draws will be needed to win with the given lottery ticket in the given win category.
      Caution: use with care if win category is first-class this can take a while till a return value is calculated.
      static int calculateDraws​(de.alpharogroup.lottery.ticket.LotteryTicket lotteryTicket, de.alpharogroup.lottery.wincategories.LotteryWinCategory lotteryWinCategory, int maxIterations)
      This method provides calculation of how much draws will be needed to win with the given lottery ticket in the given win category.
      static double calculateElapsedTimeInSeconds​(long startTime)
      Calculate elapsed time in seconds from the given start time as long to the current system time.
      static de.alpharogroup.lottery.evaluation.EvaluatedLotteryNumbers checkResult​(de.alpharogroup.lottery.drawings.DrawnLotteryNumbers drawnLotteryNumbers, de.alpharogroup.lottery.played.LotteryPlayedNumbers lotteryPlayedNumbers)
      Checks the result if the drawn lottery numbers are equal to the given played numbers.
      static void evaluate​(de.alpharogroup.lottery.drawings.DrawnLotteryNumbers drawnLotteryNumbers, de.alpharogroup.lottery.ticket.LotteryTicket playedLotteryTicket)
      Evaluate the given lottery ticket from the given drawn numbers.
      static void setWinCategories​(de.alpharogroup.lottery.evaluation.EvaluatedLotteryNumbers evaluatedLotteryNumbers)  
      • Methods inherited from class java.lang.Object

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

      • calculateDraws

        public static int calculateDraws​(de.alpharogroup.lottery.played.LotteryPlayedNumbers lotteryPlayedNumbers,
                                         int winningNumbersCount)
        Calculate draws for statistics.
        Parameters:
        lotteryPlayedNumbers - the lottery played numbers
        winningNumbersCount - the winning numbers count
        Returns:
        the int
      • calculateDraws

        public static int calculateDraws​(de.alpharogroup.lottery.played.LotteryPlayedNumbers lotteryPlayedNumbers,
                                         int winningNumbersCount,
                                         int maxIterations)
        Calculate draws for statistics.
        Parameters:
        lotteryPlayedNumbers - the lottery played numbers
        winningNumbersCount - the winning numbers count
        maxIterations - the max iterations in the while loop
        Returns:
        the int
      • calculateDraws

        public static int calculateDraws​(de.alpharogroup.lottery.ticket.LotteryTicket lotteryTicket,
                                         de.alpharogroup.lottery.wincategories.LotteryWinCategory lotteryWinCategory)
        Calculate how much draws will be needed to win with the given lottery ticket in the given win category.
        Caution: use with care if win category is first-class this can take a while till a return value is calculated.
        Parameters:
        lotteryTicket - the lottery ticket
        lotteryWinCategory - the lottery win category
        Returns:
        the quantity of draws for win of the given ticket
      • calculateDraws

        public static int calculateDraws​(de.alpharogroup.lottery.ticket.LotteryTicket lotteryTicket,
                                         de.alpharogroup.lottery.wincategories.LotteryWinCategory lotteryWinCategory,
                                         int maxIterations)
        This method provides calculation of how much draws will be needed to win with the given lottery ticket in the given win category. Can be used for statistics.
        Caution: use with care if win category is first-class this can take a while till a return value is calculated.
        Parameters:
        lotteryTicket - the lottery ticket
        lotteryWinCategory - the lottery win category
        maxIterations - the max iterations in the while loop
        Returns:
        the quantity of draws for win of the given ticket
      • calculateElapsedTimeInSeconds

        public static double calculateElapsedTimeInSeconds​(long startTime)
        Calculate elapsed time in seconds from the given start time as long to the current system time. This is useful for benchmarking
        Parameters:
        startTime - the start time
        Returns:
        The elapsed time in double
      • checkResult

        public static de.alpharogroup.lottery.evaluation.EvaluatedLotteryNumbers checkResult​(de.alpharogroup.lottery.drawings.DrawnLotteryNumbers drawnLotteryNumbers,
                                                                                             de.alpharogroup.lottery.played.LotteryPlayedNumbers lotteryPlayedNumbers)
        Checks the result if the drawn lottery numbers are equal to the given played numbers. The result is a EvaluatedLotteryNumbers object that keep the winning numbers.
        Parameters:
        drawnLotteryNumbers - the drawn lottery numbers are the numbers that are drawn from the lottery corporation
        lotteryPlayedNumbers - the lottery played numbers are the numbers that are played from the users
        Returns:
        the won numbers
      • evaluate

        public static void evaluate​(de.alpharogroup.lottery.drawings.DrawnLotteryNumbers drawnLotteryNumbers,
                                    de.alpharogroup.lottery.ticket.LotteryTicket playedLotteryTicket)
        Evaluate the given lottery ticket from the given drawn numbers.
        Parameters:
        drawnLotteryNumbers - the drawn lottery numbers
        playedLotteryTicket - the played lottery ticket
      • setWinCategories

        public static void setWinCategories​(de.alpharogroup.lottery.evaluation.EvaluatedLotteryNumbers evaluatedLotteryNumbers)