<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3132" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=942593315-01022008><FONT face=Arial
color=#0000ff size=2>Hi,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=942593315-01022008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=942593315-01022008><FONT face=Arial
color=#0000ff size=2>Yep, this can be done with the
following:-</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=942593315-01022008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=942593315-01022008><FONT face="Courier New"
color=#0000ff size=2>rule "largest X"</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=942593315-01022008><FONT
face="Courier New"> <FONT color=#0000ff
size=2>when</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=942593315-01022008><FONT
face="Courier New"> <FONT
color=#0000ff size=2>X ( $v : value )</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=942593315-01022008><FONT
face="Courier New"> <FONT
color=#0000ff size=2>not X (value > $v)</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=942593315-01022008><FONT
face="Courier New"> <FONT color=#0000ff
size=2>then</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=942593315-01022008><FONT
face="Courier New"> <FONT
color=#0000ff size=2>// $v is the maximum</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=942593315-01022008><FONT face="Courier New"
color=#0000ff size=2>end</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=942593315-01022008><FONT face="Courier New"
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=942593315-01022008><FONT face="Courier New"
color=#0000ff size=2>
<DIV dir=ltr align=left><SPAN class=942593315-01022008><FONT face="Courier New"
color=#0000ff size=2>rule "lowest X"</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=942593315-01022008><FONT
face="Courier New"> <FONT color=#0000ff
size=2>when</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=942593315-01022008><FONT
face="Courier New"> <FONT
color=#0000ff size=2>X ( $v : value )</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=942593315-01022008><FONT
face="Courier New"> <FONT
color=#0000ff size=2>not X (value < $v)</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=942593315-01022008><FONT
face="Courier New"> <FONT color=#0000ff
size=2>then</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=942593315-01022008><FONT
face="Courier New"> <FONT
color=#0000ff size=2>// $v is the
minimum</FONT></FONT></SPAN></DIV></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=942593315-01022008><FONT face="Courier New"
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=942593315-01022008><FONT face=Arial
color=#0000ff size=2>There are more examples on the wiki.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=942593315-01022008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=942593315-01022008><FONT face=Arial
color=#0000ff size=2>Cheers,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=942593315-01022008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><FONT face=Arial><SPAN class=942593315-01022008><FONT
color=#0000ff size=2>Mike</FONT></SPAN><BR></FONT></DIV>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] <B>On Behalf Of </B>Jai
Vasanth<BR><B>Sent:</B> 01 February 2008 15:14<BR><B>To:</B> Rules Users
List<BR><B>Subject:</B> [rules-users] Querying for a particular object from
working memory<BR></FONT><BR></DIV>
<DIV></DIV>Hi,<BR><BR> Is there a way to query for an object of type X
among a pool of objects of type X in working memory that have the
maximum/minimum value of a particular attribute a1 ?<BR><BR>For
example<BR><BR>if I have a class C<BR><BR>Class C {<BR><BR>int a1;<BR>int
a2;<BR><BR>}<BR><BR>As part of my rules evaluataion I have N instances of C
inserted into working memory c1,c2.....cn. Now I would like to
query for the object that the max value of attribute a1<BR><BR>Is this
possible?<BR><BR>Thanks<BR>Jai <BR></BLOCKQUOTE></BODY></HTML>