Hello there,
I'm playing around with jess.Value objects as Java properties which are
seen as fact slots in Jess.
Now I have the problem, that rules don't match as expected. I don't
completely understand the algorithm of how Jess determines the slot type
here ... what would be the right way to do this?
Many thanks in advance,
tge
The class:
=======================
public class Attr
{
private String objName;
private Value value = null;
Rete rete = null;
[...]
public Value getValue()
{
return value;
}
public void setValue(Value v)
{
Value tmp = value;
value = v;
pcs.firePropertyChange("value", tmp, value);
}
public void setValue(int v)
{
try
{
setValue(new LongValue(v));
// I also tried this: no change ...
// value = (new
LongValue(v)).resolveValue(rete.getGlobalContext());
}
catch(JessException e){}
}
[...]
The Jess code:
=======================
(defclass Attr Attr)
(defrule match-attrs
(Attr (objName ?n) (value ?v&~1))
=>
(printout t "**** There is an attr '" ?n "': " ?v crlf)
)
What happens:
=======================
java -classpath .:/opt/Jess60a3/jess-6.1a3.jar m1
MAIN::match-attrs: +1+1+1+t
==> Focus MAIN
==> f-0 (MAIN::initial-fact)
==> f-1 (MAIN::idle)
==> f-2 (MAIN::Attr (class <External-Address:java.lang.Class>) (objName
"Schnaggel") (value 1) (OBJECT <External-Address:Attr>))
==> Activation: MAIN::match-attrs : f-2
FIRE 1 MAIN::match-attrs f-2
**** There is an attr 'Schnaggel': 1
Here it says, that fact f-1 has '(value 1)' so in theory the rule must
NOT match, but it does ... (???)
--
Thomas Gentsch
--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------