[rules-users] Specifying Infinite Limits

droolster quant.coder at gmail.com
Fri Jun 28 11:11:13 EDT 2013


Hello,

I have the following code to do some interval checking:

declare Classification
	low : BigInteger
	high : BigInteger
	score : int
end

rule "classifications"

	when
	
	then
		insert (new Classification(new BigInteger("-1000000000000"), new
BigInteger("1000000"), 1));
		insert (new Classification(new BigInteger("1000000"), new
BigInteger("5000000"), 2));
		insert (new Classification(new BigInteger("5000000"), new
BigInteger("25000000"), 3));
		insert (new Classification(new BigInteger("25000000"), new
BigInteger("25000000000000"), 4));
		
end

rule "Foo"

	when
		$a: Classification( $low : getLow(), $high : getHigh() )
		$b: Data( bar > $low && bar < $high )
	then
		System.out.println($a.getScore());
		
end

It works fine but I was wondering if there is a more elegant way to specify
the lowest and highest interval limits. At the moment, as you can see, I
have set it to a very low number and a very high number in the context of my
problem. For my problem specification, these limits should really be
reached. Can anyone tell me a robust way of specifying these lowest and
highest limits without putting arbitarily low and high numbers.

Thanks in advance for your help.

Regards.



--
View this message in context: http://drools.46999.n3.nabble.com/Specifying-Infinite-Limits-tp4024626.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list