Hi Steve.
I am not sure what happened, but I tried it and it worked fine (you had
Cell2 as the constructor though...). We have done a lot recently, so perhaps
yours is more then 30 seconds out of date (!).
Things move fast here !
Keep the tests a comin !
Michael.
On 4/4/06, Steven Williams <[EMAIL PROTECTED]> wrote:
>
> I am getting an error when I have something like the following:
>
> rule "test eval"
> when
> cell1 : Cell(value1 : value != 0)
> cell2 : Cell(value2 : value < value1)
> eval(true)
> then
> System.out.println("setting value to " + (value2.intValue() + 1));
> cell2.setValue(value2.intValue() + 1);
> modify(cell2);
> end
>
> where Cell is
>
> public class Cell {
>
> int value = 0;
>
> public Cell2(int value)
> {
> this.value = value;
> }
>
> public int getValue() {
> return value;
> }
>
> public void setValue(int value) {
> this.value = value;
> }
> }
>
> The error is
>
> Caused by: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
> at java.util.ArrayList.RangeCheck(ArrayList.java:547)
> at java.util.ArrayList.get(ArrayList.java:322)
> at org.drools.reteoo.TupleSource.propagateRetractTuple(
> TupleSource.java
> :181)
> at org.drools.reteoo.EvalConditionNode.retractTuple(
> EvalConditionNode.java:150)
> at org.drools.reteoo.TupleSource.propagateRetractTuple(
> TupleSource.java
> :168)
> at org.drools.reteoo.JoinNode.modifyObject(JoinNode.java:312)
> at org.drools.reteoo.ObjectSource.propagateModifyObject(
> ObjectSource.java:138)
> at org.drools.reteoo.ObjectTypeNode.modifyObject(ObjectTypeNode.java
> :162)
> at org.drools.reteoo.Rete.modifyObject(Rete.java:171)
> at org.drools.reteoo.RuleBaseImpl.modifyObject(RuleBaseImpl.java:197)
> at org.drools.reteoo.WorkingMemoryImpl.modifyObject(
> WorkingMemoryImpl.java:665)
> at org.drools.base.DefaultKnowledgeHelper.modifyObject(
> DefaultKnowledgeHelper.java:80)
> at testremover.Test_eval_0.consequence(Test_eval_0.java:22)
> at testremover.Test_eval_0ConsequenceInvoker.evaluate
> (Test_eval_0ConsequenceInvoker.java:26)
> at org.drools.common.Agenda.fireActivation(Agenda.java:321)
> ... 19 more
>
> When I remove the eval it works.
>
> cheers
> Steve
>
> --
> Steven Williams
>
> Supervising Consultant
>
> Object Consulting
> Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
> [EMAIL PROTECTED]
> www.objectconsulting.com.au
>
> consulting | development | training | support
> our experience makes the difference
>
>