(defrule to-have-and-have-not (Person (banks ?banks &: (and (?banks contains "City") (not (?banks contains "River"))))) => ... )
The rule where you want to find a person that has a certain bank shouldn't be a problem now, right? -W On Mon, Dec 15, 2008 at 9:55 AM, kai <[email protected]> wrote: > > > ---------- Forwarded message ---------- > From: kai <[email protected]> > Date: Mon, Dec 15, 2008 at 4:51 PM > Subject: How to write a rule to match an item in a java arraylist? > To: [email protected] > > > Hi all, > > I am new to Jess and would like to know if the following is possible to > define in a Jess rule... > > I have a java class like the following: > class Person > { > private List<String> banks = new ArrayList(); > public List<String> getBanks() > { > return banks; > } > > } > > I want to define a rule that will be fired when a person has certain Bank > within their Banks list... > > for example: > > I want to write a rule that will be fired when "Bank1" is one of the String > in that person's "Banks" list > and another rule that will be fired if "Bank1" but not "Bank2" in the > Person's Bank list? > > Possible? > > Thanks a lot for your help > > Kai > >
