Michael Neale <michael.neale <at> gmail.com> writes:

> 
> can you try changing the name of the funciton (and also make it a valid
> function).
> 
> On 5/4/06, Alberto Siena <siena <at> itc.it> wrote:
> >
> > Mark Proctor <mproctor <at> codehaus.org> writes:
> >
> > >
> > > Strings are immutable the following would not work as you expect.
> > >
> > > function void modifyString( String s )
> > > {
> > >       s = "changed";
> > > }
> > >
> > > However it shouldn't give the error you have. I'll look into it.
> > >
> > > Mark
> > >
> >
> >
> > Thanks, I'll wait for that
> >
> > Alberto
> >
> >
> 


This is a more realistic piece of code that gives error (btw, on the mailing
list archive I found some other questions about functions in the "when" block
and I tried all the combinations but without success):


package tropostest;

public class Node
{
        public String name = "A node";
        public float value = 0;
        
        public Goal() {}
        public Goal( String a_name )
        {
                name = a_name;
        }

        public float getValue()
        {
                return value;
        }
        public void setValue( float f )
        {
                value = f;
        }
        
        public String getName()
        {
                return name;
        }
        public void setName( String n )
        {
                name = n;
        }
}


package ruletest

import tropostest.Node;

function void propagateValue( Goal g1, Goal g2 )
{
        g2.setSat( g1.getSat() );
}

rule "A Rule"
        
        when
                g1: Goal( v1: value );
                g2: Goal( v2: value < v1 );
                
        then 
                propagateValue( g1, g2 );
                modify( g2 );
                
end


Reply via email to