Dirk Bergstrom was heard to exclaim, On 11/27/06 23:03:
> Dirk Bergstrom was heard to exclaim, On 11/27/06 22:16:
>> The only think I can think of is this, which looks offensively clunky to me:
>> global HashMap stash;
>> rule "a rule"
>> when
>> stash.put("a rule", 7)
>> SomeObject( aField > (stash.get("a rule")) )
>> then
>> takeSomeAction(stash.get("a rule"))
>> end
> I was wrong. The above doesn't work. So now I'm stuck. Can anyone think of
> a way to do what I'm trying to do?
Sigh, I figured something out five minutes after I sent the message...
I created a class like this:
public class ConstantStash {
private Map<Object, Integer> things = new HashMap<Object, Integer>();
public Integer set(Object key, int value) {
things.put(key, value);
return value;
}
public Integer get(Object key) {
return things.get(key);
}
}
And used it like this:
global ConstantStash stash;
rule "foo"
when
SomeObject( aField > (stash.set("a rule", 7)) )
then
takeSomeAction(stash.get("a rule"))
end
It's still clunky, but at least it looks like it will work.
--
Dirk Bergstrom [EMAIL PROTECTED]
_____________________________________________
Juniper Networks Inc., Computer Geek
Tel: 408.745.3182 Fax: 408.745.8905
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email