Package de.alpharogroup.lottery
Class LotteryExtensions
- java.lang.Object
-
- de.alpharogroup.lottery.LotteryExtensions
-
public final class LotteryExtensions extends java.lang.ObjectThe classLotteryExtensionsprovides 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 intcalculateDraws(de.alpharogroup.lottery.played.LotteryPlayedNumbers lotteryPlayedNumbers, int winningNumbersCount)Calculate draws for statistics.static intcalculateDraws(de.alpharogroup.lottery.played.LotteryPlayedNumbers lotteryPlayedNumbers, int winningNumbersCount, int maxIterations)Calculate draws for statistics.static intcalculateDraws(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 intcalculateDraws(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 doublecalculateElapsedTimeInSeconds(long startTime)Calculate elapsed time in seconds from the given start time as long to the current system time.static de.alpharogroup.lottery.evaluation.EvaluatedLotteryNumberscheckResult(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 voidevaluate(de.alpharogroup.lottery.drawings.DrawnLotteryNumbers drawnLotteryNumbers, de.alpharogroup.lottery.ticket.LotteryTicket playedLotteryTicket)Evaluate the given lottery ticket from the given drawn numbers.static voidsetWinCategories(de.alpharogroup.lottery.evaluation.EvaluatedLotteryNumbers evaluatedLotteryNumbers)
-
-
-
Method Detail
-
calculateDraws
public static int calculateDraws(de.alpharogroup.lottery.played.LotteryPlayedNumbers lotteryPlayedNumbers, int winningNumbersCount)Calculate draws for statistics.- Parameters:
lotteryPlayedNumbers- the lottery played numberswinningNumbersCount- 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 numberswinningNumbersCount- the winning numbers countmaxIterations- 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 ticketlotteryWinCategory- 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 ticketlotteryWinCategory- the lottery win categorymaxIterations- 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 aEvaluatedLotteryNumbersobject that keep the winning numbers.- Parameters:
drawnLotteryNumbers- the drawn lottery numbers are the numbers that are drawn from the lottery corporationlotteryPlayedNumbers- 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 numbersplayedLotteryTicket- the played lottery ticket
-
setWinCategories
public static void setWinCategories(de.alpharogroup.lottery.evaluation.EvaluatedLotteryNumbers evaluatedLotteryNumbers)
-
-