Thanks for the reply.
Firstly, I have the getter and setter for bean properties.
Secondly, In (demandPool (demands $?first ?demand&:(eq (get-member ?demand) "x") $?rest))
what does it mean by $?first and $?rest? Does it mean it will iterate starting from first to the end?
Thirdy, in
(demandPool (types ?t1 ?t2 $?more))
what does it mean by patterns types ?t1 ?t2 does it mean it will match those patterns of types 1 2 or 2 1 or 1 3 etc? What does it mean by $?more? Does it mean 1 2 3 etc patterns?
Is there any documentation about $?more , $?first $?rest, $?length etc any where?
Fourthly,if I want to bind the matching demand/s how can I do that?
Is it like
(demandPool (demands $?first (bind ?matchedDemand (?demand&:(eq (get-member ?demand) "x") )$?rest))
Thanks
Bhaskar
[EMAIL PROTECTED] wrote:
I think bhaskar yallala wrote:
>
> class DeandPool{
>
> int[] types;
>
> Demand[] demands;
>
> }
First of all, defclasses turn JavaBean properties -- not member
variables -- into template slots. You'll need "int[] getTypes()" and
"Demand[] getDemands()" (and perhaps the equivalent setter methods,
too) before these will show up as slots.
>
> (defrule checkPool
>
> (demandPool (types $?types)(demands $?demands)(OBJECT ?demandPool))
>
>
> I want to write rule where on LHS, fire rule only if type is > 2..
"?type" (or ?types, you've written both) is a list, and so can't be
compared to a number. If you want to compare the length of this list
then you could write
(demandPool (types $?types&:(> (length$ ?types) 2)))
Although the be! st way to do it is to write a pattern that matches only
when there are two or more types, like
(demandPool (types ?t1 ?t2 $?more))
>
> And also I want to write a rule where demand.type="x", then only fire.
When this is true for at least one Demand object in the demands slot?
You could write something like
(demandPool (demands $?first ?demand&:(eq (get-member ?demand) "x") $?rest))
---------------------------------------------------------
Ernest Friedman-Hill
Science and Engineering PSEs Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://herzberg.ca.sandia.gov
--------------------------------------------------------------------
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]
--------------------------------------------------------------------
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!