global java.lang.Integer count
rule rule1
agenda-group 1
when
//smething
then
count=0;
System.out.println(count); // output is 0
count = count +1;
System.out.println(count); // output is 1
drools.setFocus(2);
end
rule rule2
agenda-group 2
when
hey,
i know that the number is local to the function so it wont show the
incremented value, when the function is called...
but i ve declared the global n m not redeclaring it in the rules !
regards,
Abhinay
--
View this message in context:
It may not be quite so simple as that - using int to illustrate a
problem occuring with Integer is misleading.
An Integer is an immutable object.
Integer a = Integer.valueOf( 42 );
a += 1
You'll certainly still have an Integer object available via 'a', but
it's *not* the one containing 42
setGlobal() works for me !!...tnxx !! :) :)
--
View this message in context:
http://drools.46999.n3.nabble.com/Simple-Global-Error-tp4018697p4018703.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
On 16/07/2012, Esteban Aliverti esteban.alive...@gmail.com wrote:
No matter the type of a variable or whether it is inmutable or not, if you
reassign a variable inside a method you are not going to see that change
outside the method.
void method(){
x += 1;
}
If x is a class member, the