Hi All,
I am trying to create definstances on a set of beans which has an ArrayList
in it with out much success. I am enclosing the error log and the code
snippets here. I appreciate any help indicating where i am going wrong.
public interface Test1Intf {
public String getName();
public void setName(String name);
public String getClli();
public void setClli(String clli);
public String getLocation();
public void setLocation(String location);
public int getNetPlane();
public void setNetPlane(int netPlane)
public ArrayList getLinks();
public void setLinks(ArrayList aList);
public void addLink(Link link);
public void removeLink(Link link);
}
public interface Test2Intf extends Test1Intf {
public String getType();
public void setType(String type);
}
I have couple of classes
public class Test1 implments Test1Intf {
.......................
}
public class Test2 extends Test1 implements Test2Intf {
...................
}
Now i have a main Program Test.java with the following code.
Rete rete = new Rete();
rete.addUserpackage((Userpackage) new ViewFunctions());
// Read in the rules
rete.executeCommand("(batch jess/examples/pumps/test.clp)");
rete.executeCommand("(reset)");
rete.executeCommand("(watch all)");
// Create the Beans
Test1Intf t1 = new Test1("T1Name1", "T1Clli1", "T1Loc1", 1);
Test2Intf t4 = new Test2("T2Name4", "T2Clli4", "T2Loc1", 1, "type2");
// Tell Jess about them
rete.definstance("test1", t1, true);
rete.definstance("test2", t4, true);
t1.addLink("link1");
t4.addLink("link4");
t4.addLink("link44");
rete.executeCommand("(run)");
My test.clp looks likes this
(defclass test1 jess.examples.pumps.Test1Intf)
(defclass test2 jess.examples.pumps.Test2Intf extends test1)
(defrule testbeans1
(test1 (netPlane 1) (name ?name) (clli "T1Clli1"))
=>
(printout t "The NE matched is :" ?name crlf)
)
(matches testbeans1)
(defrule testbeans2
(test2 (name ?name) (clli ?clli) (netPlane 1) (link ?link)
=>
(printout t "The NE matched is :" ?name ?link crlf)
)
I am getting the following error. Where am i going wrong?
java jess.examples.pumps.Test
Exception in thread "main" Jess reported an error in routine ValueVector.get
while executing (batch jess/examples/pumps/test.clp).
Message: Bad index -3 in call to get() on this vector: (clli
<External-Address:jess.SerializablePropertyDescriptor> -1 links
<External-Address:jess.SerializablePropertyDescriptor> -1 location
<External-Address:jess.SerializablePropertyDescriptor> -1 name
<External-Address:jess.SerializablePropertyDescriptor> -1 netPlane
<External-Address:jess.SerializablePropertyDescriptor> -1 OBJECT nil 2048).
Program text: ( batch jess/examples/pumps/test.clp ) at line 1.
at jess.ValueVector.get(ValueVector.java:77)
at jess.Deftemplate.getSlotType(Deftemplate.java:252)
at jess.Jesp.parsePattern(Jesp.java:1203)
at jess.Jesp.parseLHS(Jesp.java:1075)
at jess.Jesp.doParseDefrule(Jesp.java:886)
at jess.Jesp.parseDefrule(Jesp.java:848)
at jess.Jesp.parseSexp(Jesp.java:158)
at jess.Jesp.parse(Jesp.java:61)
at jess.Batch.batch(Batch.java:42)
at jess.Batch.call(Batch.java:57)
at jess.FunctionHolder.call(FunctionHolder.java:37)
at jess.Funcall.execute(Funcall.java:247)
at jess.Jesp.parseAndExecuteFuncall(Jesp.java:1520)
at jess.Jesp.parseSexp(Jesp.java:180)
at jess.Jesp.parse(Jesp.java:61)
at jess.Rete.executeCommand(Rete.java:958)
at jess.examples.pumps.Test.main(Test.java:12)
Thanks for the help
Satish
---------------------------------------------------------------------
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]
---------------------------------------------------------------------