org.drools.analytics.accumulateFunction
Class FindMissingNumber
java.lang.Object
org.drools.analytics.accumulateFunction.FindMissingNumber
public class FindMissingNumber
- extends java.lang.Object
Method Summary |
protected static java.lang.Number |
findMultiplicationPattern(java.math.BigDecimal[] numbers)
Looks for multiplication pattern, on each step x multiplied or divided. |
protected static java.lang.Number |
findSumPattern(java.math.BigDecimal[] numbers)
Looks for sum pattern, on each step x is added or removed. |
static java.lang.Number |
testForPattern(java.util.Collection<LiteralRestriction> restrictions)
Test if the values in constraints are in pattern. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MIN_NUMBER_OF_RESTRICTIONS
public static final int MIN_NUMBER_OF_RESTRICTIONS
- See Also:
- Constant Field Values
FindMissingNumber
public FindMissingNumber()
testForPattern
public static java.lang.Number testForPattern(java.util.Collection<LiteralRestriction> restrictions)
- Test if the values in constraints are in pattern.
- Parameters:
restrictions
-
- Returns:
- false if can't find a pattern or constraints list is null or size
of the list is under 3.
findSumPattern
protected static java.lang.Number findSumPattern(java.math.BigDecimal[] numbers)
- Looks for sum pattern, on each step x is added or removed. -x is the same
as +(-x) so this works for both.
- Parameters:
numbers
-
- Returns:
- true if pattern is found.
findMultiplicationPattern
protected static java.lang.Number findMultiplicationPattern(java.math.BigDecimal[] numbers)
- Looks for multiplication pattern, on each step x multiplied or divided.
*x is the same as *(1/x) so this works for both.
- Parameters:
numbers
-
- Returns:
- true if pattern is found.