org.drools.verifier.misc
Class FindMissingNumber

java.lang.Object
  extended by org.drools.verifier.misc.FindMissingNumber

public class FindMissingNumber
extends Object


Field Summary
static int MIN_NUMBER_OF_RESTRICTIONS
           
 
Constructor Summary
FindMissingNumber()
           
 
Method Summary
protected static Number findMultiplicationPattern(BigDecimal[] numbers)
          Looks for multiplication pattern, on each step x multiplied or divided.
protected static Number findSumPattern(BigDecimal[] numbers)
          Looks for sum pattern, on each step x is added or removed.
static Number testForPattern(Collection<NumberRestriction> 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
 

Field Detail

MIN_NUMBER_OF_RESTRICTIONS

public static final int MIN_NUMBER_OF_RESTRICTIONS
See Also:
Constant Field Values
Constructor Detail

FindMissingNumber

public FindMissingNumber()
Method Detail

testForPattern

public static Number testForPattern(Collection<NumberRestriction> 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 Number findSumPattern(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 Number findMultiplicationPattern(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.


Copyright © 2001-2013 JBoss Inc.. All Rights Reserved.