can I ask to have that in a zip? just to make sure it is as you have it?
Thanks. On 5/9/06, Alberto Siena <[EMAIL PROTECTED]> wrote:
Michael Neale <michael.neale <at> gmail.com> writes: > > Sorry wasn't able to reproduce, the class you provided looks slightly > mangled - there is no "getSat" method is the error I get. > Oh sorry, I made an adaptation without verifying it. Try this one. If in the "then" clause you comment the function and uncomment the assignment the error disappears. Alberto package dtest; public class Node { public float value = 0; public Node( float v ) { value = v; } public float getValue() { return value; } public void setValue( float f ) { value = f; } } package dtest; public class Relation { public Node source = null; public Node target = null; public Relation( Node s, Node t ) { source = s; target = t; } public Node getSource() { return source; } public void setSource( Node n ) { source = n; } public Node getTarget() { return target; } public void setTarget( Node n ) { target = n; } } package dtest.rules import dtest.Node; import dtest.Relation; function void propagateValue( Node g1, Node g2 ) { g2.setValue( g1.getValue() ); } rule "A Rule" when r : Relation( sn : source, en : target ); g1 : Node( s1: value > 0 ); g2 : Node( s2 : value < s1 ); eval( g1 == sn ); eval( g2 == en ); then propagateValue( g1, g2 ); #g2.value = g1.value; modify( g2 ); end try { //load up the rulebase RuleBase ruleBase = readRule( "/RuleTest.drl" ); WorkingMemory workingMemory = ruleBase.newWorkingMemory(); Node n1 = new Node( 1.0f ); Node n2 = new Node( 0.0f ); Node n3 = new Node( 0.0f ); Relation r1 = new Relation( n1, n2 ); Relation r2 = new Relation( n2, n3 ); workingMemory.assertObject( n1 ); workingMemory.assertObject( n2 ); workingMemory.assertObject( n3 ); workingMemory.assertObject( r1 ); workingMemory.assertObject( r2 ); System.out.println( "Initial state ( " + n1.value + ", " + n2.value + ", " + n3.value + ")" ); workingMemory.fireAllRules(); System.out.println( "Final state ( " + n1.value + ", " + n2.value + ", " + n3.value + ")" ); } catch (Throwable t) { t.printStackTrace(); }