You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(233) |
Sep
(199) |
Oct
(206) |
Nov
(185) |
Dec
(270) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(232) |
Feb
(426) |
Mar
(623) |
Apr
(592) |
May
(506) |
Jun
(389) |
Jul
(160) |
Aug
(3) |
Sep
(1) |
Oct
(1) |
Nov
(2) |
Dec
(5) |
2007 |
Jan
(1) |
Feb
(1) |
Mar
(2) |
Apr
(2) |
May
(4) |
Jun
(2) |
Jul
|
Aug
(3) |
Sep
(5) |
Oct
(9) |
Nov
(6) |
Dec
(6) |
2008 |
Jan
(3) |
Feb
|
Mar
(1) |
Apr
(3) |
May
(3) |
Jun
(5) |
Jul
(10) |
Aug
(2) |
Sep
(12) |
Oct
(10) |
Nov
(54) |
Dec
(49) |
2009 |
Jan
(19) |
Feb
(13) |
Mar
(20) |
Apr
(24) |
May
(44) |
Jun
(29) |
Jul
(32) |
Aug
(10) |
Sep
(7) |
Oct
(10) |
Nov
(4) |
Dec
(17) |
2010 |
Jan
(14) |
Feb
(5) |
Mar
(23) |
Apr
(50) |
May
(31) |
Jun
(9) |
Jul
(5) |
Aug
(4) |
Sep
(7) |
Oct
(5) |
Nov
(2) |
Dec
(3) |
2011 |
Jan
(12) |
Feb
(5) |
Mar
(5) |
Apr
(3) |
May
(4) |
Jun
(3) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2012 |
Jan
(1) |
Feb
(2) |
Mar
|
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
(4) |
Aug
(1) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
2015 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <jbo...@li...> - 2006-04-24 10:19:29
|
Author: arvinder Date: 2006-04-24 06:19:24 -0400 (Mon, 24 Apr 2006) New Revision: 3940 Modified: labs/jbossesb/branches/JBESB-13/ESBCore/classes/org/jboss/soa/esbcore/deploy/bootstrap/container/JBossESBKernel.java labs/jbossesb/branches/JBESB-13/ESBCore/classes/org/jboss/soa/esbcore/deploy/bootstrap/container/JBossESBKernelConstants.java Log: Added support for main() booting and added placeholders for adding gnu getopt Modified: labs/jbossesb/branches/JBESB-13/ESBCore/classes/org/jboss/soa/esbcore/deploy/bootstrap/container/JBossESBKernel.java =================================================================== --- labs/jbossesb/branches/JBESB-13/ESBCore/classes/org/jboss/soa/esbcore/deploy/bootstrap/container/JBossESBKernel.java 2006-04-24 09:29:52 UTC (rev 3939) +++ labs/jbossesb/branches/JBESB-13/ESBCore/classes/org/jboss/soa/esbcore/deploy/bootstrap/container/JBossESBKernel.java 2006-04-24 10:19:24 UTC (rev 3940) @@ -41,26 +41,51 @@ */ public class JBossESBKernel extends BasicBootstrap { - /** The deployer */ + /** The deployer */ protected BeanXMLDeployer deployer; - /** The core deployments, ideally we want to separate - * this into core & services */ + /** The core deployments, ideally we want to separate this into core & services */ protected List deployments = CollectionsFactory.createCopyOnWriteList(); /** The arguments */ protected String[] args; + /** Set system default configuration, this can be overridden from main arguments **/ + static + { + System.setProperty(JBossESBKernelConstants.ESB_CORE_CONFIGURATION_PROPERTY, JBossESBKernelConstants.ESB_CORE_CONFIGURATION_DEPLOYMENT); + System.setProperty(JBossESBKernelConstants.ESB_CORE_SERVICE_PROPERTY, JBossESBKernelConstants.ESB_SERVICE_CONFIGURATION_DEPLOYMENT); + } + + + /** - * Bootstrap the kernel from the command line + * Bootstrap the kernel from the command line, see the original jboss + * bootstrapper class org.jboss.Main * * @param args the command line arguments * @throws Exception for any error */ - public static void main(String[] args) throws Exception + public static void main(final String[] args) throws Exception { - JBossESBKernel bootstrap = new JBossESBKernel(args); - bootstrap.run(); + Runnable worker = new Runnable() + { + public void run() + { + try + { + JBossESBKernel bootstrap = new JBossESBKernel(args); + bootstrap.run (); + } + catch (Exception e) + { + System.err.println("Failed to boot JBossESBKernel"); + e.printStackTrace(); + } + } + }; + ThreadGroup threads = new ThreadGroup("jboss"); + new Thread(threads, worker, "main").start(); } /** @@ -81,27 +106,36 @@ public JBossESBKernel(String[] args) throws Exception { super(); + // unsure if we need to keep hold of the arguments. this.args = args; + processCommandLine(args); } /** + * Parse command line arguments using gnu getopt. + * @param args + * @throws Exception + */ + private void processCommandLine(final String[] args) throws Exception + { + // override default start properties + + } + + /** * Start the bootstrap process. * @throws Throwable */ public void bootstrap() throws Throwable { super.bootstrap(); - deployer = new BeanXMLDeployer(getKernel()); - Runtime.getRuntime().addShutdownHook(new Shutdown(this)); - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - // // Core // - for (Enumeration e = cl.getResources(JBossESBKernelConstants.ESB_CORE_CONFIGURATION_DEPLOYMENT); e.hasMoreElements(); ) + for (Enumeration e = cl.getResources(System.getProperty(JBossESBKernelConstants.ESB_CORE_CONFIGURATION_PROPERTY)); e.hasMoreElements(); ) { URL url = (URL) e.nextElement(); deploy(url); @@ -109,12 +143,11 @@ // // Core Services // - for (Enumeration e = cl.getResources(JBossESBKernelConstants.ESB_SERVICE_CONFIGURATION_DEPLOYMENT); e.hasMoreElements(); ) + for (Enumeration e = cl.getResources(System.getProperty(JBossESBKernelConstants.ESB_CORE_SERVICE_PROPERTY)); e.hasMoreElements(); ) { URL url = (URL) e.nextElement(); deploy(url); } - // Validate that everything is ok deployer.validate(); } @@ -131,7 +164,8 @@ { log.info("Deploying " + url); KernelDeployment deployment = deployer.deploy(url); - if(log.isTraceEnabled()) { + if(log.isTraceEnabled()) + { //log.trace("KernelDeployment:BeanFactories=" + deployment.getBeanFactories()); log.trace("KernelDeployment:Bean =" + deployment.getBeans()); log.trace("KernelDeployment:ClassLoader =" + deployment.getClassLoader()); @@ -143,7 +177,7 @@ } /** - * Undeploy a deployment + * Undeploy a running artifact/deployment. * * @param deployment the deployment */ @@ -165,7 +199,8 @@ /** * Utility method used to undeploy and shutdown the kernel. */ - protected void shutdown() { + protected void shutdown() + { log.info("Shutting down"); // We should actually shut down services first so first deregister // them from the registry and then shutdown core services like the Modified: labs/jbossesb/branches/JBESB-13/ESBCore/classes/org/jboss/soa/esbcore/deploy/bootstrap/container/JBossESBKernelConstants.java =================================================================== --- labs/jbossesb/branches/JBESB-13/ESBCore/classes/org/jboss/soa/esbcore/deploy/bootstrap/container/JBossESBKernelConstants.java 2006-04-24 09:29:52 UTC (rev 3939) +++ labs/jbossesb/branches/JBESB-13/ESBCore/classes/org/jboss/soa/esbcore/deploy/bootstrap/container/JBossESBKernelConstants.java 2006-04-24 10:19:24 UTC (rev 3940) @@ -27,6 +27,13 @@ */ public interface JBossESBKernelConstants { + + /** Define the system property key for core **/ + static final String ESB_CORE_CONFIGURATION_PROPERTY = "jboss.soa.esb.core"; + + /** Define the system property key for core **/ + static final String ESB_CORE_SERVICE_PROPERTY = "jboss.soa.esb.services"; + /** The core xml configuration file name */ static final String ESB_CORE_CONFIGURATION_DEPLOYMENT = "jboss-esb-core.xml"; |
From: <jbo...@li...> - 2006-04-24 09:30:06
|
Author: mic...@jb... Date: 2006-04-24 05:29:52 -0400 (Mon, 24 Apr 2006) New Revision: 3939 Modified: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Language/Section-XML.xml Log: Modified: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Language/Section-XML.xml =================================================================== --- labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Language/Section-XML.xml 2006-04-24 08:21:44 UTC (rev 3938) +++ labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Language/Section-XML.xml 2006-04-24 09:29:52 UTC (rev 3939) @@ -207,9 +207,9 @@ <para>It is possible generally to migrate from drools 2 to drools 3 XML format, if you have existing rulebases you want to port to drools 3. - This may be done with a stylesheet, possibly. Note that Drools 2.x will - not be as trivial to port to drools 3 XML. You would be best to look at - the new DSL features in Drools 3 DRL.</para> + This may be done with a stylesheet, possibly. Note that Drools 2.x DSLs + will not be trivial to port to drools 3 XML. You would be best to look + at the new DSL features in Drools 3 DRL.</para> <para>Note that while "eval" allows you to more or less directly migrate your conditions from Drools 2.x to 3, it is far more powerful, and |
From: <jbo...@li...> - 2006-04-24 08:21:50
|
Author: mic...@jb... Date: 2006-04-24 04:21:44 -0400 (Mon, 24 Apr 2006) New Revision: 3938 Modified: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Language/Section-XML.xml labs/jbossrules/trunk/documentation/manual/en/master.xml Log: doco on XML language Modified: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Language/Section-XML.xml =================================================================== --- labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Language/Section-XML.xml 2006-04-24 07:04:21 UTC (rev 3937) +++ labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Language/Section-XML.xml 2006-04-24 08:21:44 UTC (rev 3938) @@ -2,7 +2,7 @@ <section> <title>XML Rule Language</title> - <para>Drools also supports a "native" <indexterm> + <para>As an option, Drools also supports a "native" <indexterm> <primary>XML</primary> </indexterm> rule language as an alternative to DRL. This allows you to capture and manage your rules as XML data. Just like the non-XML DRL format, @@ -157,113 +157,81 @@ <para>The rule has a LHS and RHS (conditions and consequence) sections. The RHS is simple, it is just a block of semantic code that will be executed when the rule is activated. The LHS is slightly more complicated, - </para> + certainly more so then Drools 2.x.</para> - <example> - <title>Some more examples</title> + <para>A key element of the LHS is the Column element. This allows you to + specify a type (class) and perhaps bind a variable to an instance of that + class. Nested under the column object are constraints that have to be met. + The Predicate and Return Value constraints allow java expressions to be + embedded.</para> - <programlisting>#This is a comment to be ignored. -[when]There is a Person with name of "{name}"=Person(name=="{name}") -[when]Person is at least {age} years old and lives in "{location}"=Person(age > {age}, location=="{location}") -[then]Log "{message}"=System.out.println("{message}"); -[when]And = and</programlisting> - </example> - - <para>Referring to the above examples, this would render the following - input as shown below: <example> - <title>Some examples as processed</title> - - <programlisting>There is a Person with name of "kitty" ---> Person(name="kitty") -Person is at least 42 years old and lives in "atlanta" ---> Person(age > 42, location="atlanta") -Log "boo" ---> System.out.println("boo"); -There is a Person with name of "bob" and Person is at least 30 years old and lives in "atlanta" - ---> Person(name="kitty") and Person(age > 30, location="atlanta")</programlisting> - </example></para> + <para>That leaves the conditional elements, not, exists, and, or etc. They + work like their DRL counterparts. Elements that are nested under and an + "and" element are logically "anded" together. Likewise with "or" (and you + can nest things further). "Exists" and "Not" work around Columns, to check + for the existence or non existance of a fact meeting its + constraints.</para> </section> <section> <title>Legacy Drools 2.x XML rule format</title> - <para>A good way to get started if you are new to Rules (and DSLs) is just - write the rules as you normally would against your object model. You can - unit test as you go (like a good agile citizen!). Once you feel - comfortable, you can look at extracting a domain language to express what - you are doing in the rules. Note that once you have started using the - "expander" keyword, you will get errors if the parser does not recognise - expressions you have in there - you need to move everything to the DSL. As - a way around this, you can prefix each line with ">" and it will tell - the parser to take that line literally, and not try and expand it (this is - handy also if you are debugging why something isn't working).</para> + <para>The Drools 2.x legacy XML format is somewhat different to the Drools + 3 format that you can see above.</para> - <para>As you work through building up your DSL, you will find that the DSL - configuration stabilises pretty quickly, and that as you add new rules and - edit rules you are reusing the same DSL expressions over and over. The aim - is to make things as fluent as possible.</para> + <para>However, there are some similarities. Basically the imports, globals + (which replace application-data in drools 2.x) work the same. Functions + are also similar, except that they are specified one at a time (in Drools + 2 they where specified in a single block).</para> - <programlisting>#This is a comment to be ignored. -[when]There is a Person with name of "{name}"=Person(name=="{name}") -[when]Person is at least {age} years old and lives in "{location}"=Person(age > {age}, location=="{location}") -[then]Log "{message}"=System.out.println("{message}"); -[when]And = and</programlisting> + <para /> - <para>To use the DSL when you want to compile and run the rules, you will - need to pass the DSL configuration source along with the rule source. - <programlisting>PackageBuilder builder = new PackageBuilder(); -builder.addPackageFromDrl( source, dsl ); -//source is a reader for the rule source, dsl is a reader for the DSL configuration -</programlisting> You will also need to specify the expander by name in the - rule source file: <programlisting>expander your-expander.dsl -</programlisting>Typically you keep the DSL in the same directory as the rule, - but this is not required if you are using the above API (you only need to - pass a reader). Otherwise everything is just the same.</para> + <example> + <title>Drools 2.x xml</title> - <para>You can chain DSL expressions together on one line, as long as it is - clear to the parser what the {tokens} are (otherwise you risk reading in - too much text until the end of the line). The DSL expressions are - processed according to the mapping file, top to bottom in order. You can - also have the resulting rule expressions span lines - this means that you - can do things like:</para> + <programlisting> <rule name="Goodbye Cruel World"> + <parameter identifier="goodbye"> + <class>String</class> + </parameter> - <example> - <programlisting>There is a person called Bob who is happy - Or -There is a person called Mike who is sad -</programlisting> + <java:condition>goodbye.equals("Goodbye")</java:condition> + + <java:consequence> + goodbyeWorld( goodbye ); + </java:consequence> + </rule></programlisting> </example> - <para>Of course this assumes that "Or" is mapped to the "or" conditional - element (which is a sensible thing to do).</para> - </section> + <section> + <title>Migrating to Drools 3</title> - <section> - <title>How it works</title> + <para>It is possible generally to migrate from drools 2 to drools 3 XML + format, if you have existing rulebases you want to port to drools 3. + This may be done with a stylesheet, possibly. Note that Drools 2.x will + not be as trivial to port to drools 3 XML. You would be best to look at + the new DSL features in Drools 3 DRL.</para> - <para>DSLs kick in when the rule is parsed. The DSL configuration is read - and supplied to the parser, so the parser can "expand" the DSL expressions - into the real rule language expressions.</para> + <para>Note that while "eval" allows you to more or less directly migrate + your conditions from Drools 2.x to 3, it is far more powerful, and + performant, to use constraints on columns where possible, as it utilises + the full power of the engine.</para> - <para>When the parser is processing the rules, it will check if an - "expander" representing a DSL is enabled, if it is, it will try to expand - the expression based on the context of where it is the rule. If an - expression can not be expanded, then an error will be added to the - results, and the line number recorded (this insures against typos when - editing the rules with a DSL). At present, the DSL expander is fairly - space sensitive, but this will be made more tolerant in future releases - (including tolerance for a wide range of punctuation).</para> + <example> + <title>Drools 3 XML equivalent</title> - <para>The expansion itself works by trying to match a line against the - expression in the DSL configuration. The values that correspond to the - token place holders are stored in a map based on the name of the token, - and then interpolated to the target mapping. The values that match the - token placeholders are extracted by either searching until the end of the - line, or until a character or word after the token place holder is - matched. The "{" and "}" are not included in the values that are - extracted, they are only used to demarcate the tokens - you should not use - these characters in the DSL expression (but you can in the target).</para> - - <para>Refer to the ExpanderResolver, Expander and DefaultExpander classes - for more indepth information if required. As the parser works off the - Expander and ExpanderResolver interfaces, it is possible to plug in your - own advanced expanders if required.</para> + <programlisting><rule name="my rule"> + <lhs> + <column identifier='goodbye' object-type='String' > + <eval expression='goodbye.equals("Goodbye")'/> + </lhs> + <rhs> + goodbyeWorld( goodbye ); + </rhs> +</rule></programlisting> + </example> + </section> </section> + + <para>Feel free to make use of XSLT to provide all sorts of possibilities + for XML, XSLT and its ilk are what make XML powerful.</para> </section> \ No newline at end of file Modified: labs/jbossrules/trunk/documentation/manual/en/master.xml =================================================================== --- labs/jbossrules/trunk/documentation/manual/en/master.xml 2006-04-24 07:04:21 UTC (rev 3937) +++ labs/jbossrules/trunk/documentation/manual/en/master.xml 2006-04-24 08:21:44 UTC (rev 3938) @@ -74,7 +74,7 @@ <xi:include href="Chapter-Rule_Engine/Section-Rete_Algorithm.xml" /> - <xi:include href="Chapter-Rule_Engine/Section-Leaps_Algorithm.xml" /> + <!-- MISSING !! <xi:include href="Chapter-Rule_Engine/Section-Leaps_Algorithm.xml" /> --> <xi:include href="Chapter-Rule_Engine/Section-Rule_Base.xml" /> @@ -102,6 +102,8 @@ <xi:include href="Chapter-Rule_Language/Section-DSL.xml" /> + <xi:include href="Chapter-Rule_Language/Section-XML.xml" /> + <!--xi:include href="Chapter-Rule_Language/Section-Column.xml" /> <xi:include href="Chapter-Rule_Language/Section-Field_Constraints.xml" /> |
From: <jbo...@li...> - 2006-04-24 07:04:28
|
Author: mla...@jb... Date: 2006-04-24 03:04:21 -0400 (Mon, 24 Apr 2006) New Revision: 3937 Modified: labs/jbossweb/trunk/build.xml Log: Added bindingservice-plugin.jar to the default server. Modified: labs/jbossweb/trunk/build.xml =================================================================== --- labs/jbossweb/trunk/build.xml 2006-04-24 07:03:18 UTC (rev 3936) +++ labs/jbossweb/trunk/build.xml 2006-04-24 07:04:21 UTC (rev 3937) @@ -94,6 +94,7 @@ <include name="conf/**" /> + <include name="lib/bindingservice-plugin.jar" /> <include name="lib/bsh-1.3.0.jar" /> <include name="lib/commons-logging.jar" /> <include name="lib/hsqldb.jar" /> |
From: <jbo...@li...> - 2006-04-24 07:03:25
|
Author: mla...@jb... Date: 2006-04-24 03:03:18 -0400 (Mon, 24 Apr 2006) New Revision: 3936 Modified: labs/jbossweb/trunk/build.properties.default labs/jbossweb/trunk/src/share/resources/ROOT.war/index.html Log: Update version to CR2 Modified: labs/jbossweb/trunk/build.properties.default =================================================================== --- labs/jbossweb/trunk/build.properties.default 2006-04-24 04:55:36 UTC (rev 3935) +++ labs/jbossweb/trunk/build.properties.default 2006-04-24 07:03:18 UTC (rev 3936) @@ -13,7 +13,7 @@ version.major=4 version.minor=0 version.build=4 -version.patch=RC1 +version.patch=CR2 # ----- Vesion Control Flags ----- jboss.version.major=4 Modified: labs/jbossweb/trunk/src/share/resources/ROOT.war/index.html =================================================================== --- labs/jbossweb/trunk/src/share/resources/ROOT.war/index.html 2006-04-24 04:55:36 UTC (rev 3935) +++ labs/jbossweb/trunk/src/share/resources/ROOT.war/index.html 2006-04-24 07:03:18 UTC (rev 3936) @@ -21,7 +21,7 @@ <td width="80%" valign="top" align="left"> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> - <td class="section" colspan="2"><a name="Version">JBoss Web Server Version 4.0.4-RC1</a></td></tr><tr><td width="20px"> + <td class="section" colspan="2"><a name="Version">JBoss Web Server Version 4.0.4-CR2</a></td></tr><tr><td width="20px"> </td> <td><br> <p><div align="center"><h1>It works!</h1></div> |
From: <jbo...@li...> - 2006-04-24 04:55:41
|
Author: mic...@jb... Date: 2006-04-24 00:55:36 -0400 (Mon, 24 Apr 2006) New Revision: 3935 Modified: labs/jbossrules/trunk/documentation/manual/en/Chapter-IDE/Section-QuickStart.xml Log: Modified: labs/jbossrules/trunk/documentation/manual/en/Chapter-IDE/Section-QuickStart.xml =================================================================== --- labs/jbossrules/trunk/documentation/manual/en/Chapter-IDE/Section-QuickStart.xml 2006-04-24 04:51:20 UTC (rev 3934) +++ labs/jbossrules/trunk/documentation/manual/en/Chapter-IDE/Section-QuickStart.xml 2006-04-24 04:55:36 UTC (rev 3935) @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="UTF-8"?> +<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE section PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN" "http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd"> <section> @@ -127,7 +127,19 @@ execution are also added to the classpath in a custom classpath container called Drools Library [3.0]. Rules do not have to be kept in "java" projects at all, this is just a convenience for people who are already - using eclipse as their Java IDE</para> + using eclipse as their Java IDE.</para> + + <para>Important note: The Drools plug in adds a "Drools Builder" + capability to your eclipse instance. This means you can enable a builder + on any project that will build and validate your rules when resources + change. This happens automatically with the Rule Project Wizard, but you + can also enable it manually on any project. One downside of this is if you + have rule files that have a large number of rules (>500 rules per file) + - as it means that the background builder may be doing a lot of work to + build the rules on each change. An option here is to turn off the builder, + or put the large rules into .rule files, where you can still use the rule + editor, but it won't build them in the background - to fully validate the + rules you will need to run them in a unit test of course.</para> </section> <section> @@ -537,13 +549,20 @@ Just click on the right tab below in the DRL Editor, followed by a click on "Generate Rete View".</para> </section> + <section> <title>Large drl files</title> - <para>Depending on the JDK you use, it may be necessary to increase the permanent - generation max size. Both SUN and IBM jdk have a permanent generation, whereas - BEA JRockit does not.</para> - <para>To increase the permanent generation, start eclipse with -XX:MaxPermSize=###m</para> + + <para>Depending on the JDK you use, it may be necessary to increase the + permanent generation max size. Both SUN and IBM jdk have a permanent + generation, whereas BEA JRockit does not.</para> + + <para>To increase the permanent generation, start eclipse with + -XX:MaxPermSize=###m</para> + <para>Example: c:\eclipse\eclipse.exe -XX:MaxPermSize=128m</para> - <para>Rulesets of 4,000 rules or greater should set the permanent generation to atleast 128Mb.</para> + + <para>Rulesets of 4,000 rules or greater should set the permanent + generation to atleast 128Mb.</para> </section> </section> \ No newline at end of file |
From: <jbo...@li...> - 2006-04-24 04:51:26
|
Author: mic...@jb... Date: 2006-04-24 00:51:20 -0400 (Mon, 24 Apr 2006) New Revision: 3934 Added: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Language/Section-XML.xml Log: first cut Added: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Language/Section-XML.xml =================================================================== --- labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Language/Section-XML.xml 2006-04-24 02:49:04 UTC (rev 3933) +++ labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Language/Section-XML.xml 2006-04-24 04:51:20 UTC (rev 3934) @@ -0,0 +1,269 @@ +<?xml version="1.0" encoding="UTF-8"?> +<section> + <title>XML Rule Language</title> + + <para>Drools also supports a "native" <indexterm> + <primary>XML</primary> + </indexterm> rule language as an alternative to DRL. This allows you to + capture and manage your rules as XML data. Just like the non-XML DRL format, + the XML format is parsed into the internal "AST" representation - as fast as + possible (using a SAX parser). There is no external transformation step + required. All the features are available with XML that are available to + DRL.</para> + + <section> + <title>When to use XML</title> + + <para>There are several scenarios that XML is desirable. However, we + recommend that it is not a default choice, as XML is not readily human + readable (unless you like headaches) and can create visually bloated + rules.</para> + + <para>If you do want to edit XML by hand, use a good schema aware editor + that provides nice heirarchical views of the XML, ideally visually + (commercial tools like XMLSpy, Oxygen etc are good, but cost money, but + then so do headache tablets).</para> + + <para>Other scenarious where you may want to use the XML format are if you + have a tool that generates rules from some input (programmatically + generated rules), or perhaps interchange from another rule language, or + from another tool that emits XML (using XSLT you can easily transform + between XML formats). Note you can always generate normal DRL as + well.</para> + + <para>Alternatively you may be embedding drools in a product that already + uses XML for configuration, so you would like the rules to be in an XML + format. You may be creating your own rule language on XML - note that you + can always use the AST objects directly to create your own rule language + as well (the options are many, due to the open architecture).</para> + </section> + + <section> + <title>The XML format</title> + + <para>A full W3C standards (XMLSchema) compliant XSD is provided that + describes the XML language, which will not be repeated here verbatim. A + summary of the language follows.</para> + + <example> + <title>Example <indexterm> + <primary>XML Rule</primary> + </indexterm></title> + + <programlisting><?xml version="1.0" encoding="UTF-8"?> +<package name="com.sample" + xmlns="http://drools.org/drools-3.0" + xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" + xs:schemaLocation="http://drools.org/drools-3.0 drools-3.0.xsd"> + +<import name="java.util.HashMap" /> +<import name="org.drools.*" /> + +<global identifier="x" type="com.sample.X" /> +<global identifier="yada" type="com.sample.Yada" /> + +<function return-type="void" name="myFunc"> + <parameter identifier="foo" type="Bar" /> + <parameter identifier="bada" type="Bing" /> + + <body> + System.out.println("hello world"); + </body> +</function> + +<rule name="my rule"> + <rule-attribute name="salience" value="10" /> + + <lhs> + <column object-type="Foo" /> + </lhs> + + <rhs> + System.out.println( "hello" ); +</rhs> +</rule> +</package> +</programlisting> + </example> + + <para>Referring to the above example: Notice the key parts, the + declaration for the Drools 3, schema, imports, globals (application-data + in drools 2), functions, and the rules. Most of the elements are self + explanatory if you have some understanding of the Drools 3 + features.</para> + + <para>Imports: import the types you wish to use in the rule.</para> + + <para>Globals: These are global objects that can be referred to in the + rules.</para> + + <para>Functions: this is a declaration of functions to be used in the + rules. You have to specify return types, a unique name and parameters, in + the body goes a snippet of code.</para> + + <para>Rule: see below.</para> + + <example> + <title>Detail of rule element</title> + + <programlisting><rule name="my rule"> + <lhs> + + <column object-type="Foo" /> + <column identifier="bar" object-type="Bar" /> + + <column object-type="Foo"> + <literal field-name="field1" evaluator="==" value="value1" /> + <predicate field-name="field1" identifier="var1" expression="1==1" /> + <return-value field-name="field1" evaluator="==" expression="1==1" /> + <field-binding field-name="field1" identifier="var1" /> + <bound-variable field-name="field1" evaluator="==" identifier="var1" /> + </column> + + <not> + <column object-type="Bar" /> + </not> + + <exists> + <column object-type="Bar" /> + </exists> + + <and> + <or> + <column object-type="Bar" /> + </or> + <column object-type="Yada" /> + </and> + + <or> + <and> + <column object-type="Foo" /> + </and> + <column object-type="Zaa" /> + </or> + + <eval expression="1==1" /> + </lhs> + + <rhs> + /* semantic actions here */ + </rhs> +</rule> +</programlisting> + </example> + + <para>Referring to the above rule detail:</para> + + <para>The rule has a LHS and RHS (conditions and consequence) sections. + The RHS is simple, it is just a block of semantic code that will be + executed when the rule is activated. The LHS is slightly more complicated, + </para> + + <example> + <title>Some more examples</title> + + <programlisting>#This is a comment to be ignored. +[when]There is a Person with name of "{name}"=Person(name=="{name}") +[when]Person is at least {age} years old and lives in "{location}"=Person(age > {age}, location=="{location}") +[then]Log "{message}"=System.out.println("{message}"); +[when]And = and</programlisting> + </example> + + <para>Referring to the above examples, this would render the following + input as shown below: <example> + <title>Some examples as processed</title> + + <programlisting>There is a Person with name of "kitty" ---> Person(name="kitty") +Person is at least 42 years old and lives in "atlanta" ---> Person(age > 42, location="atlanta") +Log "boo" ---> System.out.println("boo"); +There is a Person with name of "bob" and Person is at least 30 years old and lives in "atlanta" + ---> Person(name="kitty") and Person(age > 30, location="atlanta")</programlisting> + </example></para> + </section> + + <section> + <title>Legacy Drools 2.x XML rule format</title> + + <para>A good way to get started if you are new to Rules (and DSLs) is just + write the rules as you normally would against your object model. You can + unit test as you go (like a good agile citizen!). Once you feel + comfortable, you can look at extracting a domain language to express what + you are doing in the rules. Note that once you have started using the + "expander" keyword, you will get errors if the parser does not recognise + expressions you have in there - you need to move everything to the DSL. As + a way around this, you can prefix each line with ">" and it will tell + the parser to take that line literally, and not try and expand it (this is + handy also if you are debugging why something isn't working).</para> + + <para>As you work through building up your DSL, you will find that the DSL + configuration stabilises pretty quickly, and that as you add new rules and + edit rules you are reusing the same DSL expressions over and over. The aim + is to make things as fluent as possible.</para> + + <programlisting>#This is a comment to be ignored. +[when]There is a Person with name of "{name}"=Person(name=="{name}") +[when]Person is at least {age} years old and lives in "{location}"=Person(age > {age}, location=="{location}") +[then]Log "{message}"=System.out.println("{message}"); +[when]And = and</programlisting> + + <para>To use the DSL when you want to compile and run the rules, you will + need to pass the DSL configuration source along with the rule source. + <programlisting>PackageBuilder builder = new PackageBuilder(); +builder.addPackageFromDrl( source, dsl ); +//source is a reader for the rule source, dsl is a reader for the DSL configuration +</programlisting> You will also need to specify the expander by name in the + rule source file: <programlisting>expander your-expander.dsl +</programlisting>Typically you keep the DSL in the same directory as the rule, + but this is not required if you are using the above API (you only need to + pass a reader). Otherwise everything is just the same.</para> + + <para>You can chain DSL expressions together on one line, as long as it is + clear to the parser what the {tokens} are (otherwise you risk reading in + too much text until the end of the line). The DSL expressions are + processed according to the mapping file, top to bottom in order. You can + also have the resulting rule expressions span lines - this means that you + can do things like:</para> + + <example> + <programlisting>There is a person called Bob who is happy + Or +There is a person called Mike who is sad +</programlisting> + </example> + + <para>Of course this assumes that "Or" is mapped to the "or" conditional + element (which is a sensible thing to do).</para> + </section> + + <section> + <title>How it works</title> + + <para>DSLs kick in when the rule is parsed. The DSL configuration is read + and supplied to the parser, so the parser can "expand" the DSL expressions + into the real rule language expressions.</para> + + <para>When the parser is processing the rules, it will check if an + "expander" representing a DSL is enabled, if it is, it will try to expand + the expression based on the context of where it is the rule. If an + expression can not be expanded, then an error will be added to the + results, and the line number recorded (this insures against typos when + editing the rules with a DSL). At present, the DSL expander is fairly + space sensitive, but this will be made more tolerant in future releases + (including tolerance for a wide range of punctuation).</para> + + <para>The expansion itself works by trying to match a line against the + expression in the DSL configuration. The values that correspond to the + token place holders are stored in a map based on the name of the token, + and then interpolated to the target mapping. The values that match the + token placeholders are extracted by either searching until the end of the + line, or until a character or word after the token place holder is + matched. The "{" and "}" are not included in the values that are + extracted, they are only used to demarcate the tokens - you should not use + these characters in the DSL expression (but you can in the target).</para> + + <para>Refer to the ExpanderResolver, Expander and DefaultExpander classes + for more indepth information if required. As the parser works off the + Expander and ExpanderResolver interfaces, it is possible to plug in your + own advanced expanders if required.</para> + </section> +</section> \ No newline at end of file |
From: <jbo...@li...> - 2006-04-24 02:49:14
|
Author: mic...@jb... Date: 2006-04-23 22:49:04 -0400 (Sun, 23 Apr 2006) New Revision: 3933 Modified: labs/jbossrules/trunk/documentation/manual/en/Chapter-Install/Section-Install.xml Log: updated as core now inlines ASM Modified: labs/jbossrules/trunk/documentation/manual/en/Chapter-Install/Section-Install.xml =================================================================== --- labs/jbossrules/trunk/documentation/manual/en/Chapter-Install/Section-Install.xml 2006-04-24 02:48:23 UTC (rev 3932) +++ labs/jbossrules/trunk/documentation/manual/en/Chapter-Install/Section-Install.xml 2006-04-24 02:49:04 UTC (rev 3933) @@ -9,7 +9,8 @@ plug in. This will provide you with all the dependencies you need to get going: you can simply create a new rule project and everything will be done for you. Refer to the chapter on the Rule Workbench and IDE for detailed - instructions on this.</para> + instructions on this. Installing the eclipse plugin is generally as simple + as unzipping a file into your eclipse plugin directory.</para> <para>Use of the eclipse plug in is not required. Rule files are just textual input (or spreadsheets as the case may be) and the IDE (also known @@ -39,7 +40,9 @@ <itemizedlist> <listitem> <para>drools-core.jar - this is the core engine, runtime component. - Contains both the RETE engine and the LEAPS engine.</para> + Contains both the RETE engine and the LEAPS engine. This is the only + runtime dependency if you are pre-compiling rules (and deploying via + Package or RuleBase objects).</para> </listitem> <listitem> @@ -51,15 +54,6 @@ </listitem> <listitem> - <para>drools-asm.jar - this is a localised version of the ASM utility - for bytecode generation. Bytecodes are generated to provide fast - access directly to the objects that are used in the engine. This has - been localised using 'jarjar-links' to avoid collisions with other asm - version that may be in your application. This is required by - drools-core.</para> - </listitem> - - <listitem> <para>drools-jsr94.jar - this is the JSR-94 compliant implementation, this is essentially a layer over the drools-compiler component. Note that due to the nature of the JSR-94 specification, not all features @@ -73,8 +67,6 @@ 'compiler' component, which uses the drools-compiler component. This supports both excel and CSV input formats.</para> </listitem> - - </itemizedlist> <para>There are quite a few other dependencies which the above components @@ -95,8 +87,8 @@ etc). This is an optional feature that allows you to keep your runtime very light. You may use drools-compiler to produce rule packages "out of process", and then deploy them to a runtime system. This runtime system - only requires drools-core.jar and drools-asm.jar for execution. This is an - optional deployment pattern, and many people do not need to "trim" their + only requires drools-core.jar for execution. This is an optional + deployment pattern, and many people do not need to "trim" their application this much, but it is an ideal option for certain environments.</para> </section> |
From: <jbo...@li...> - 2006-04-24 02:48:27
|
Author: mic...@jb... Date: 2006-04-23 22:48:23 -0400 (Sun, 23 Apr 2006) New Revision: 3932 Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/IntegrationCases.java Log: JBRULES-236 - tighter tests for error line numbers Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/IntegrationCases.java =================================================================== --- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/IntegrationCases.java 2006-04-24 02:26:27 UTC (rev 3931) +++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/IntegrationCases.java 2006-04-24 02:48:23 UTC (rev 3932) @@ -573,10 +573,18 @@ assertNotNull( ruleErr.getDescr() ); assertTrue( ruleErr.getLine() != -1 ); + assertEquals(3, builder.getErrors().length); + //check that its getting it from the ruleDescr assertEquals( ruleErr.getLine(), ruleErr.getDescr().getLine() ); - assertTrue( builder.getErrors().length > 0 ); + //check the absolute error line number (there are more). + assertEquals(11, ruleErr.getLine()); + + //now check the RHS, not being too specific yet, as long as it has the rules line number, not zero + RuleError rhs = (RuleError) builder.getErrors()[2]; + assertTrue(rhs.getLine() > 7); //not being too specific - may need to change this when we rework the error reporting + } public void testErrorsParser() throws Exception { |
From: <jbo...@li...> - 2006-04-23 18:51:59
|
Author: woolfel Date: 2006-04-23 14:51:54 -0400 (Sun, 23 Apr 2006) New Revision: 3929 Modified: labs/jbossrules/trunk/drools-examples/src/test/java/com/sample/benchmark/SharedNodePerformanceTest.java Log: added GC calls, which improves the performance a bit. peter Modified: labs/jbossrules/trunk/drools-examples/src/test/java/com/sample/benchmark/SharedNodePerformanceTest.java =================================================================== --- labs/jbossrules/trunk/drools-examples/src/test/java/com/sample/benchmark/SharedNodePerformanceTest.java 2006-04-23 18:39:20 UTC (rev 3928) +++ labs/jbossrules/trunk/drools-examples/src/test/java/com/sample/benchmark/SharedNodePerformanceTest.java 2006-04-23 18:51:54 UTC (rev 3929) @@ -157,12 +157,15 @@ long totalload = 0; long totalassert = 0; long totalfire = 0; + Runtime rt = Runtime.getRuntime(); for (int c=0; c < loop; c++) { + rt.gc(); long loadStart = System.currentTimeMillis(); RuleBase ruleBase = readRule(file); long loadEnd = System.currentTimeMillis(); long loadet = loadEnd - loadStart; totalload += loadet; + rt.gc(); System.out.println("time to load " + file + " " + loadet + "ms"); WorkingMemory workingMemory = ruleBase.newWorkingMemory(); @@ -185,6 +188,7 @@ long assertEnd = System.currentTimeMillis(); long assertet = assertEnd - assertStart; totalassert += assertet; + rt.gc(); System.out.println("time to assert " + assertet + " ms"); long fireStart = System.currentTimeMillis(); @@ -195,6 +199,7 @@ System.out.println("time to fireAllRules " + fireet + " ms"); workingMemory.dispose(); + rt.gc(); } System.out.println(file); System.out.println("number of objects asserted " + factCount); @@ -218,12 +223,15 @@ long totalload = 0; long totalassert = 0; long totalfire = 0; + Runtime rt = Runtime.getRuntime(); for (int c=0; c < loop; c++) { + rt.gc(); long loadStart = System.currentTimeMillis(); RuleBase ruleBase = readRule(file); long loadEnd = System.currentTimeMillis(); long loadet = loadEnd - loadStart; totalload += loadet; + rt.gc(); System.out.println("time to load " + file + " " + loadet + "ms"); WorkingMemory workingMemory = ruleBase.newWorkingMemory(); @@ -246,6 +254,7 @@ long assertEnd = System.currentTimeMillis(); long assertet = assertEnd - assertStart; totalassert += assertet; + rt.gc(); System.out.println("time to assert " + assertet + " ms"); long fireStart = System.currentTimeMillis(); @@ -256,6 +265,7 @@ System.out.println("time to fireAllRules " + fireet + " ms"); workingMemory.dispose(); + rt.gc(); } System.out.println(file); System.out.println("number of objects asserted " + factCount); @@ -279,12 +289,15 @@ long totalload = 0; long totalassert = 0; long totalfire = 0; + Runtime rt = Runtime.getRuntime(); for (int c=0; c < loop; c++) { + rt.gc(); long loadStart = System.currentTimeMillis(); RuleBase ruleBase = readRule(file); long loadEnd = System.currentTimeMillis(); long loadet = loadEnd - loadStart; totalload += loadet; + rt.gc(); System.out.println("time to load " + file + " " + loadet + "ms"); WorkingMemory workingMemory = ruleBase.newWorkingMemory(); @@ -307,6 +320,7 @@ long assertEnd = System.currentTimeMillis(); long assertet = assertEnd - assertStart; totalassert += assertet; + rt.gc(); System.out.println("time to assert " + assertet + " ms"); long fireStart = System.currentTimeMillis(); @@ -317,6 +331,7 @@ System.out.println("time to fireAllRules " + fireet + " ms"); workingMemory.dispose(); + rt.gc(); } System.out.println(file); System.out.println("number of objects asserted " + factCount); @@ -336,12 +351,15 @@ long totalload = 0; long totalassert = 0; long totalfire = 0; + Runtime rt = Runtime.getRuntime(); for (int c=0; c < loop; c++) { + rt.gc(); long loadStart = System.currentTimeMillis(); RuleBase ruleBase = readRule(file); long loadEnd = System.currentTimeMillis(); long loadet = loadEnd - loadStart; totalload += loadet; + rt.gc(); System.out.println("time to load " + file + " " + loadet + "ms"); WorkingMemory workingMemory = ruleBase.newWorkingMemory(); @@ -364,6 +382,7 @@ long assertEnd = System.currentTimeMillis(); long assertet = assertEnd - assertStart; totalassert += assertet; + rt.gc(); System.out.println("time to assert " + assertet + " ms"); long fireStart = System.currentTimeMillis(); @@ -374,6 +393,7 @@ System.out.println("time to fireAllRules " + fireet + " ms"); workingMemory.dispose(); + rt.gc(); } System.out.println(file); System.out.println("number of objects asserted " + factCount); @@ -393,12 +413,15 @@ long totalload = 0; long totalassert = 0; long totalfire = 0; + Runtime rt = Runtime.getRuntime(); for (int c=0; c < loop; c++) { + rt.gc(); long loadStart = System.currentTimeMillis(); RuleBase ruleBase = readRule(file); long loadEnd = System.currentTimeMillis(); long loadet = loadEnd - loadStart; totalload += loadet; + rt.gc(); System.out.println("time to load " + file + " " + loadet + "ms"); WorkingMemory workingMemory = ruleBase.newWorkingMemory(); @@ -422,6 +445,7 @@ long assertEnd = System.currentTimeMillis(); long assertet = assertEnd - assertStart; totalassert += assertet; + rt.gc(); System.out.println("time to assert " + assertet + " ms"); long fireStart = System.currentTimeMillis(); @@ -432,6 +456,7 @@ System.out.println("time to fireAllRules " + fireet + " ms"); workingMemory.dispose(); + rt.gc(); } System.out.println(file); System.out.println("number of objects asserted " + factCount); |
From: <jbo...@li...> - 2006-04-23 18:39:23
|
Author: woolfel Date: 2006-04-23 14:39:20 -0400 (Sun, 23 Apr 2006) New Revision: 3928 Added: labs/jbossrules/trunk/drools-examples/src/test/java/com/sample/benchmark/SharedNode2CEPerformanceTest.java Log: adding a new unit test for rules with 2 CE and shared nodes peter Added: labs/jbossrules/trunk/drools-examples/src/test/java/com/sample/benchmark/SharedNode2CEPerformanceTest.java =================================================================== --- labs/jbossrules/trunk/drools-examples/src/test/java/com/sample/benchmark/SharedNode2CEPerformanceTest.java 2006-04-23 18:38:45 UTC (rev 3927) +++ labs/jbossrules/trunk/drools-examples/src/test/java/com/sample/benchmark/SharedNode2CEPerformanceTest.java 2006-04-23 18:39:20 UTC (rev 3928) @@ -0,0 +1,486 @@ +package com.sample.benchmark; + +import junit.framework.TestCase; + +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.Reader; +import java.util.ArrayList; +import java.util.Iterator; + +import org.drools.PackageIntegrationException; +import org.drools.RuleBase; +import org.drools.RuleIntegrationException; +import org.drools.WorkingMemory; +import org.drools.compiler.DrlParser; +import org.drools.compiler.DroolsParserException; +import org.drools.compiler.PackageBuilder; +import org.drools.lang.descr.PackageDescr; +import org.drools.reteoo.RuleBaseImpl; +import org.drools.rule.InvalidPatternException; +import org.drools.rule.Package; + +import com.sample.benchmark.models.Account; +import com.sample.benchmark.models.Address; + +/** + * @author Peter Lin + * + */ +public class SharedNode2CEPerformanceTest extends TestCase { + public SharedNode2CEPerformanceTest() { + super(); + } + + public void setUp() { + + } + + public void tearDown() { + + } + + private static RuleBase readRule(String file) throws IOException, DroolsParserException, RuleIntegrationException, PackageIntegrationException, InvalidPatternException { + //read in the source + Reader reader = + new InputStreamReader( + SharedNode2CEPerformanceTest.class.getResourceAsStream( file ) ); + DrlParser parser = new DrlParser(); + PackageDescr packageDescr = parser.parse( reader ); + + //pre build the package + PackageBuilder builder = new PackageBuilder(); + builder.addPackage( packageDescr ); + Package pkg = builder.getPackage(); + + //add the package to a rulebase + RuleBaseImpl ruleBase = new RuleBaseImpl(); + ruleBase.addPackage( pkg ); + return ruleBase; + } + + /** + * test the performance with 50 facts and 5 rules. The test measures + * the load, assert and fire time. + */ + public void testFiveSharedNodes() { + try { + int factCount = 5000; + String file = "20rules_2CE_5shared.drl"; + int loop = 5; + long totalload = 0; + long totalassert = 0; + long totalfire = 0; + long aveloadmem = 0; + long aveassertmem = 0; + Runtime rt = Runtime.getRuntime(); + for (int c=0; c < loop; c++) { + rt.gc(); + long memt1 = rt.totalMemory(); + long memf1 = rt.freeMemory(); + long used1 = memt1 - memf1; + long loadStart = System.currentTimeMillis(); + RuleBase ruleBase = readRule(file); + long loadEnd = System.currentTimeMillis(); + long memt2 = rt.totalMemory(); + long memf2 = rt.freeMemory(); + long used2 = memt2 - memf2; + long loadet = loadEnd - loadStart; + rt.gc(); + totalload += loadet; + aveloadmem += (used2 - used1); + System.out.println("time to load " + file + + " " + loadet + "ms"); + System.out.println("load memory used " + ((used2-used1)/1024) + " kb"); + WorkingMemory workingMemory = ruleBase.newWorkingMemory(); + ArrayList objects = new ArrayList(); + Account acc = new Account(); + acc.setStatus("standard"); + objects.add(acc); + // create the objects + for (int idx=0; idx < factCount; idx++) { + Address addr = new Address(); + addr.setCity("boston"); + addr.setState("ma"); + addr.setHouseType("single family"); + addr.setStatus("not listed"); + addr.setCountry("usa"); + addr.setAccountId("acc" + idx); + objects.add(addr); + } + Iterator itr = objects.iterator(); + long memt3 = rt.totalMemory(); + long memf3 = rt.freeMemory(); + long used3 = memt3 - memf3; + long assertStart = System.currentTimeMillis(); + while( itr.hasNext() ) { + workingMemory.assertObject(itr.next()); + } + long assertEnd = System.currentTimeMillis(); + long memt4 = rt.totalMemory(); + long memf4 = rt.freeMemory(); + long used4 = memt4 - memf4; + long assertet = assertEnd - assertStart; + totalassert += assertet; + aveassertmem += (used4 - used3); + System.out.println("time to assert " + assertet + + " ms"); + System.out.println("assert memory used " + ((used4-used3)/1024) + " kb"); + long fireStart = System.currentTimeMillis(); + workingMemory.fireAllRules(); + long fireEnd = System.currentTimeMillis(); + long fireet = fireEnd - fireStart; + totalfire += fireet; + System.out.println("time to fireAllRules " + fireet + + " ms"); + workingMemory.dispose(); + rt.gc(); + System.out.println(""); + } + System.out.println(file); + System.out.println("number of objects asserted " + factCount); + System.out.println("average load " + (totalload/loop) + " ms"); + System.out.println("average load mem " + (aveloadmem/1024/loop) + " kb"); + System.out.println("average assert " + (totalassert/loop) + " ms"); + System.out.println("average assert mem " + (aveassertmem/1024/loop) + " kb"); + System.out.println("average fire " + (totalfire/loop) + " ms"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * + * + */ + public void testFourSharedNodes() { + try { + int factCount = 5000; + String file = "20rules_2CE_4shared.drl"; + int loop = 5; + long totalload = 0; + long totalassert = 0; + long totalfire = 0; + Runtime rt = Runtime.getRuntime(); + for (int c=0; c < loop; c++) { + rt.gc(); + long loadStart = System.currentTimeMillis(); + RuleBase ruleBase = readRule(file); + long loadEnd = System.currentTimeMillis(); + long loadet = loadEnd - loadStart; + totalload += loadet; + rt.gc(); + System.out.println("time to load " + file + + " " + loadet + "ms"); + WorkingMemory workingMemory = ruleBase.newWorkingMemory(); + ArrayList objects = new ArrayList(); + Account acc = new Account(); + acc.setStatus("standard"); + objects.add(acc); + // create the objects + for (int idx=0; idx < factCount; idx++) { + Address addr = new Address(); + addr.setCity("boston"); + addr.setState("ma"); + addr.setHouseType("single family"); + addr.setStatus("not listed"); + addr.setCountry("usa" + idx); + objects.add(addr); + } + Iterator itr = objects.iterator(); + long assertStart = System.currentTimeMillis(); + while( itr.hasNext() ) { + workingMemory.assertObject(itr.next()); + } + long assertEnd = System.currentTimeMillis(); + long assertet = assertEnd - assertStart; + totalassert += assertet; + rt.gc(); + System.out.println("time to assert " + assertet + + " ms"); + long fireStart = System.currentTimeMillis(); + workingMemory.fireAllRules(); + long fireEnd = System.currentTimeMillis(); + long fireet = fireEnd - fireStart; + totalfire += fireet; + System.out.println("time to fireAllRules " + fireet + + " ms"); + workingMemory.dispose(); + System.out.println(""); + rt.gc(); + } + System.out.println(file); + System.out.println("number of objects asserted " + factCount); + System.out.println("average load " + (totalload/loop) + " ms"); + System.out.println("average assert " + (totalassert/loop) + " ms"); + System.out.println("average fire " + (totalfire/loop) + " ms"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * + * + */ + public void testThreeSharedNodes() { + try { + int factCount = 5000; + String file = "20rules_2CE_3shared.drl"; + int loop = 5; + long totalload = 0; + long totalassert = 0; + long totalfire = 0; + Runtime rt = Runtime.getRuntime(); + for (int c=0; c < loop; c++) { + long loadStart = System.currentTimeMillis(); + RuleBase ruleBase = readRule(file); + long loadEnd = System.currentTimeMillis(); + long loadet = loadEnd - loadStart; + totalload += loadet; + rt.gc(); + System.out.println("time to load " + file + + " " + loadet + "ms"); + WorkingMemory workingMemory = ruleBase.newWorkingMemory(); + ArrayList objects = new ArrayList(); + Account acc = new Account(); + acc.setStatus("standard"); + objects.add(acc); + // create the objects + for (int idx=0; idx < factCount; idx++) { + Address addr = new Address(); + addr.setCity("boston"); + addr.setState("ma"); + addr.setHouseType("single family"); + addr.setStatus("not listed" + idx); + addr.setCountry("usa"); + objects.add(addr); + } + Iterator itr = objects.iterator(); + long assertStart = System.currentTimeMillis(); + while( itr.hasNext() ) { + workingMemory.assertObject(itr.next()); + } + long assertEnd = System.currentTimeMillis(); + long assertet = assertEnd - assertStart; + totalassert += assertet; + rt.gc(); + System.out.println("time to assert " + assertet + + " ms"); + long fireStart = System.currentTimeMillis(); + workingMemory.fireAllRules(); + long fireEnd = System.currentTimeMillis(); + long fireet = fireEnd - fireStart; + totalfire += fireet; + System.out.println("time to fireAllRules " + fireet + + " ms"); + workingMemory.dispose(); + rt.gc(); + } + System.out.println(file); + System.out.println("number of objects asserted " + factCount); + System.out.println("average load " + (totalload/loop) + " ms"); + System.out.println("average assert " + (totalassert/loop) + " ms"); + System.out.println("average fire " + (totalfire/loop) + " ms"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * + * + */ + public void testTwoSharedNodes() { + try { + int factCount = 5000; + String file = "20rules_2CE_2shared.drl"; + int loop = 5; + long totalload = 0; + long totalassert = 0; + long totalfire = 0; + Runtime rt = Runtime.getRuntime(); + for (int c=0; c < loop; c++) { + long loadStart = System.currentTimeMillis(); + RuleBase ruleBase = readRule(file); + long loadEnd = System.currentTimeMillis(); + long loadet = loadEnd - loadStart; + totalload += loadet; + rt.gc(); + System.out.println("time to load " + file + + " " + loadet + "ms"); + WorkingMemory workingMemory = ruleBase.newWorkingMemory(); + ArrayList objects = new ArrayList(); + Account acc = new Account(); + acc.setStatus("standard"); + objects.add(acc); + // create the objects + for (int idx=0; idx < factCount; idx++) { + Address addr = new Address(); + addr.setCity("boston"); + addr.setState("ma"); + addr.setHouseType("single family" + idx); + addr.setStatus("not listed"); + addr.setCountry("usa"); + objects.add(addr); + } + Iterator itr = objects.iterator(); + long assertStart = System.currentTimeMillis(); + while( itr.hasNext() ) { + workingMemory.assertObject(itr.next()); + } + long assertEnd = System.currentTimeMillis(); + long assertet = assertEnd - assertStart; + totalassert += assertet; + rt.gc(); + System.out.println("time to assert " + assertet + + " ms"); + long fireStart = System.currentTimeMillis(); + workingMemory.fireAllRules(); + long fireEnd = System.currentTimeMillis(); + long fireet = fireEnd - fireStart; + totalfire += fireet; + System.out.println("time to fireAllRules " + fireet + + " ms"); + workingMemory.dispose(); + rt.gc(); + } + System.out.println(file); + System.out.println("number of objects asserted " + factCount); + System.out.println("average load " + (totalload/loop) + " ms"); + System.out.println("average assert " + (totalassert/loop) + " ms"); + System.out.println("average fire " + (totalfire/loop) + " ms"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void testOneSharedNodes() { + try { + int factCount = 5000; + String file = "20rules_2CE_1shared.drl"; + int loop = 5; + long totalload = 0; + long totalassert = 0; + long totalfire = 0; + Runtime rt = Runtime.getRuntime(); + for (int c=0; c < loop; c++) { + long loadStart = System.currentTimeMillis(); + RuleBase ruleBase = readRule(file); + long loadEnd = System.currentTimeMillis(); + long loadet = loadEnd - loadStart; + totalload += loadet; + rt.gc(); + System.out.println("time to load " + file + + " " + loadet + "ms"); + WorkingMemory workingMemory = ruleBase.newWorkingMemory(); + ArrayList objects = new ArrayList(); + Account acc = new Account(); + acc.setStatus("standard"); + objects.add(acc); + // create the objects + for (int idx=0; idx < factCount; idx++) { + Address addr = new Address(); + addr.setCity("boston"); + addr.setState("ma" + idx); + addr.setHouseType("single family"); + addr.setStatus("not listed"); + addr.setCountry("usa"); + objects.add(addr); + } + Iterator itr = objects.iterator(); + long assertStart = System.currentTimeMillis(); + while( itr.hasNext() ) { + workingMemory.assertObject(itr.next()); + } + long assertEnd = System.currentTimeMillis(); + long assertet = assertEnd - assertStart; + totalassert += assertet; + rt.gc(); + System.out.println("time to assert " + assertet + + " ms"); + long fireStart = System.currentTimeMillis(); + workingMemory.fireAllRules(); + long fireEnd = System.currentTimeMillis(); + long fireet = fireEnd - fireStart; + totalfire += fireet; + System.out.println("time to fireAllRules " + fireet + + " ms"); + workingMemory.dispose(); + rt.gc(); + } + System.out.println(file); + System.out.println("number of objects asserted " + factCount); + System.out.println("average load " + (totalload/loop) + " ms"); + System.out.println("average assert " + (totalassert/loop) + " ms"); + System.out.println("average fire " + (totalfire/loop) + " ms"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void testNoneSharedNodes() { + try { + int factCount = 5000; + String file = "20rules_2CE_0shared.drl"; + int loop = 5; + long totalload = 0; + long totalassert = 0; + long totalfire = 0; + Runtime rt = Runtime.getRuntime(); + for (int c=0; c < loop; c++) { + long loadStart = System.currentTimeMillis(); + RuleBase ruleBase = readRule(file); + long loadEnd = System.currentTimeMillis(); + long loadet = loadEnd - loadStart; + totalload += loadet; + rt.gc(); + System.out.println("time to load " + file + + " " + loadet + "ms"); + WorkingMemory workingMemory = ruleBase.newWorkingMemory(); + ArrayList objects = new ArrayList(); + Account acc = new Account(); + acc.setStatus("standard"); + objects.add(acc); + // create the objects + for (int idx=0; idx < factCount; idx++) { + Address addr = new Address(); + addr.setAccountId("acc" + idx); + addr.setCity("boston"); + addr.setState("ma"); + addr.setHouseType("single family"); + addr.setStatus("not listed"); + addr.setCountry("usa"); + objects.add(addr); + } + Iterator itr = objects.iterator(); + long assertStart = System.currentTimeMillis(); + while( itr.hasNext() ) { + workingMemory.assertObject(itr.next()); + } + long assertEnd = System.currentTimeMillis(); + long assertet = assertEnd - assertStart; + totalassert += assertet; + rt.gc(); + System.out.println("time to assert " + assertet + + " ms"); + long fireStart = System.currentTimeMillis(); + workingMemory.fireAllRules(); + long fireEnd = System.currentTimeMillis(); + long fireet = fireEnd - fireStart; + totalfire += fireet; + System.out.println("time to fireAllRules " + fireet + + " ms"); + workingMemory.dispose(); + rt.gc(); + } + System.out.println(file); + System.out.println("number of objects asserted " + factCount); + System.out.println("average load " + (totalload/loop) + " ms"); + System.out.println("average assert " + (totalassert/loop) + " ms"); + System.out.println("average fire " + (totalfire/loop) + " ms"); + } catch (Exception e) { + e.printStackTrace(); + } + } +} |
From: <jbo...@li...> - 2006-04-23 18:38:50
|
Author: woolfel Date: 2006-04-23 14:38:45 -0400 (Sun, 23 Apr 2006) New Revision: 3927 Added: labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_2CE_0shared.drl labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_2CE_1shared.drl labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_2CE_2shared.drl labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_2CE_3shared.drl labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_2CE_4shared.drl labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_2CE_5shared.drl Log: adding rules with 2 CE and different number of shared nodes peter Added: labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_2CE_0shared.drl =================================================================== --- labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_2CE_0shared.drl 2006-04-23 16:25:31 UTC (rev 3926) +++ labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_2CE_0shared.drl 2006-04-23 18:38:45 UTC (rev 3927) @@ -0,0 +1,164 @@ +package org.drools.samples +import com.sample.benchmark.models.Account; +import com.sample.benchmark.models.Address; + +rule rule0 + when + $acc : Account(status == "standard") + $addr : Address(accountId == "acc0", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule0 fired"); +end + +rule rule1 + when + $acc : Account(status == "standard") + $addr : Address(accountId == "acc1", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule1 fired"); +end + +rule rule2 + when + $acc : Account(status == "standard") + $addr : Address(accountId == "acc2", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule2 fired"); +end + +rule rule3 + when + $acc : Account(status == "standard") + $addr : Address(accountId == "acc3", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule3 fired"); +end + +rule rule4 + when + $acc : Account(status == "standard") + $addr : Address(accountId == "acc4", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule4 fired"); +end + +rule rule5 + when + $acc : Account(status == "standard") + $addr : Address(accountId == "acc5", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule5 fired"); +end + +rule rule6 + when + $acc : Account(status == "standard") + $addr : Address(accountId == "acc6", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule6 fired"); +end + +rule rule7 + when + $acc : Account(status == "standard") + $addr : Address(accountId == "acc7", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule7 fired"); +end + +rule rule8 + when + $acc : Account(status == "standard") + $addr : Address(accountId == "acc8", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule8 fired"); +end + +rule rule9 + when + $acc : Account(status == "standard") + $addr : Address(accountId == "acc9", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule9 fired"); +end + +rule rule10 + when + $acc : Account(status == "standard") + $addr : Address(accountId == "acc10", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule10 fired"); +end + +rule rule11 + when + $acc : Account(status == "standard") + $addr : Address(accountId == "acc11", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule11 fired"); +end + +rule rule12 + when + $acc : Account(status == "standard") + $addr : Address(accountId == "acc12", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule12 fired"); +end + +rule rule13 + when + $acc : Account(status == "standard") + $addr : Address(accountId == "acc13", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule13 fired"); +end + +rule rule14 + when + $acc : Account(status == "standard") + $addr : Address(accountId == "acc14", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule14 fired"); +end + +rule rule15 + when + $acc : Account(status == "standard") + $addr : Address(accountId == "acc15", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule15 fired"); +end + +rule rule16 + when + $acc : Account(status == "standard") + $addr : Address(accountId == "acc16", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule16 fired"); +end + +rule rule17 + when + $acc : Account(status == "standard") + $addr : Address(accountId == "acc17", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule17 fired"); +end + +rule rule18 + when + $acc : Account(status == "standard") + $addr : Address(accountId == "acc18", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule18 fired"); +end + +rule rule19 + when + $acc : Account(status == "standard") + $addr : Address(accountId == "acc19", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule19 fired"); +end + Added: labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_2CE_1shared.drl =================================================================== --- labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_2CE_1shared.drl 2006-04-23 16:25:31 UTC (rev 3926) +++ labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_2CE_1shared.drl 2006-04-23 18:38:45 UTC (rev 3927) @@ -0,0 +1,164 @@ +package org.drools.samples +import com.sample.benchmark.models.Account; +import com.sample.benchmark.models.Address; + +rule rule0 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma0", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule0 fired"); +end + +rule rule1 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma1", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule1 fired"); +end + +rule rule2 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma2", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule2 fired"); +end + +rule rule3 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma3", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule3 fired"); +end + +rule rule4 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma4", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule4 fired"); +end + +rule rule5 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma5", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule5 fired"); +end + +rule rule6 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma6", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule6 fired"); +end + +rule rule7 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma7", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule7 fired"); +end + +rule rule8 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma8", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule8 fired"); +end + +rule rule9 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma9", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule9 fired"); +end + +rule rule10 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma10", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule10 fired"); +end + +rule rule11 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma11", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule11 fired"); +end + +rule rule12 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma12", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule12 fired"); +end + +rule rule13 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma13", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule13 fired"); +end + +rule rule14 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma14", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule14 fired"); +end + +rule rule15 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma15", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule15 fired"); +end + +rule rule16 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma16", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule16 fired"); +end + +rule rule17 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma17", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule17 fired"); +end + +rule rule18 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma18", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule18 fired"); +end + +rule rule19 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma19", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule19 fired"); +end + Added: labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_2CE_2shared.drl =================================================================== --- labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_2CE_2shared.drl 2006-04-23 16:25:31 UTC (rev 3926) +++ labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_2CE_2shared.drl 2006-04-23 18:38:45 UTC (rev 3927) @@ -0,0 +1,164 @@ +package org.drools.samples +import com.sample.benchmark.models.Account; +import com.sample.benchmark.models.Address; + +rule rule0 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family0", status == "not listed", country == "usa") + then + System.out.println("rule0 fired"); +end + +rule rule1 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family1", status == "not listed", country == "usa") + then + System.out.println("rule1 fired"); +end + +rule rule2 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family2", status == "not listed", country == "usa") + then + System.out.println("rule2 fired"); +end + +rule rule3 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family3", status == "not listed", country == "usa") + then + System.out.println("rule3 fired"); +end + +rule rule4 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family4", status == "not listed", country == "usa") + then + System.out.println("rule4 fired"); +end + +rule rule5 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family5", status == "not listed", country == "usa") + then + System.out.println("rule5 fired"); +end + +rule rule6 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family6", status == "not listed", country == "usa") + then + System.out.println("rule6 fired"); +end + +rule rule7 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family7", status == "not listed", country == "usa") + then + System.out.println("rule7 fired"); +end + +rule rule8 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family8", status == "not listed", country == "usa") + then + System.out.println("rule8 fired"); +end + +rule rule9 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family9", status == "not listed", country == "usa") + then + System.out.println("rule9 fired"); +end + +rule rule10 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family10", status == "not listed", country == "usa") + then + System.out.println("rule10 fired"); +end + +rule rule11 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family11", status == "not listed", country == "usa") + then + System.out.println("rule11 fired"); +end + +rule rule12 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family12", status == "not listed", country == "usa") + then + System.out.println("rule12 fired"); +end + +rule rule13 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family13", status == "not listed", country == "usa") + then + System.out.println("rule13 fired"); +end + +rule rule14 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family14", status == "not listed", country == "usa") + then + System.out.println("rule14 fired"); +end + +rule rule15 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family15", status == "not listed", country == "usa") + then + System.out.println("rule15 fired"); +end + +rule rule16 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family16", status == "not listed", country == "usa") + then + System.out.println("rule16 fired"); +end + +rule rule17 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family17", status == "not listed", country == "usa") + then + System.out.println("rule17 fired"); +end + +rule rule18 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family18", status == "not listed", country == "usa") + then + System.out.println("rule18 fired"); +end + +rule rule19 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family19", status == "not listed", country == "usa") + then + System.out.println("rule19 fired"); +end + Added: labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_2CE_3shared.drl =================================================================== --- labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_2CE_3shared.drl 2006-04-23 16:25:31 UTC (rev 3926) +++ labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_2CE_3shared.drl 2006-04-23 18:38:45 UTC (rev 3927) @@ -0,0 +1,164 @@ +package org.drools.samples +import com.sample.benchmark.models.Account; +import com.sample.benchmark.models.Address; + +rule rule0 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed0", country == "usa") + then + System.out.println("rule0 fired"); +end + +rule rule1 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed1", country == "usa") + then + System.out.println("rule1 fired"); +end + +rule rule2 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed2", country == "usa") + then + System.out.println("rule2 fired"); +end + +rule rule3 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed3", country == "usa") + then + System.out.println("rule3 fired"); +end + +rule rule4 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed4", country == "usa") + then + System.out.println("rule4 fired"); +end + +rule rule5 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed5", country == "usa") + then + System.out.println("rule5 fired"); +end + +rule rule6 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed6", country == "usa") + then + System.out.println("rule6 fired"); +end + +rule rule7 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed7", country == "usa") + then + System.out.println("rule7 fired"); +end + +rule rule8 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed8", country == "usa") + then + System.out.println("rule8 fired"); +end + +rule rule9 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed9", country == "usa") + then + System.out.println("rule9 fired"); +end + +rule rule10 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed10", country == "usa") + then + System.out.println("rule10 fired"); +end + +rule rule11 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed11", country == "usa") + then + System.out.println("rule11 fired"); +end + +rule rule12 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed12", country == "usa") + then + System.out.println("rule12 fired"); +end + +rule rule13 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed13", country == "usa") + then + System.out.println("rule13 fired"); +end + +rule rule14 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed14", country == "usa") + then + System.out.println("rule14 fired"); +end + +rule rule15 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed15", country == "usa") + then + System.out.println("rule15 fired"); +end + +rule rule16 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed16", country == "usa") + then + System.out.println("rule16 fired"); +end + +rule rule17 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed17", country == "usa") + then + System.out.println("rule17 fired"); +end + +rule rule18 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed18", country == "usa") + then + System.out.println("rule18 fired"); +end + +rule rule19 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed19", country == "usa") + then + System.out.println("rule19 fired"); +end + Added: labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_2CE_4shared.drl =================================================================== --- labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_2CE_4shared.drl 2006-04-23 16:25:31 UTC (rev 3926) +++ labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_2CE_4shared.drl 2006-04-23 18:38:45 UTC (rev 3927) @@ -0,0 +1,164 @@ +package org.drools.samples +import com.sample.benchmark.models.Account; +import com.sample.benchmark.models.Address; + +rule rule0 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa0") + then + System.out.println("rule0 fired"); +end + +rule rule1 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa1") + then + System.out.println("rule1 fired"); +end + +rule rule2 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa2") + then + System.out.println("rule2 fired"); +end + +rule rule3 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa3") + then + System.out.println("rule3 fired"); +end + +rule rule4 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa4") + then + System.out.println("rule4 fired"); +end + +rule rule5 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa5") + then + System.out.println("rule5 fired"); +end + +rule rule6 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa6") + then + System.out.println("rule6 fired"); +end + +rule rule7 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa7") + then + System.out.println("rule7 fired"); +end + +rule rule8 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa8") + then + System.out.println("rule8 fired"); +end + +rule rule9 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa9") + then + System.out.println("rule9 fired"); +end + +rule rule10 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa10") + then + System.out.println("rule10 fired"); +end + +rule rule11 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa11") + then + System.out.println("rule11 fired"); +end + +rule rule12 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa12") + then + System.out.println("rule12 fired"); +end + +rule rule13 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa13") + then + System.out.println("rule13 fired"); +end + +rule rule14 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa14") + then + System.out.println("rule14 fired"); +end + +rule rule15 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa15") + then + System.out.println("rule15 fired"); +end + +rule rule16 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa16") + then + System.out.println("rule16 fired"); +end + +rule rule17 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa17") + then + System.out.println("rule17 fired"); +end + +rule rule18 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa18") + then + System.out.println("rule18 fired"); +end + +rule rule19 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa19") + then + System.out.println("rule19 fired"); +end + Added: labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_2CE_5shared.drl =================================================================== --- labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_2CE_5shared.drl 2006-04-23 16:25:31 UTC (rev 3926) +++ labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_2CE_5shared.drl 2006-04-23 18:38:45 UTC (rev 3927) @@ -0,0 +1,164 @@ +package org.drools.samples +import com.sample.benchmark.models.Account; +import com.sample.benchmark.models.Address; + +rule rule0 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc0") + then + System.out.println("rule0 fired"); +end + +rule rule1 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc1") + then + System.out.println("rule1 fired"); +end + +rule rule2 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc2") + then + System.out.println("rule2 fired"); +end + +rule rule3 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc3") + then + System.out.println("rule3 fired"); +end + +rule rule4 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc4") + then + System.out.println("rule4 fired"); +end + +rule rule5 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc5") + then + System.out.println("rule5 fired"); +end + +rule rule6 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc6") + then + System.out.println("rule6 fired"); +end + +rule rule7 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc7") + then + System.out.println("rule7 fired"); +end + +rule rule8 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc8") + then + System.out.println("rule8 fired"); +end + +rule rule9 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc9") + then + System.out.println("rule9 fired"); +end + +rule rule10 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc10") + then + System.out.println("rule10 fired"); +end + +rule rule11 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc11") + then + System.out.println("rule11 fired"); +end + +rule rule12 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc12") + then + System.out.println("rule12 fired"); +end + +rule rule13 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc13") + then + System.out.println("rule13 fired"); +end + +rule rule14 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc14") + then + System.out.println("rule14 fired"); +end + +rule rule15 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc15") + then + System.out.println("rule15 fired"); +end + +rule rule16 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc16") + then + System.out.println("rule16 fired"); +end + +rule rule17 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc17") + then + System.out.println("rule17 fired"); +end + +rule rule18 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc18") + then + System.out.println("rule18 fired"); +end + +rule rule19 + when + $acc : Account(status == "standard") + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc19") + then + System.out.println("rule19 fired"); +end + |
Author: bagerman Date: 2006-04-23 12:25:31 -0400 (Sun, 23 Apr 2006) New Revision: 3926 Added: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/LeapsQueryResult.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/LeapsQueryResults.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/util/TokenStack.java labs/jbossrules/trunk/drools-core/src/test/java/org/drools/leaps/QueryResultsTest.java labs/jbossrules/trunk/drools-core/src/test/java/org/drools/leaps/util/TokenStackTest.java Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/QueryResult.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/QueryResults.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/Builder.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/ColumnConstraints.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/ConflictResolver.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/FactHandleImpl.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/FactHandleTupleAssembly.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/FactTable.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/Handle.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/HandleFactory.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/LeapsAgenda.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/LeapsRule.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/LeapsTuple.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/NoMatchesFoundException.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/RuleBaseImpl.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/RuleHandle.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/RuleTable.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/Token.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/TokenEvaluator.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/WorkingMemoryImpl.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/util/BaseTableIterator.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/util/ConstrainedFactTableIterator.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/util/Table.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/util/TableIterator.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/util/TableRecord.java Log: JBRULES-225 for leaps based algorithm Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/QueryResult.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/QueryResult.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/QueryResult.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -8,7 +8,7 @@ public class QueryResult { - private Tuple tuple; + protected Tuple tuple; private WorkingMemory workingMemory; private QueryResults queryResults; Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/QueryResults.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/QueryResults.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/QueryResults.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -15,8 +15,8 @@ private Map declarations; - private List results; - private WorkingMemory workingMemory; + protected List results; + protected WorkingMemory workingMemory; public QueryResults(List results, Query query, Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/Builder.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/Builder.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/Builder.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -15,10 +15,6 @@ * limitations under the License. */ - - - - import java.util.ArrayList; import java.util.Iterator; import java.util.List; Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/ColumnConstraints.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/ColumnConstraints.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/ColumnConstraints.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -15,10 +15,6 @@ * limitations under the License. */ - - - - import java.util.List; import org.drools.FactHandle; Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/ConflictResolver.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/ConflictResolver.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/ConflictResolver.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -15,9 +15,6 @@ * limitations under the License. */ - - - import java.util.Comparator; /** Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/FactHandleImpl.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/FactHandleImpl.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/FactHandleImpl.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -15,10 +15,6 @@ * limitations under the License. */ - - - - import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/FactHandleTupleAssembly.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/FactHandleTupleAssembly.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/FactHandleTupleAssembly.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -15,10 +15,6 @@ * limitations under the License. */ - - - - /** * To store all references needed to retract a fact * Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/FactTable.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/FactTable.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/FactTable.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -15,10 +15,6 @@ * limitations under the License. */ - - - - import java.util.HashSet; import java.util.Iterator; import java.util.Set; @@ -110,12 +106,13 @@ // let's only add facts below waterline - added before rule is added // rest would be added to stack automatically - Handle factHandle = new FactHandleImpl( workingMemory.getIdLastFireAllAt(), + Handle startFactHandle = new FactHandleImpl( workingMemory.getIdLastFireAllAt(), null ); - for ( Iterator it = this.tailIterator( factHandle, - factHandle ); it.hasNext(); ) { - workingMemory.pushTokenOnStack( new Token( workingMemory, - (FactHandleImpl) it.next(), + for ( Iterator it = this.tailIterator( startFactHandle, + startFactHandle ); it.hasNext(); ) { + FactHandleImpl handle = (FactHandleImpl) it.next(); + workingMemory.pushTokenOnStack( handle, new Token( workingMemory, + handle, context ) ); } } Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/Handle.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/Handle.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/Handle.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -15,10 +15,6 @@ * limitations under the License. */ - - - - import java.io.Serializable; import org.drools.FactHandle; Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/HandleFactory.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/HandleFactory.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/HandleFactory.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -15,10 +15,6 @@ * limitations under the License. */ - - - - import org.drools.FactHandle; import org.drools.spi.FactHandleFactory; Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/LeapsAgenda.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/LeapsAgenda.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/LeapsAgenda.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -1,4 +1,5 @@ package org.drools.leaps; + /* * Copyright 2005 JBoss Inc * @@ -15,16 +16,13 @@ * limitations under the License. */ - - - - import org.drools.common.Agenda; import org.drools.rule.Query; import org.drools.spi.Activation; import org.drools.spi.ConsequenceException; /** + * * @author Alexander Bagerman * */ Added: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/LeapsQueryResult.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/LeapsQueryResult.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/LeapsQueryResult.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -0,0 +1,54 @@ +package org.drools.leaps; +/* + * Copyright 2005 JBoss Inc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.drools.FactHandle; +import org.drools.QueryResult; +import org.drools.QueryResults; +import org.drools.WorkingMemory; +import org.drools.spi.Tuple; + +/** + * + * @author Alexander Bagerman + * + */ + +public class LeapsQueryResult extends QueryResult { + public LeapsQueryResult(Tuple tuple, WorkingMemory workingMemory, + QueryResults queryResults) { + super( tuple, workingMemory, queryResults ); + } + + public Object get( int i ) { + // adjust for the DroolsQuery object + return super.get(i - 1); + } + + public FactHandle[] getFactHandles() { + // Strip the DroolsQuery fact + FactHandle[] src = super.tuple.getFactHandles( ); + FactHandle[] dst = new FactHandle[src.length - 1]; + System.arraycopy( src, 0, dst, 0, dst.length ); + return dst; + } + + public int size() { + // Adjust for the DroolsQuery object + return super.size() + 1; + } + +} Added: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/LeapsQueryResults.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/LeapsQueryResults.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/LeapsQueryResults.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -0,0 +1,72 @@ +package org.drools.leaps; +/* + * Copyright 2005 JBoss Inc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; + +import org.drools.QueryResult; +import org.drools.QueryResults; +import org.drools.WorkingMemory; +import org.drools.rule.Query; +import org.drools.spi.Tuple; + +/** + * + * @author Alexander Bagerman + * + */ + +public class LeapsQueryResults extends QueryResults { + + public LeapsQueryResults(List results, Query query, WorkingMemory workingMemory) { + super( results, query, workingMemory ); + } + + public QueryResult get( int i ) { + if (i > this.results.size( )) { + throw new NoSuchElementException( ); + } + return new LeapsQueryResult( (Tuple) this.results.get( i ), workingMemory, this ); + } + + public Iterator iterator() { + return new QueryResultsIterator( this.results.iterator() ); + } + + class QueryResultsIterator implements Iterator { + private Iterator iterator; + + public QueryResultsIterator(Iterator iterator) { + this.iterator = iterator; + } + + public boolean hasNext() { + return this.iterator.hasNext( ); + } + + public Object next() { + return new LeapsQueryResult( (Tuple) this.iterator.next( ), + LeapsQueryResults.this.workingMemory, LeapsQueryResults.this ); + } + + public void remove() { + this.iterator.remove( ); + } + + } +} Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/LeapsRule.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/LeapsRule.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/LeapsRule.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -15,10 +15,6 @@ * limitations under the License. */ - - - - import java.util.ArrayList; import org.drools.common.AgendaGroupImpl; Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/LeapsTuple.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/LeapsTuple.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/LeapsTuple.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -1,4 +1,5 @@ package org.drools.leaps; + /* * Copyright 2005 JBoss Inc * @@ -15,10 +16,6 @@ * limitations under the License. */ - - - - import java.io.Serializable; import java.util.HashSet; import java.util.Iterator; @@ -222,6 +219,9 @@ this.blockingNotFactHandles[index] = factHandle; } + boolean isBlockingNotFactHandle(int index ) { + return this.blockingNotFactHandles[index] != null; + } void removeBlockingNotFactHandle(int index) { this.blockingNotFactHandles[index] = null; this.setReadyForActivation(); @@ -233,6 +233,10 @@ this.setReadyForActivation(); } + boolean isExistsFactHandle(int index) { + return this.existsFactHandles[index] != null; + } + void removeExistsFactHandle(int index) { this.existsFactHandles[index] = null; this.setReadyForActivation(); Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/NoMatchesFoundException.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/NoMatchesFoundException.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/NoMatchesFoundException.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -15,17 +15,12 @@ * limitations under the License. */ - - - - /** * Exception to facilitate <code>seek</code> process in working memory * * @author Alexander Bagerman * */ - class NoMatchesFoundException extends Exception { /** Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/RuleBaseImpl.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/RuleBaseImpl.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/RuleBaseImpl.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -15,10 +15,6 @@ * limitations under the License. */ - - - - import java.io.IOException; import java.io.ObjectInputStream; import java.util.HashMap; Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/RuleHandle.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/RuleHandle.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/RuleHandle.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -15,10 +15,6 @@ * limitations under the License. */ - - - - /** * class container for rules used in the system. Handle is created for each * leaps rule, dominant position (column/ce position), dominant position type Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/RuleTable.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/RuleTable.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/RuleTable.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -15,10 +15,6 @@ * limitations under the License. */ - - - - import java.util.Comparator; import org.drools.leaps.util.Table; Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/Token.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/Token.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/Token.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -1,4 +1,5 @@ package org.drools.leaps; + /* * Copyright 2005 JBoss Inc * @@ -15,10 +16,6 @@ * limitations under the License. */ - - - - import java.io.Serializable; import java.util.Iterator; @@ -37,7 +34,7 @@ * @author Alexander Bagerman * */ -class Token +public class Token implements Tuple, Serializable { @@ -61,19 +58,20 @@ /** * */ - public Token(WorkingMemoryImpl workingMemory, - FactHandleImpl factHandle, - PropagationContextImpl propagationContext) { + public Token(WorkingMemoryImpl workingMemory, FactHandleImpl factHandle, + PropagationContextImpl propagationContext) { this.workingMemory = workingMemory; this.dominantFactHandle = factHandle; this.propagationContext = propagationContext; } private Iterator rulesIterator() { - if ( this.rules == null ) { - if ( this.dominantFactHandle != null ) { - this.rules = this.workingMemory.getFactTable( this.dominantFactHandle.getObject().getClass() ).getRulesIterator(); - } else { + if (this.rules == null) { + if (this.dominantFactHandle != null) { + this.rules = this.workingMemory.getFactTable( + this.dominantFactHandle.getObject().getClass()).getRulesIterator(); + } + else { this.rules = this.workingMemory.getNoRequiredColumnsLeapsRules(); } } @@ -94,44 +92,49 @@ public boolean hasNextRuleHandle() { boolean ret = false; - if ( this.rulesIterator() != null ) { + if (this.rulesIterator() != null) { // starting with calling rulesIterator() to make sure that we picks // rules because fact can be asserted before rules added long levelId = this.workingMemory.getIdLastFireAllAt(); - if ( this.dominantFactHandle == null || this.dominantFactHandle.getId() >= levelId ) { + if (this.dominantFactHandle == null + || this.dominantFactHandle.getId() >= levelId) { ret = this.rules.hasNext(); - } else { + } + else { // then we need to skip rules that have id lower than // workingMemory.idLastFireAllAt boolean done = false; - while ( !done ) { - if ( this.rules.hasNext() ) { - if ( ((RuleHandle) ((TableIterator) this.rules).peekNext()).getId() > levelId ) { + while (!done) { + if (this.rules.hasNext()) { + if (((RuleHandle) ((TableIterator) this.rules).peekNext()).getId() > levelId) { ret = true; done = true; - } else { + } + else { this.rules.next(); } - } else { + } + else { ret = false; done = true; } } } } + return ret; } public int hashCode() { - if ( this.dominantFactHandle != null ) { + if (this.dominantFactHandle != null) { return this.dominantFactHandle.hashCode(); - } else { + } + else { return 0; } } - public void set(int idx, - FactHandleImpl factHandle) { + public void set(int idx, FactHandleImpl factHandle) { this.currentFactHandles[idx] = factHandle; } @@ -214,9 +217,8 @@ * @return LeapsTuple */ LeapsTuple getTuple() { - return new LeapsTuple( this.currentFactHandles, - this.currentRuleHandle.getLeapsRule(), - this.propagationContext ); + return new LeapsTuple(this.currentFactHandles, this.currentRuleHandle + .getLeapsRule(), this.propagationContext); } /** Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/TokenEvaluator.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/TokenEvaluator.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/TokenEvaluator.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -15,10 +15,6 @@ * limitations under the License. */ - - - - import org.drools.leaps.util.Table; import org.drools.leaps.util.TableIterator; import org.drools.rule.EvalCondition; Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/WorkingMemoryImpl.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/WorkingMemoryImpl.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/WorkingMemoryImpl.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -1,4 +1,5 @@ package org.drools.leaps; + /* * Copyright 2005 JBoss Inc * @@ -15,10 +16,6 @@ * limitations under the License. */ - - - - import java.beans.PropertyChangeListener; import java.util.ArrayList; import java.util.Enumeration; @@ -28,7 +25,6 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; -import java.util.Stack; import org.drools.FactException; import org.drools.FactHandle; @@ -43,6 +39,7 @@ import org.drools.common.ScheduledAgendaItem; import org.drools.leaps.conflict.DefaultConflictResolver; import org.drools.leaps.util.TableIterator; +import org.drools.leaps.util.TokenStack; import org.drools.rule.Query; import org.drools.rule.Rule; import org.drools.spi.Activation; @@ -295,40 +292,42 @@ ColumnConstraints[] not = tuple.getLeapsRule().getNotColumnConstraints(); for ( int i = 0, length = not.length; i < length; i++ ) { ColumnConstraints constraint = not[i]; - if ( constraint.isAllowed( handle, - tuple, - this ) ) { - tuple.setBlockingNotFactHandle( handle, - i ); - handle.addNotTuple( tuple, - i ); + if (!tuple.isBlockingNotFactHandle(i) + && constraint.getClassType().isAssignableFrom( objectClass ) + && constraint.isAllowed(handle, tuple, this)) { + tuple.setBlockingNotFactHandle(handle, i); + handle.addNotTuple(tuple, i); } } // check and see if we need de-activate if ( !tuple.isReadyForActivation() ) { - // time to pull from agenda - this.invalidateActivation( tuple ); + if ( tuple.getLeapsRule().getRule() instanceof Query ) { + // put query results to the working memory location + removeFromQueryResults( tuple.getLeapsRule().getRule().getName(), + tuple ); + } else { + // time to pull from agenda + invalidateActivation( tuple ); + } } - } else { + } + else { // check exists constraints and activate constraints - ColumnConstraints[] exists = tuple.getLeapsRule().getExistsColumnConstraints(); - for ( int i = 0, length = exists.length; i < length; i++ ) { + ColumnConstraints[] exists = tuple.getLeapsRule() + .getExistsColumnConstraints(); + for (int i = 0, length = exists.length; i < length; i++) { ColumnConstraints constraint = exists[i]; - if ( constraint.getClassType().isAssignableFrom( objectClass ) ) { - if ( constraint.isAllowed( handle, - tuple, - this ) ) { - tuple.setExistsFactHandle( handle, - i ); - handle.addExistsTuple( tuple, - i ); - } + if (!tuple.isExistsFactHandle(i) + && constraint.getClassType().isAssignableFrom(objectClass) + && constraint.isAllowed(handle, tuple, this)) { + tuple.setExistsFactHandle(handle, i); + handle.addExistsTuple(tuple, i); } } // check and see if we need activate - if ( tuple.isReadyForActivation() ) { + if (tuple.isReadyForActivation()) { // ready to activate - this.assertTuple( tuple ); + this.assertTuple(tuple); } } } @@ -340,7 +339,7 @@ rule, activation ); - this.pushTokenOnStack( new Token( this, + this.pushTokenOnStack( handle, new Token( this, handle, context ) ); @@ -399,7 +398,15 @@ // 0. remove activated tuples Iterator tuples = ((FactHandleImpl) handle).getActivatedTuples(); for ( ; tuples != null && tuples.hasNext(); ) { - this.invalidateActivation( (LeapsTuple) tuples.next() ); + LeapsTuple tuple = (LeapsTuple) tuples.next(); + if ( tuple.getLeapsRule().getRule() instanceof Query ) { + // put query results to the working memory location + removeFromQueryResults( tuple.getLeapsRule().getRule().getName(), + tuple ); + } else { + // time to pull from agenda + invalidateActivation( tuple ); + } } // 1. remove fact for nots and exists tuples @@ -411,12 +418,10 @@ for ( ; it.hasNext(); ) { assembly = (FactHandleTupleAssembly) it.next(); tuple = assembly.getTuple(); - tuple.removeBlockingNotFactHandle( assembly.getIndex() ); - TokenEvaluator.evaluateNotCondition( new FactHandleImpl( ((FactHandleImpl) handle).getId() + 1, - null ), - assembly.getIndex(), - tuple, - this ); + tuple.removeBlockingNotFactHandle(assembly.getIndex()); + TokenEvaluator.evaluateNotCondition(new FactHandleImpl( + ((FactHandleImpl) handle).getId() + 1, null), assembly.getIndex(), + tuple, this); } } it = ((FactHandleImpl) handle).getExistsTupleAssemblies(); @@ -424,12 +429,10 @@ for ( ; it.hasNext(); ) { assembly = (FactHandleTupleAssembly) it.next(); tuple = assembly.getTuple(); - tuple.removeExistsFactHandle( assembly.getIndex() ); - TokenEvaluator.evaluateExistsCondition( new FactHandleImpl( ((FactHandleImpl) handle).getId() + 1, - null ), - assembly.getIndex(), - tuple, - this ); + tuple.removeExistsFactHandle(assembly.getIndex()); + TokenEvaluator.evaluateExistsCondition(new FactHandleImpl( + ((FactHandleImpl) handle).getId() + 1, null), assembly.getIndex(), + tuple, this); } } // 2. assert all tuples that are ready for activation or cancel ones @@ -449,15 +452,19 @@ // ready to activate this.assertTuple( tuple ); } else { - // time to pull from agenda - this.invalidateActivation( tuple ); + if ( tuple.getLeapsRule().getRule() instanceof Query ) { + // put query results to the working memory location + removeFromQueryResults( tuple.getLeapsRule().getRule().getName(), + tuple ); + } else { + // time to pull from agenda + invalidateActivation( tuple ); + } } } // remove it from stack - this.stack.remove( new Token( this, - (FactHandleImpl) handle, - null ) ); + this.removeTokenFromStack( (FactHandleImpl) handle ); // // end leaps specific actions @@ -547,7 +554,8 @@ /** * algorithm stack. */ - private Stack stack = new Stack(); + private TokenStack mainStack = new TokenStack(); +// private Stack stack = new Stack(); /** * to store facts to cursor over it @@ -581,13 +589,31 @@ /** * adds new leaps token on main stack * + * @param fact handle * @param token */ - protected void pushTokenOnStack(Token token) { - this.stack.push( token ); + protected void pushTokenOnStack(FactHandleImpl factHandle, Token token) { + this.mainStack.push( token ); } /** + * removes leaps token on main stack + * + * @param fact handle + */ + protected void removeTokenFromStack(FactHandleImpl factHandle) { + this.mainStack.remove( factHandle.getId() ); + } + + /** + * gets leaps token from top of stack + * + * @param fact handle + */ + protected Token peekTokenOnTop(){ + return (Token)this.mainStack.peek(); + } + /** * get leaps fact table of specific type (class) * * @param type @@ -705,8 +731,8 @@ try { this.firing = true; // normal rules with required columns - while ( !this.stack.isEmpty() ) { - Token token = (Token) this.stack.peek(); + while ( !this.mainStack.empty() ) { + Token token = (Token) this.peekTokenOnTop(); boolean done = false; while ( !done ) { if ( !token.isResume() ) { @@ -717,7 +743,7 @@ // asserted // and placed on hte top of the stack during // firing - this.stack.remove( token ); + this.removeTokenFromStack( token.getDominantFactHandle() ); done = true; } } @@ -778,9 +804,9 @@ ret = ret + ((FactTable) this.factTables.get( key )).toString(); } ret = ret + "\n" + "Stack:"; - for ( Iterator it = this.stack.iterator(); it.hasNext(); ) { - ret = ret + "\n" + "\t" + it.next(); - } +// for ( Iterator it = this.mainStack.entrySet().iterator(); it.hasNext(); ) { +// ret = ret + "\n" + "\t" + it.next(); +// } return ret; } @@ -871,29 +897,43 @@ public void dispose() { ((RuleBaseImpl) this.ruleBase).disposeWorkingMemory( this ); } + + public QueryResults getQueryResults(String queryName) { + IdentityMap map = ( IdentityMap ) this.queryResults.get( queryName ); + if ( map == null ) { + return null; + } - public QueryResults getQueryResults(String query) { - List list = ( List ) this.queryResults.remove( query ); - if ( list == null ) { + LinkedList list = new LinkedList(); + for(Iterator it = map.keySet().iterator(); it.hasNext();) { + list.add(it.next()); + } + if(!list.isEmpty()) { + Query queryRule = (Query)((LeapsTuple) list.get(0)).getLeapsRule().getRule(); + return new LeapsQueryResults( list, queryRule, this ); + } + else { return null; } - // @todo we need to pass the Query itself - return new QueryResults( list, - ( Query ) null, - this); + // } - void addToQueryResults(String query, - Tuple tuple) { - LinkedList list = (LinkedList) this.queryResults.get( query ); - if ( list == null ) { - list = new LinkedList(); - this.queryResults.put( query, - list ); + void addToQueryResults(String query, Tuple tuple) { + IdentityMap map = (IdentityMap) this.queryResults.get( query ); + if (map == null) { + map = new IdentityMap( ); + this.queryResults.put( query, map ); } - list.add( tuple ); + map.put( tuple, tuple ); } + + void removeFromQueryResults(String query, Tuple tuple) { + IdentityMap map = (IdentityMap) this.queryResults.get( query ); + if (map != null) { + map.remove(tuple); + } + } protected TableIterator getNoRequiredColumnsLeapsRules() { return noRequiredColumnsLeapsRules.iterator(); Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/util/BaseTableIterator.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/util/BaseTableIterator.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/util/BaseTableIterator.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -15,12 +15,8 @@ * limitations under the License. */ - - import java.util.NoSuchElementException; - - /** * Leaps specific iterator for leaps tables. relies on leaps table double link * list structure for navigation Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/util/ConstrainedFactTableIterator.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/util/ConstrainedFactTableIterator.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/util/ConstrainedFactTableIterator.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -15,10 +15,6 @@ * limitations under the License. */ - - - - import java.util.NoSuchElementException; import org.drools.FactHandle; Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/util/Table.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/util/Table.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/util/Table.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -1,4 +1,5 @@ package org.drools.leaps.util; + /* * Copyright 2005 JBoss Inc * @@ -15,13 +16,10 @@ * limitations under the License. */ - - - - import java.io.Serializable; import java.util.Comparator; import java.util.Iterator; +import java.util.NoSuchElementException; import java.util.SortedMap; import java.util.TreeMap; @@ -70,7 +68,13 @@ this.empty = false; } else { SortedMap bufMap = this.map.headMap( object ); - if ( !bufMap.isEmpty() ) { + try { + // check on first key should work faster than check on empty + // but logically we check on empty + // if map empty it will throw exception + bufMap.firstKey(); + +// if ( !bufMap.isEmpty() ) { TableRecord bufRec = (TableRecord) this.map.get( bufMap.lastKey() ); if ( bufRec.right != null ) { bufRec.right.left = newRecord; @@ -79,7 +83,9 @@ bufRec.right = newRecord; newRecord.left = bufRec; - } else { + } //else { + catch (NoSuchElementException nsee) { + // means map is empty this.headRecord.left = newRecord; newRecord.right = this.headRecord; this.headRecord = newRecord; @@ -132,6 +138,8 @@ record.left.right = record.right; record.right.left = record.left; } + record.left = null; + record.right = null; } this.count--; // @@ -229,12 +237,16 @@ TableRecord lastRecord = this.tailRecord; if ( !this.empty ) { // validate - // if (!this.map.isEmpty()) { // validate if ( this.map.comparator().compare( objectAtStart, this.tailRecord.object ) <= 0 ) { // let's check if we need iterator over the whole table SortedMap bufMap = this.map.tailMap( objectAtStart ); - if ( !bufMap.isEmpty() ) { + try { + // check on first key should work faster than check on empty + // but logically we check on empty + // if map empty it will throw exception + bufMap.firstKey(); +// if ( !bufMap.isEmpty() ) { startRecord = (TableRecord) bufMap.get( bufMap.firstKey() ); if ( this.map.comparator().compare( objectAtStart, objectAtPosition ) == 0 ) { @@ -243,9 +255,15 @@ // rewind to position bufMap = bufMap.tailMap( objectAtPosition ); - if ( !bufMap.isEmpty() ) { + try { + // check on first key should work faster than check on empty + // but logically we check on empty + // if map empty it will throw exception + bufMap.firstKey(); +// if ( !bufMap.isEmpty() ) { currentRecord = ((TableRecord) bufMap.get( bufMap.firstKey() )); - } else { + } // else { + catch (NoSuchElementException nsee) { currentRecord = startRecord; } } @@ -253,6 +271,8 @@ ret.current = currentRecord; ret.last = lastRecord; } + catch (NoSuchElementException nsee) {} + } } @@ -279,7 +299,12 @@ objectAtEnd ) <= 0 ) { // let's check if we need iterator over the whole table SortedMap bufMap = this.map.headMap( objectAtEnd ); - if ( !bufMap.isEmpty() ) { + try { + // check on first key should work faster than check on empty + // but logically we check on empty + // if map empty it will throw exception + bufMap.firstKey(); +// if ( !bufMap.isEmpty() ) { lastRecord = (TableRecord) bufMap.get( bufMap.lastKey() ); // check if the next one is what we need if ( lastRecord.right != null && this.map.comparator().compare( lastRecord.right.object, @@ -289,7 +314,8 @@ iterator = new BaseTableIterator( startRecord, currentRecord, lastRecord ); - } else { + } //else { + catch (NoSuchElementException nsee) { // empty iterator iterator = new BaseTableIterator( null, null, Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/util/TableIterator.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/util/TableIterator.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/util/TableIterator.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -15,10 +15,6 @@ * limitations under the License. */ - - - - import java.util.Iterator; /** Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/util/TableRecord.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/util/TableRecord.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/util/TableRecord.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -15,12 +15,8 @@ * limitations under the License. */ - - import java.io.Serializable; - - /** * * @author Alexander Bagerman Added: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/util/TokenStack.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/util/TokenStack.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/util/TokenStack.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -0,0 +1,110 @@ +package org.drools.leaps.util; + +/* + * Copyright 2005 JBoss Inc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.util.EmptyStackException; + +import org.drools.leaps.Token; +import org.drools.util.PrimitiveLongMap; + +/** + * This class follows java.util.Stack interface but accounts + * for remove( object ) functionallity needed by leaps + * + * @author Alexander Bagerman + * + */ + +public class TokenStack { + + protected TableRecord tailRecord = null; + + private PrimitiveLongMap map = new PrimitiveLongMap(); + + public TokenStack() { + + } + + public boolean empty() { + return this.tailRecord == null; + } + + public Object peek() { + if(this.tailRecord != null){ + return this.tailRecord.object; + } + else { + throw new EmptyStackException(); + } + } + + public Object pop() { + if(this.tailRecord != null){ + Object ret = this.tailRecord.object; + TableRecord buf = this.tailRecord; + this.tailRecord = buf.left; + if (buf.left != null) { + this.tailRecord.right = null; + } + buf.left = null; + + map.remove(((Token) ret).getDominantFactHandle().getId()); + return ret; + } + else { + throw new EmptyStackException(); + } + } + + + /** + * Removes object from the table + * + * @param object + * to remove from the table + */ + public void remove(long factId) { + if (this.tailRecord != null) { + TableRecord record = (TableRecord) this.map.remove(factId); + + if (record != null) { + if (record == this.tailRecord) { + this.tailRecord = record.left; + } + if (record.left != null) { + record.left.right = record.right; + } + if (record.right != null) { + record.right.left = record.left; + } + record.left = null; + record.right = null; + } + } + } + public Object push(Object item) { + TableRecord record = new TableRecord(item); + if (this.tailRecord != null) { + this.tailRecord.right = record; + record.left = this.tailRecord; + } + this.tailRecord = record; + + this.map.put(((Token)item).getDominantFactHandle().getId(), record); + return item; + } +} Added: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/leaps/QueryResultsTest.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/leaps/QueryResultsTest.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/leaps/QueryResultsTest.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -0,0 +1,183 @@ +package org.drools.leaps; + +/* + * Copyright 2005 JBoss Inc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.util.Iterator; + +import junit.framework.TestCase; + +import org.drools.FactHandle; +import org.drools.PackageIntegrationException; +import org.drools.WorkingMemory; +import org.drools.base.ClassFieldExtractor; +import org.drools.base.ClassObjectType; +import org.drools.base.EvaluatorFactory; +import org.drools.rule.Column; +import org.drools.rule.LiteralConstraint; +import org.drools.rule.Query; +import org.drools.spi.Evaluator; +import org.drools.spi.FieldConstraint; +import org.drools.spi.FieldExtractor; +import org.drools.spi.FieldValue; +import org.drools.spi.MockField; + +/** + * + * @author Alexander Bagerman + * + */ +public class QueryResultsTest extends TestCase { + public void testQueryTerminalNode() throws PackageIntegrationException { + RuleBaseImpl ruleBase = new RuleBaseImpl( ); + + ClassObjectType cheeseObjectType = new ClassObjectType( Cheese.class ); + Evaluator evaluator = EvaluatorFactory.getEvaluator( Evaluator.STRING_TYPE, + Evaluator.EQUAL ); + // fires on context.state == integer(1) + Query query = new Query( "query-1" ); + + Column cheeseColumn = new Column( 0, cheeseObjectType, "cheese" ); + cheeseColumn.addConstraint( getLiteralConstraint( cheeseColumn, "type", "stilton", + evaluator ) ); + query.addPattern( cheeseColumn ); + + ruleBase.addRule( query ); + + WorkingMemory workingMemory = ruleBase.newWorkingMemory( ); + + workingMemory.fireAllRules( ); + + LeapsQueryResults results = (LeapsQueryResults) workingMemory + .getQueryResults( "query-1" ); + + assertNull( results ); + + Cheese stilton1 = new Cheese( "stilton", 100 ); + + FactHandle handle1 = workingMemory.assertObject( stilton1 ); + + workingMemory.fireAllRules( ); + + results = (LeapsQueryResults) workingMemory.getQueryResults( "query-1" ); + + assertEquals( 1, results.size( ) ); + + Cheese cheddar = new Cheese( "cheddar", 55 ); + workingMemory.assertObject( cheddar ); + + workingMemory.fireAllRules( ); + + results = (LeapsQueryResults) workingMemory.getQueryResults( "query-1" ); + + assertEquals( 1, results.size( ) ); + + Cheese stilton2 = new Cheese( "stilton", 5 ); + + FactHandle handle2 = workingMemory.assertObject( stilton2 ); + + workingMemory.fireAllRules( ); + + results = (LeapsQueryResults) workingMemory.getQueryResults( "query-1" ); + + assertEquals( 2, results.size( ) ); + + LeapsQueryResult result = (LeapsQueryResult) results.get( 0 ); + + assertEquals( 1, result.size( ) ); + + boolean wasStilton1 = ( stilton1 == result.get( 0 ) ); + + // assertSame( stilton1, result.get( 0 ) ); + + result = (LeapsQueryResult) results.get( 1 ); + + boolean wasStilton2 = ( stilton2 == result.get( 0 ) ); + + assertEquals( 1, result.size( ) ); + + // assertSame( stilton2, result.get( 0 ) ); + assertTrue( ( wasStilton1 && wasStilton2 ) || ( !wasStilton1 && !wasStilton2 ) ); + Object result1 = null, result2 = null; + int i = 0; + for (Iterator it = results.iterator( ); it.hasNext( );) { + result = (LeapsQueryResult) it.next( ); + assertEquals( 1, result.size( ) ); + if (i == 0) { + result1 = result.get( 0 ); + } + else { + result2 = result.get( 0 ); + } + i++; + } + wasStilton1 = ( stilton1 == result1 ); + wasStilton2 = ( stilton2 == result2 ); + assertTrue( ( wasStilton1 && wasStilton2 ) || ( !wasStilton1 && !wasStilton2 ) ); + + workingMemory.retractObject( handle1 ); + + workingMemory.fireAllRules( ); + + results = (LeapsQueryResults) workingMemory.getQueryResults( "query-1" ); + + assertEquals( 1, results.size( ) ); + + workingMemory.retractObject( handle2 ); + + workingMemory.fireAllRules( ); + + results = (LeapsQueryResults) workingMemory.getQueryResults( "query-1" ); + + assertNull( results ); + } + + public class Cheese { + private String type; + + private int price; + + public Cheese(String type, int price) { + super( ); + this.type = type; + this.price = price; + } + + public int getPrice() { + return price; + } + + public String getType() { + return type; + } + + public String toString() { + return "[Cheese type='" + this.type + "' price='" + this.price + "']"; + } + + } + + private FieldConstraint getLiteralConstraint( Column column, String fieldName, + Object fieldValue, Evaluator evaluator ) { + Class clazz = ( (ClassObjectType) column.getObjectType( ) ).getClassType( ); + + FieldExtractor extractor = new ClassFieldExtractor( clazz, fieldName ); + + FieldValue field = new MockField( fieldValue ); + + return new LiteralConstraint( field, extractor, evaluator ); + } +} Added: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/leaps/util/TokenStackTest.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/leaps/util/TokenStackTest.java 2006-04-23 14:18:59 UTC (rev 3925) +++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/leaps/util/TokenStackTest.java 2006-04-23 16:25:31 UTC (rev 3926) @@ -0,0 +1,180 @@ +package org.drools.leaps.util; + +import junit.framework.TestCase; +import org.drools.leaps.*; +public class TokenStackTest extends TestCase { + + /* + * Test method for 'org.drools.leaps.util.TokenStack.empty()' + */ + public void testEmpty() { + TokenStack stack = new TokenStack(); + assertTrue(stack.empty()); + Token token = new Token(null, new FactHandleImpl(3, null), null); + stack.push(token); + assertFalse(stack.empty()); + } + + /* + * Test method for 'org.drools.leaps.util.TokenStack.peek()' + */ + public void testPeek() { + TokenStack stack = new TokenStack(); + assertTrue(stack.empty()); + Token token1 = new Token(null, new FactHandleImpl(1, null), null); + stack.push(token1); + Token token2 = new Token(null, new FactHandleImpl(2, null), null); + stack.push(token2); + Token token10 = new Token(null, new FactHandleImpl(10, null), null); + stack.push(token10); + Token token8 = new Token(null, new FactHandleImpl(8, null), null); + stack.push(token8); + Token token6 = new Token(null, new FactHandleImpl(6, null), null); + stack.push(token6); + Token token3 = new Token(null, new FactHandleImpl(3, null), null); + stack.push(token3); + Token token4 = new Token(null, new FactHandleImpl(4, null), null); + stack.push(token4); + + assertEquals(token4, stack.peek()); + stack.pop(); + assertEquals(token3, stack.peek()); + } + + /* + * Test method for 'org.drools.leaps.util.TokenStack.pop()' + */ + public void testPop() { + TokenStack stack = new TokenStack(); + assertTrue(stack.empty()); + Token token1 = new Token(null, new FactHandleImpl(1, null), null); + stack.push(token1); + Token token2 = new Token(null, new FactHandleImpl(2, null), null); + stack.push(token2); + Token token10 = new Token(null, new FactHandleImpl(10, null), null); + stack.push(token10); + Token token8 = new Token(null, new FactHandleImpl(8, null), null); + stack.push(token8); + Token token6 = new Token(null, new FactHandleImpl(6, null), null); + stack.push(token6); + Token token3 = new Token(null, new FactHandleImpl(3, null), null); + stack.push(token3); + Token token4 = new Token(null, new FactHandleImpl(4, null), null); + stack.push(token4); + + assertEquals(token4, stack.peek()); + stack.pop(); + assertEquals(token3, stack.peek()); + stack.pop(); + stack.pop(); + stack.pop(); + stack.pop(); + stack.pop(); + assertEquals(token1, stack.peek()); + stack.pop(); + + assertTrue(stack.empty()); + } + + /* + * Test method for 'org.drools.leaps.util.TokenStack.remove(long)' + */ + public void testRemoveBottom() { + TokenStack stack = new TokenStack(); + assertTrue(stack.empty()); + Token token1 = new Token(null, new FactHandleImpl(1, null), null); + stack.push(token1); + Token token2 = new Token(null, new FactHandleImpl(2, null), null); + stack.push(token2); + Token token10 = new Token(null, new FactHandleImpl(10, null), null); + stack.push(token10); + Token token8 = new Token(null, new FactHandleImpl(8, null), null); + stack.push(token8); + Token token6 = new Token(null, new FactHandleImpl(6, null), null); + stack.push(token6); + Token token3 = new Token(null, new FactHandleImpl(3, null), null); + stack.push(token3); + Token token4 = new Token(null, new FactHandleImpl(4, null), null); + stack.push(token4); + + stack.remove(1); + assertEquals(token4, stack.peek()); + stack.pop(); + assertEquals(token3, stack.peek()); + stack.pop(); + stack.pop(); + stack.pop(); + stack.pop(); + stack.pop(); + + assertTrue(stack.empty()); + } + + + /* + * Test method for 'org.drools.leaps.util.TokenStack.remove(long)' + */ + public void testRemoveTop() { +... [truncated message content] |
From: <jbo...@li...> - 2006-04-23 14:19:04
|
Author: mar...@jb... Date: 2006-04-23 10:18:59 -0400 (Sun, 23 Apr 2006) New Revision: 3925 Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/MockObjectSink.java Log: -Added test for JavaBean PropertyChangeListener Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/MockObjectSink.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/MockObjectSink.java 2006-04-23 14:18:21 UTC (rev 3924) +++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/MockObjectSink.java 2006-04-23 14:18:59 UTC (rev 3925) @@ -27,6 +27,7 @@ ObjectSink { private List asserted = new ArrayList(); private List retracted = new ArrayList(); + private List modified = new ArrayList(); public void assertObject(FactHandleImpl handle, PropagationContext context, @@ -40,6 +41,13 @@ this.retracted.add( new Object[]{handle, context, workingMemory} ); } + public void modifyObject(FactHandleImpl handle, + PropagationContext context, + WorkingMemoryImpl workingMemory) { + this.modified.add( new Object[]{handle, context, workingMemory} ); + + } + public List getAsserted() { return this.asserted; } @@ -48,10 +56,8 @@ return this.retracted; } - public void modifyObject(FactHandleImpl handle, - PropagationContext context, - WorkingMemoryImpl workingMemory) { - // TODO Auto-generated method stub + public List getModified() { + return this.modified; + } - } } \ No newline at end of file |
From: <jbo...@li...> - 2006-04-23 14:18:26
|
Author: mar...@jb... Date: 2006-04-23 10:18:21 -0400 (Sun, 23 Apr 2006) New Revision: 3924 Added: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/PropertyChangeListenerTest.java Log: -Added test for JavaBean PropertyChangeListener Added: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/PropertyChangeListenerTest.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/PropertyChangeListenerTest.java 2006-04-23 13:57:37 UTC (rev 3923) +++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/PropertyChangeListenerTest.java 2006-04-23 14:18:21 UTC (rev 3924) @@ -0,0 +1,71 @@ +package org.drools.reteoo; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; + +import junit.framework.TestCase; + +import org.drools.base.ClassObjectType; + +public class PropertyChangeListenerTest extends TestCase { + public void test1() { + RuleBaseImpl ruleBase = new RuleBaseImpl(); + + WorkingMemoryImpl workingMemory = (WorkingMemoryImpl) ruleBase.newWorkingMemory(); + + Rete rete = ruleBase.getRete(); + + ObjectTypeNode objectTypeNode = new ObjectTypeNode( 1, + new ClassObjectType( State.class ), + rete ); + + objectTypeNode.attach(); + + MockObjectSink sink = new MockObjectSink(); + objectTypeNode.addObjectSink( sink ); + + State a = new State( "go" ); + workingMemory.assertObject( a, + true ); + + assertEquals( 1, + sink.getAsserted().size() ); + assertEquals( 0, + sink.getModified().size() ); + + a.setState( "stop" ); + + assertEquals( 1, + sink.getModified().size() ); + } + + public static class State { + private PropertyChangeSupport changes = new PropertyChangeSupport( this ); + + private String state; + + public State(String state) { + this.state = state; + } + + public String getState() { + return this.state; + } + + public void setState(String newState) { + String oldState = this.state; + this.state = newState; + this.changes.firePropertyChange( "state", + oldState, + newState ); + } + + public void addPropertyChangeListener(PropertyChangeListener l) { + changes.addPropertyChangeListener( l ); + } + + public void removePropertyChangeListener(PropertyChangeListener l) { + changes.removePropertyChangeListener( l ); + } + } +} |
From: <jbo...@li...> - 2006-04-23 13:57:40
|
Author: mar...@jb... Date: 2006-04-23 09:57:37 -0400 (Sun, 23 Apr 2006) New Revision: 3923 Modified: labs/jbossrules/trunk/drools-ide/META-INF/MANIFEST.MF Log: -asm is now inlined Modified: labs/jbossrules/trunk/drools-ide/META-INF/MANIFEST.MF =================================================================== --- labs/jbossrules/trunk/drools-ide/META-INF/MANIFEST.MF 2006-04-23 13:56:23 UTC (rev 3922) +++ labs/jbossrules/trunk/drools-ide/META-INF/MANIFEST.MF 2006-04-23 13:57:37 UTC (rev 3923) @@ -37,7 +37,6 @@ lib/commons-lang-2.1.jar, lib/commons-logging-api-1.0.4.jar, lib/concurrent-1.3.4.jar, - lib/drools-asm-2.2.1.jar, lib/drools-compiler.jar, lib/drools-core.jar, lib/jung-1.7.2.jar, |
From: <jbo...@li...> - 2006-04-23 13:56:28
|
Author: mar...@jb... Date: 2006-04-23 09:56:23 -0400 (Sun, 23 Apr 2006) New Revision: 3922 Modified: labs/jbossrules/trunk/drools-jsr94/.classpath labs/jbossrules/trunk/drools-jsr94/.project Log: -asm is now inlined Modified: labs/jbossrules/trunk/drools-jsr94/.classpath =================================================================== --- labs/jbossrules/trunk/drools-jsr94/.classpath 2006-04-23 13:55:11 UTC (rev 3921) +++ labs/jbossrules/trunk/drools-jsr94/.classpath 2006-04-23 13:56:23 UTC (rev 3922) @@ -4,26 +4,26 @@ <classpathentry kind="src" path="src/test/resources" output="target/test-classes"/> <classpathentry kind="output" path="target/classes"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/> + <classpathentry kind="src" path="/drools-core"/> + <classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/3.1/commons-collections-3.1.jar"/> + <classpathentry kind="var" path="M2_REPO/janino/janino/2.4.1/janino-2.4.1.jar"/> + <classpathentry kind="var" path="M2_REPO/xerces/xercesImpl/2.6.2/xercesImpl-2.6.2.jar"/> + <classpathentry kind="var" path="M2_REPO/concurrent/concurrent/1.3.4/concurrent-1.3.4.jar"/> <classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.6/antlr-2.7.6.jar"/> - <classpathentry kind="var" path="M2_REPO/jsr94/jsr94-tck/1.0.2/jsr94-tck-1.0.2.jar"/> + <classpathentry kind="src" path="/drools-compiler"/> + <classpathentry kind="var" path="M2_REPO/jsr94/jsr94-sigtest/1.1/jsr94-sigtest-1.1.jar"/> + <classpathentry kind="var" path="M2_REPO/eclipse/jdtcore/3.2.0.v_658/jdtcore-3.2.0.v_658.jar"/> + <classpathentry kind="var" path="M2_REPO/jsr94/jsr94-tck/1.0.3/jsr94-tck-1.0.3.jar"/> <classpathentry kind="var" path="M2_REPO/jung/jung/1.7.2/jung-1.7.2.jar"/> - <classpathentry kind="var" path="M2_REPO/concurrent/concurrent/1.3.4/concurrent-1.3.4.jar"/> - <classpathentry kind="var" path="M2_REPO/jsr94/jsr94/1.1/jsr94-1.1.jar"/> - <classpathentry kind="var" path="M2_REPO/jci/jci/SNAPSHOT-378493+patch3/jci-SNAPSHOT-378493+patch3.jar"/> + <classpathentry kind="var" path="M2_REPO/antlr/antlr3/3.0ea8/antlr3-3.0ea8.jar"/> + <classpathentry kind="var" path="M2_REPO/colt/colt/1.2.0/colt-1.2.0.jar"/> <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging-api/1.0.4/commons-logging-api-1.0.4.jar"/> - <classpathentry kind="var" path="M2_REPO/xpp/xpp/3-1.1.3.4.O/xpp-3-1.1.3.4.O.jar"/> - <classpathentry kind="var" path="M2_REPO/colt/colt/1.2.0/colt-1.2.0.jar"/> + <classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar"/> <classpathentry kind="var" path="M2_REPO/commons-lang/commons-lang/2.1/commons-lang-2.1.jar"/> - <classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/3.1/commons-collections-3.1.jar"/> - <classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar"/> - <classpathentry kind="var" path="M2_REPO/eclipse/jdtcore/3.2.0.v_653/jdtcore-3.2.0.v_653.jar"/> + <classpathentry kind="var" path="M2_REPO/antlr/stringtemplate/2.3b6/stringtemplate-2.3b6.jar"/> + <classpathentry kind="var" path="M2_REPO/jci/jci/SNAPSHOT-378493+patch4/jci-SNAPSHOT-378493+patch4.jar"/> + <classpathentry kind="var" path="M2_REPO/jsr94/jsr94/1.1/jsr94-1.1.jar"/> + <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/> <classpathentry kind="var" path="M2_REPO/xstream/xstream/1.1.3/xstream-1.1.3.jar"/> - <classpathentry kind="src" path="/drools-compiler"/> - <classpathentry kind="var" path="M2_REPO/antlr/stringtemplate/2.3b6/stringtemplate-2.3b6.jar"/> - <classpathentry kind="src" path="/drools-core"/> - <classpathentry kind="var" path="M2_REPO/xerces/xercesImpl/2.6.2/xercesImpl-2.6.2.jar"/> - <classpathentry kind="var" path="M2_REPO/drools-asm/drools-asm/2.2.1/drools-asm-2.2.1.jar"/> - <classpathentry kind="var" path="M2_REPO/antlr/antlr3/3.0ea8/antlr3-3.0ea8.jar"/> - <classpathentry kind="var" path="M2_REPO/jsr94/jsr94-sigtest/1.1/jsr94-sigtest-1.1.jar"/> + <classpathentry kind="var" path="M2_REPO/xpp3/xpp3/1.1.3.4.O/xpp3-1.1.3.4.O.jar"/> </classpath> \ No newline at end of file Modified: labs/jbossrules/trunk/drools-jsr94/.project =================================================================== --- labs/jbossrules/trunk/drools-jsr94/.project 2006-04-23 13:55:11 UTC (rev 3921) +++ labs/jbossrules/trunk/drools-jsr94/.project 2006-04-23 13:56:23 UTC (rev 3922) @@ -2,8 +2,8 @@ <name>drools-jsr94</name> <comment/> <projects> + <project>drools-core</project> <project>drools-compiler</project> - <project>drools-core</project> </projects> <buildSpec> <buildCommand> |
From: <jbo...@li...> - 2006-04-23 13:55:16
|
Author: mar...@jb... Date: 2006-04-23 09:55:11 -0400 (Sun, 23 Apr 2006) New Revision: 3921 Modified: labs/jbossrules/trunk/drools-compiler/.classpath Log: -asm is now inlined Modified: labs/jbossrules/trunk/drools-compiler/.classpath =================================================================== --- labs/jbossrules/trunk/drools-compiler/.classpath 2006-04-23 13:50:36 UTC (rev 3920) +++ labs/jbossrules/trunk/drools-compiler/.classpath 2006-04-23 13:55:11 UTC (rev 3921) @@ -5,22 +5,21 @@ <classpathentry kind="src" path="src/test/resources" output="target/test-classes"/> <classpathentry kind="output" path="target/classes"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="var" path="M2_REPO/concurrent/concurrent/1.3.4/concurrent-1.3.4.jar"/> + <classpathentry kind="var" path="M2_REPO/antlr/antlr3/3.0ea8/antlr3-3.0ea8.jar"/> + <classpathentry kind="var" path="M2_REPO/commons-lang/commons-lang/2.1/commons-lang-2.1.jar"/> + <classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.6/antlr-2.7.6.jar"/> + <classpathentry kind="var" path="M2_REPO/jci/jci/SNAPSHOT-378493+patch4/jci-SNAPSHOT-378493+patch4.jar"/> + <classpathentry kind="var" path="M2_REPO/xpp3/xpp3/1.1.3.4.O/xpp3-1.1.3.4.O.jar"/> <classpathentry kind="var" path="M2_REPO/jung/jung/1.7.2/jung-1.7.2.jar"/> - <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar" sourcepath="M2_REPO/junit/junit/3.8.1/junit-3.8.1-sources.jar"/> - <classpathentry kind="var" path="M2_REPO/xstream/xstream/1.1.3/xstream-1.1.3.jar"/> <classpathentry kind="var" path="M2_REPO/eclipse/jdtcore/3.2.0.v_658/jdtcore-3.2.0.v_658.jar"/> - <classpathentry kind="var" path="M2_REPO/antlr/stringtemplate/2.3b6/stringtemplate-2.3b6.jar"/> <classpathentry kind="var" path="M2_REPO/colt/colt/1.2.0/colt-1.2.0.jar"/> - <classpathentry kind="var" path="M2_REPO/xpp3/xpp3/1.1.3.4.O/xpp3-1.1.3.4.O.jar"/> - <classpathentry kind="var" path="M2_REPO/commons-lang/commons-lang/2.1/commons-lang-2.1.jar"/> + <classpathentry kind="var" path="M2_REPO/xerces/xercesImpl/2.6.2/xercesImpl-2.6.2.jar"/> + <classpathentry kind="var" path="M2_REPO/xstream/xstream/1.1.3/xstream-1.1.3.jar"/> + <classpathentry kind="var" path="M2_REPO/antlr/stringtemplate/2.3b6/stringtemplate-2.3b6.jar"/> <classpathentry kind="var" path="M2_REPO/janino/janino/2.4.1/janino-2.4.1.jar"/> - <classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.6/antlr-2.7.6.jar"/> - <classpathentry kind="var" path="M2_REPO/jci/jci/SNAPSHOT-378493+patch4/jci-SNAPSHOT-378493+patch4.jar"/> + <classpathentry kind="var" path="M2_REPO/concurrent/concurrent/1.3.4/concurrent-1.3.4.jar"/> <classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/3.1/commons-collections-3.1.jar"/> - <classpathentry kind="var" path="M2_REPO/drools-asm/drools-asm/2.2.1/drools-asm-2.2.1.jar"/> - <classpathentry kind="var" path="M2_REPO/antlr/antlr3/3.0ea8/antlr3-3.0ea8.jar"/> - <classpathentry kind="var" path="M2_REPO/xerces/xercesImpl/2.6.2/xercesImpl-2.6.2.jar"/> - <classpathentry kind="src" path="/drools-core"/> <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging-api/1.0.4/commons-logging-api-1.0.4.jar"/> + <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/> + <classpathentry kind="src" path="/drools-core"/> </classpath> \ No newline at end of file |
From: <jbo...@li...> - 2006-04-23 13:50:44
|
Author: mar...@jb... Date: 2006-04-23 09:50:36 -0400 (Sun, 23 Apr 2006) New Revision: 3920 Removed: labs/jbossrules/trunk/repository/drools-asm/ Log: -asm is now inlined |
From: <jbo...@li...> - 2006-04-23 10:33:55
|
Author: mic...@jb... Date: 2006-04-23 06:33:24 -0400 (Sun, 23 Apr 2006) New Revision: 3918 Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/FieldFactory.java Log: String literals are interned Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/FieldFactory.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/FieldFactory.java 2006-04-23 03:50:29 UTC (rev 3917) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/FieldFactory.java 2006-04-23 10:33:24 UTC (rev 3918) @@ -67,7 +67,7 @@ field = new FieldImpl( new Boolean( value ) ); break; case Evaluator.STRING_TYPE : - field = new FieldImpl( value ); + field = new FieldImpl( value.intern() ); break; case Evaluator.DATE_TYPE : //MN: I think its fine like this, seems to work ! |
From: <jbo...@li...> - 2006-04-23 03:50:34
|
Author: woolfel Date: 2006-04-22 23:50:29 -0400 (Sat, 22 Apr 2006) New Revision: 3917 Modified: labs/jbossrules/trunk/drools-examples/src/test/java/com/sample/benchmark/SharedNodePerformanceTest.java Log: updated the test to measure memory usage using the Runtime class. peter Modified: labs/jbossrules/trunk/drools-examples/src/test/java/com/sample/benchmark/SharedNodePerformanceTest.java =================================================================== --- labs/jbossrules/trunk/drools-examples/src/test/java/com/sample/benchmark/SharedNodePerformanceTest.java 2006-04-23 03:17:13 UTC (rev 3916) +++ labs/jbossrules/trunk/drools-examples/src/test/java/com/sample/benchmark/SharedNodePerformanceTest.java 2006-04-23 03:50:29 UTC (rev 3917) @@ -70,14 +70,27 @@ long totalload = 0; long totalassert = 0; long totalfire = 0; + long aveloadmem = 0; + long aveassertmem = 0; + Runtime rt = Runtime.getRuntime(); for (int c=0; c < loop; c++) { + rt.gc(); + long memt1 = rt.totalMemory(); + long memf1 = rt.freeMemory(); + long used1 = memt1 - memf1; long loadStart = System.currentTimeMillis(); RuleBase ruleBase = readRule(file); long loadEnd = System.currentTimeMillis(); + long memt2 = rt.totalMemory(); + long memf2 = rt.freeMemory(); + long used2 = memt2 - memf2; long loadet = loadEnd - loadStart; + rt.gc(); totalload += loadet; + aveloadmem += (used2 - used1); System.out.println("time to load " + file + " " + loadet + "ms"); + System.out.println("load memory used " + ((used2-used1)/1024) + " kb"); WorkingMemory workingMemory = ruleBase.newWorkingMemory(); ArrayList objects = new ArrayList(); // create the objects @@ -92,15 +105,23 @@ objects.add(addr); } Iterator itr = objects.iterator(); + long memt3 = rt.totalMemory(); + long memf3 = rt.freeMemory(); + long used3 = memt3 - memf3; long assertStart = System.currentTimeMillis(); while( itr.hasNext() ) { workingMemory.assertObject(itr.next()); } long assertEnd = System.currentTimeMillis(); + long memt4 = rt.totalMemory(); + long memf4 = rt.freeMemory(); + long used4 = memt4 - memf4; long assertet = assertEnd - assertStart; totalassert += assertet; + aveassertmem += (used4 - used3); System.out.println("time to assert " + assertet + " ms"); + System.out.println("assert memory used " + ((used4-used3)/1024) + " kb"); long fireStart = System.currentTimeMillis(); workingMemory.fireAllRules(); long fireEnd = System.currentTimeMillis(); @@ -109,11 +130,15 @@ System.out.println("time to fireAllRules " + fireet + " ms"); workingMemory.dispose(); + rt.gc(); + System.out.println(""); } System.out.println(file); System.out.println("number of objects asserted " + factCount); System.out.println("average load " + (totalload/loop) + " ms"); + System.out.println("average load mem " + (aveloadmem/1024/loop) + " kb"); System.out.println("average assert " + (totalassert/loop) + " ms"); + System.out.println("average assert mem " + (aveassertmem/1024/loop) + " kb"); System.out.println("average fire " + (totalfire/loop) + " ms"); } catch (Exception e) { e.printStackTrace(); |
From: <jbo...@li...> - 2006-04-23 03:17:24
|
Author: woolfel Date: 2006-04-22 23:17:13 -0400 (Sat, 22 Apr 2006) New Revision: 3916 Modified: labs/jbossrules/trunk/drools-examples/src/test/java/com/sample/benchmark/SharedNodePerformanceTest.java Log: oops, forgot to change the number of objects for no shared nodes. fixed that now peter Modified: labs/jbossrules/trunk/drools-examples/src/test/java/com/sample/benchmark/SharedNodePerformanceTest.java =================================================================== --- labs/jbossrules/trunk/drools-examples/src/test/java/com/sample/benchmark/SharedNodePerformanceTest.java 2006-04-23 03:11:49 UTC (rev 3915) +++ labs/jbossrules/trunk/drools-examples/src/test/java/com/sample/benchmark/SharedNodePerformanceTest.java 2006-04-23 03:17:13 UTC (rev 3916) @@ -362,7 +362,7 @@ public void testNoneSharedNodes() { try { - int factCount = 50000; + int factCount = 5000; String file = "20rules_0shared.drl"; int loop = 5; long totalload = 0; |
From: <jbo...@li...> - 2006-04-23 03:12:39
|
Author: bob.mcwhirter Date: 2006-04-22 23:11:49 -0400 (Sat, 22 Apr 2006) New Revision: 3915 Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/RuleParser.java labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/RuleParserLexer.java labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/lang/drl.g Log: Fix for 154, debug removed now. Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/RuleParser.java =================================================================== --- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/RuleParser.java 2006-04-23 03:03:39 UTC (rev 3914) +++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/RuleParser.java 2006-04-23 03:11:49 UTC (rev 3915) @@ -1,4 +1,4 @@ -// $ANTLR 3.0ea8 /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g 2006-04-22 23:00:57 +// $ANTLR 3.0ea8 /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g 2006-04-22 23:10:16 package org.drools.lang; import java.util.List; @@ -163,7 +163,7 @@ return; } errorRecovery = true; - System.err.println( ex ); + //System.err.println( ex ); errors.add( ex ); } @@ -3997,7 +3997,6 @@ match(input,23,FOLLOW_23_in_paren_chunk2155); - System.err.println( "chunk [" + c + "]" ); if ( c == null ) { c = ""; } @@ -4011,12 +4010,11 @@ } break; case 2 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:780:19: any= . + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:779:19: any= . { any=(Token)input.LT(1); matchAny(input); - System.err.println( "any [" + any.getText() + "]" ); if ( text == null ) { text = any.getText(); } else { @@ -4048,7 +4046,7 @@ // $ANTLR start paren_chunk2 - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:793:1: paren_chunk2 returns [String text] : ( options {greedy=false; } : '(' c= paren_chunk2 ')' | any= . )* ; + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:791:1: paren_chunk2 returns [String text] : ( options {greedy=false; } : '(' c= paren_chunk2 ')' | any= . )* ; public String paren_chunk2() throws RecognitionException { String text; Token any=null; @@ -4059,10 +4057,10 @@ text = null; try { - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:799:18: ( ( options {greedy=false; } : '(' c= paren_chunk2 ')' | any= . )* ) - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:799:18: ( options {greedy=false; } : '(' c= paren_chunk2 ')' | any= . )* + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:797:18: ( ( options {greedy=false; } : '(' c= paren_chunk2 ')' | any= . )* ) + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:797:18: ( options {greedy=false; } : '(' c= paren_chunk2 ')' | any= . )* { - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:799:18: ( options {greedy=false; } : '(' c= paren_chunk2 ')' | any= . )* + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:797:18: ( options {greedy=false; } : '(' c= paren_chunk2 ')' | any= . )* loop54: do { int alt54=3; @@ -4132,7 +4130,7 @@ switch (alt54) { case 1 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:800:25: '(' c= paren_chunk2 ')' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:798:25: '(' c= paren_chunk2 ')' { match(input,21,FOLLOW_21_in_paren_chunk22226); following.push(FOLLOW_paren_chunk2_in_paren_chunk22230); @@ -4141,7 +4139,6 @@ match(input,23,FOLLOW_23_in_paren_chunk22232); - System.err.println( "chunk [" + c + "]" ); if ( c == null ) { c = ""; } @@ -4155,12 +4152,11 @@ } break; case 2 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:812:19: any= . + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:809:19: any= . { any=(Token)input.LT(1); matchAny(input); - System.err.println( "any [" + any.getText() + "]" ); if ( text == null ) { text = any.getText(); } else { @@ -4192,7 +4188,7 @@ // $ANTLR start curly_chunk - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:824:1: curly_chunk returns [String text] : ( options {greedy=false; } : '{' c= curly_chunk '}' | any= . )* ; + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:820:1: curly_chunk returns [String text] : ( options {greedy=false; } : '{' c= curly_chunk '}' | any= . )* ; public String curly_chunk() throws RecognitionException { String text; Token any=null; @@ -4203,10 +4199,10 @@ text = null; try { - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:830:17: ( ( options {greedy=false; } : '{' c= curly_chunk '}' | any= . )* ) - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:830:17: ( options {greedy=false; } : '{' c= curly_chunk '}' | any= . )* + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:826:17: ( ( options {greedy=false; } : '{' c= curly_chunk '}' | any= . )* ) + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:826:17: ( options {greedy=false; } : '{' c= curly_chunk '}' | any= . )* { - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:830:17: ( options {greedy=false; } : '{' c= curly_chunk '}' | any= . )* + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:826:17: ( options {greedy=false; } : '{' c= curly_chunk '}' | any= . )* loop55: do { int alt55=3; @@ -4276,7 +4272,7 @@ switch (alt55) { case 1 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:831:25: '{' c= curly_chunk '}' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:827:25: '{' c= curly_chunk '}' { match(input,24,FOLLOW_24_in_curly_chunk2301); following.push(FOLLOW_curly_chunk_in_curly_chunk2305); @@ -4299,7 +4295,7 @@ } break; case 2 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:843:19: any= . + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:839:19: any= . { any=(Token)input.LT(1); matchAny(input); @@ -4336,7 +4332,7 @@ // $ANTLR start lhs_or - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:855:1: lhs_or returns [PatternDescr d] : left= lhs_and ( ('or'|'||') opt_eol right= lhs_and )* ; + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:851:1: lhs_or returns [PatternDescr d] : left= lhs_and ( ('or'|'||') opt_eol right= lhs_and )* ; public PatternDescr lhs_or() throws RecognitionException { PatternDescr d; PatternDescr left = null; @@ -4348,8 +4344,8 @@ d = null; try { - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:860:17: (left= lhs_and ( ('or'|'||') opt_eol right= lhs_and )* ) - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:860:17: left= lhs_and ( ('or'|'||') opt_eol right= lhs_and )* + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:856:17: (left= lhs_and ( ('or'|'||') opt_eol right= lhs_and )* ) + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:856:17: left= lhs_and ( ('or'|'||') opt_eol right= lhs_and )* { OrDescr or = null; following.push(FOLLOW_lhs_and_in_lhs_or2365); @@ -4357,7 +4353,7 @@ following.pop(); d = left; - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:862:17: ( ('or'|'||') opt_eol right= lhs_and )* + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:858:17: ( ('or'|'||') opt_eol right= lhs_and )* loop56: do { int alt56=2; @@ -4369,7 +4365,7 @@ switch (alt56) { case 1 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:862:19: ('or'|'||') opt_eol right= lhs_and + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:858:19: ('or'|'||') opt_eol right= lhs_and { if ( input.LA(1)==39||input.LA(1)==51 ) { input.consume(); @@ -4423,7 +4419,7 @@ // $ANTLR start lhs_and - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:876:1: lhs_and returns [PatternDescr d] : left= lhs_unary ( ('and'|'&&') opt_eol right= lhs_unary )* ; + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:872:1: lhs_and returns [PatternDescr d] : left= lhs_unary ( ('and'|'&&') opt_eol right= lhs_unary )* ; public PatternDescr lhs_and() throws RecognitionException { PatternDescr d; PatternDescr left = null; @@ -4435,8 +4431,8 @@ d = null; try { - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:881:17: (left= lhs_unary ( ('and'|'&&') opt_eol right= lhs_unary )* ) - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:881:17: left= lhs_unary ( ('and'|'&&') opt_eol right= lhs_unary )* + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:877:17: (left= lhs_unary ( ('and'|'&&') opt_eol right= lhs_unary )* ) + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:877:17: left= lhs_unary ( ('and'|'&&') opt_eol right= lhs_unary )* { AndDescr and = null; following.push(FOLLOW_lhs_unary_in_lhs_and2426); @@ -4444,7 +4440,7 @@ following.pop(); d = left; - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:883:17: ( ('and'|'&&') opt_eol right= lhs_unary )* + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:879:17: ( ('and'|'&&') opt_eol right= lhs_unary )* loop57: do { int alt57=2; @@ -4456,7 +4452,7 @@ switch (alt57) { case 1 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:883:19: ('and'|'&&') opt_eol right= lhs_unary + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:879:19: ('and'|'&&') opt_eol right= lhs_unary { if ( (input.LA(1)>=52 && input.LA(1)<=53) ) { input.consume(); @@ -4510,7 +4506,7 @@ // $ANTLR start lhs_unary - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:897:1: lhs_unary returns [PatternDescr d] : (u= lhs_exist | u= lhs_not | u= lhs_eval | u= lhs_column | '(' u= lhs ')' ) ; + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:893:1: lhs_unary returns [PatternDescr d] : (u= lhs_exist | u= lhs_not | u= lhs_eval | u= lhs_column | '(' u= lhs ')' ) ; public PatternDescr lhs_unary() throws RecognitionException { PatternDescr d; PatternDescr u = null; @@ -4520,10 +4516,10 @@ d = null; try { - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:901:17: ( (u= lhs_exist | u= lhs_not | u= lhs_eval | u= lhs_column | '(' u= lhs ')' ) ) - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:901:17: (u= lhs_exist | u= lhs_not | u= lhs_eval | u= lhs_column | '(' u= lhs ')' ) + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:897:17: ( (u= lhs_exist | u= lhs_not | u= lhs_eval | u= lhs_column | '(' u= lhs ')' ) ) + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:897:17: (u= lhs_exist | u= lhs_not | u= lhs_eval | u= lhs_column | '(' u= lhs ')' ) { - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:901:17: (u= lhs_exist | u= lhs_not | u= lhs_eval | u= lhs_column | '(' u= lhs ')' ) + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:897:17: (u= lhs_exist | u= lhs_not | u= lhs_eval | u= lhs_column | '(' u= lhs ')' ) int alt58=5; switch ( input.LA(1) ) { case 54: @@ -4543,14 +4539,14 @@ break; default: NoViableAltException nvae = - new NoViableAltException("901:17: (u= lhs_exist | u= lhs_not | u= lhs_eval | u= lhs_column | \'(\' u= lhs \')\' )", 58, 0, input); + new NoViableAltException("897:17: (u= lhs_exist | u= lhs_not | u= lhs_eval | u= lhs_column | \'(\' u= lhs \')\' )", 58, 0, input); throw nvae; } switch (alt58) { case 1 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:901:25: u= lhs_exist + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:897:25: u= lhs_exist { following.push(FOLLOW_lhs_exist_in_lhs_unary2485); u=lhs_exist(); @@ -4560,7 +4556,7 @@ } break; case 2 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:902:25: u= lhs_not + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:898:25: u= lhs_not { following.push(FOLLOW_lhs_not_in_lhs_unary2493); u=lhs_not(); @@ -4570,7 +4566,7 @@ } break; case 3 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:903:25: u= lhs_eval + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:899:25: u= lhs_eval { following.push(FOLLOW_lhs_eval_in_lhs_unary2501); u=lhs_eval(); @@ -4580,7 +4576,7 @@ } break; case 4 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:904:25: u= lhs_column + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:900:25: u= lhs_column { following.push(FOLLOW_lhs_column_in_lhs_unary2509); u=lhs_column(); @@ -4590,7 +4586,7 @@ } break; case 5 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:905:25: '(' u= lhs ')' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:901:25: '(' u= lhs ')' { match(input,21,FOLLOW_21_in_lhs_unary2515); following.push(FOLLOW_lhs_in_lhs_unary2519); @@ -4621,7 +4617,7 @@ // $ANTLR start lhs_exist - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:909:1: lhs_exist returns [PatternDescr d] : loc= 'exists' ( '(' column= lhs_column ')' | column= lhs_column ) ; + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:905:1: lhs_exist returns [PatternDescr d] : loc= 'exists' ( '(' column= lhs_column ')' | column= lhs_column ) ; public PatternDescr lhs_exist() throws RecognitionException { PatternDescr d; Token loc=null; @@ -4632,12 +4628,12 @@ d = null; try { - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:913:17: (loc= 'exists' ( '(' column= lhs_column ')' | column= lhs_column ) ) - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:913:17: loc= 'exists' ( '(' column= lhs_column ')' | column= lhs_column ) + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:909:17: (loc= 'exists' ( '(' column= lhs_column ')' | column= lhs_column ) ) + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:909:17: loc= 'exists' ( '(' column= lhs_column ')' | column= lhs_column ) { loc=(Token)input.LT(1); match(input,54,FOLLOW_54_in_lhs_exist2551); - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:913:30: ( '(' column= lhs_column ')' | column= lhs_column ) + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:909:30: ( '(' column= lhs_column ')' | column= lhs_column ) int alt59=2; int LA59_0 = input.LA(1); if ( LA59_0==21 ) { @@ -4648,13 +4644,13 @@ } else { NoViableAltException nvae = - new NoViableAltException("913:30: ( \'(\' column= lhs_column \')\' | column= lhs_column )", 59, 0, input); + new NoViableAltException("909:30: ( \'(\' column= lhs_column \')\' | column= lhs_column )", 59, 0, input); throw nvae; } switch (alt59) { case 1 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:913:31: '(' column= lhs_column ')' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:909:31: '(' column= lhs_column ')' { match(input,21,FOLLOW_21_in_lhs_exist2554); following.push(FOLLOW_lhs_column_in_lhs_exist2558); @@ -4666,7 +4662,7 @@ } break; case 2 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:913:59: column= lhs_column + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:909:59: column= lhs_column { following.push(FOLLOW_lhs_column_in_lhs_exist2566); column=lhs_column(); @@ -4698,7 +4694,7 @@ // $ANTLR start lhs_not - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:920:1: lhs_not returns [NotDescr d] : loc= 'not' ( '(' column= lhs_column ')' | column= lhs_column ) ; + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:916:1: lhs_not returns [NotDescr d] : loc= 'not' ( '(' column= lhs_column ')' | column= lhs_column ) ; public NotDescr lhs_not() throws RecognitionException { NotDescr d; Token loc=null; @@ -4709,12 +4705,12 @@ d = null; try { - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:924:17: (loc= 'not' ( '(' column= lhs_column ')' | column= lhs_column ) ) - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:924:17: loc= 'not' ( '(' column= lhs_column ')' | column= lhs_column ) + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:920:17: (loc= 'not' ( '(' column= lhs_column ')' | column= lhs_column ) ) + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:920:17: loc= 'not' ( '(' column= lhs_column ')' | column= lhs_column ) { loc=(Token)input.LT(1); match(input,55,FOLLOW_55_in_lhs_not2596); - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:924:27: ( '(' column= lhs_column ')' | column= lhs_column ) + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:920:27: ( '(' column= lhs_column ')' | column= lhs_column ) int alt60=2; int LA60_0 = input.LA(1); if ( LA60_0==21 ) { @@ -4725,13 +4721,13 @@ } else { NoViableAltException nvae = - new NoViableAltException("924:27: ( \'(\' column= lhs_column \')\' | column= lhs_column )", 60, 0, input); + new NoViableAltException("920:27: ( \'(\' column= lhs_column \')\' | column= lhs_column )", 60, 0, input); throw nvae; } switch (alt60) { case 1 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:924:28: '(' column= lhs_column ')' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:920:28: '(' column= lhs_column ')' { match(input,21,FOLLOW_21_in_lhs_not2599); following.push(FOLLOW_lhs_column_in_lhs_not2603); @@ -4743,7 +4739,7 @@ } break; case 2 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:924:57: column= lhs_column + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:920:57: column= lhs_column { following.push(FOLLOW_lhs_column_in_lhs_not2612); column=lhs_column(); @@ -4775,7 +4771,7 @@ // $ANTLR start lhs_eval - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:931:1: lhs_eval returns [PatternDescr d] : 'eval' loc= '(' c= paren_chunk2 ')' ; + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:927:1: lhs_eval returns [PatternDescr d] : 'eval' loc= '(' c= paren_chunk2 ')' ; public PatternDescr lhs_eval() throws RecognitionException { PatternDescr d; Token loc=null; @@ -4787,20 +4783,17 @@ String text = ""; try { - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:936:17: ( 'eval' loc= '(' c= paren_chunk2 ')' ) - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:936:17: 'eval' loc= '(' c= paren_chunk2 ')' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:932:17: ( 'eval' loc= '(' c= paren_chunk2 ')' ) + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:932:17: 'eval' loc= '(' c= paren_chunk2 ')' { match(input,56,FOLLOW_56_in_lhs_eval2638); loc=(Token)input.LT(1); match(input,21,FOLLOW_21_in_lhs_eval2642); - System.err.println( "START EVAL" ); - following.push(FOLLOW_paren_chunk2_in_lhs_eval2655); + following.push(FOLLOW_paren_chunk2_in_lhs_eval2650); c=paren_chunk2(); following.pop(); - System.err.println( "END EVAL" ); - match(input,23,FOLLOW_23_in_lhs_eval2664); - System.err.println( "END 2" ); + match(input,23,FOLLOW_23_in_lhs_eval2654); checkTrailingSemicolon( c, loc.getLine() ); d = new EvalDescr( c ); @@ -4821,7 +4814,7 @@ // $ANTLR start dotted_name - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:947:1: dotted_name returns [String name] : id= ID ( '.' id= ID )* ; + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:941:1: dotted_name returns [String name] : id= ID ( '.' id= ID )* ; public String dotted_name() throws RecognitionException { String name; Token id=null; @@ -4830,13 +4823,13 @@ name = null; try { - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:952:17: (id= ID ( '.' id= ID )* ) - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:952:17: id= ID ( '.' id= ID )* + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:946:17: (id= ID ( '.' id= ID )* ) + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:946:17: id= ID ( '.' id= ID )* { id=(Token)input.LT(1); - match(input,ID,FOLLOW_ID_in_dotted_name2697); + match(input,ID,FOLLOW_ID_in_dotted_name2686); name=id.getText(); - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:952:46: ( '.' id= ID )* + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:946:46: ( '.' id= ID )* loop61: do { int alt61=2; @@ -4848,11 +4841,11 @@ switch (alt61) { case 1 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:952:48: '.' id= ID + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:946:48: '.' id= ID { - match(input,49,FOLLOW_49_in_dotted_name2703); + match(input,49,FOLLOW_49_in_dotted_name2692); id=(Token)input.LT(1); - match(input,ID,FOLLOW_ID_in_dotted_name2707); + match(input,ID,FOLLOW_ID_in_dotted_name2696); name = name + "." + id.getText(); } @@ -4879,7 +4872,7 @@ // $ANTLR start word - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:956:1: word returns [String word] : (id= ID | 'import' | 'use' | 'rule' | 'query' | 'salience' | 'no-loop' | 'when' | 'then' | 'end' | str= STRING ); + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:950:1: word returns [String word] : (id= ID | 'import' | 'use' | 'rule' | 'query' | 'salience' | 'no-loop' | 'when' | 'then' | 'end' | str= STRING ); public String word() throws RecognitionException { String word; Token id=null; @@ -4889,7 +4882,7 @@ word = null; try { - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:960:17: (id= ID | 'import' | 'use' | 'rule' | 'query' | 'salience' | 'no-loop' | 'when' | 'then' | 'end' | str= STRING ) + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:954:17: (id= ID | 'import' | 'use' | 'rule' | 'query' | 'salience' | 'no-loop' | 'when' | 'then' | 'end' | str= STRING ) int alt62=11; switch ( input.LA(1) ) { case ID: @@ -4927,98 +4920,98 @@ break; default: NoViableAltException nvae = - new NoViableAltException("956:1: word returns [String word] : (id= ID | \'import\' | \'use\' | \'rule\' | \'query\' | \'salience\' | \'no-loop\' | \'when\' | \'then\' | \'end\' | str= STRING );", 62, 0, input); + new NoViableAltException("950:1: word returns [String word] : (id= ID | \'import\' | \'use\' | \'rule\' | \'query\' | \'salience\' | \'no-loop\' | \'when\' | \'then\' | \'end\' | str= STRING );", 62, 0, input); throw nvae; } switch (alt62) { case 1 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:960:17: id= ID + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:954:17: id= ID { id=(Token)input.LT(1); - match(input,ID,FOLLOW_ID_in_word2737); + match(input,ID,FOLLOW_ID_in_word2726); word=id.getText(); } break; case 2 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:961:17: 'import' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:955:17: 'import' { - match(input,17,FOLLOW_17_in_word2749); + match(input,17,FOLLOW_17_in_word2738); word="import"; } break; case 3 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:962:17: 'use' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:956:17: 'use' { - match(input,57,FOLLOW_57_in_word2758); + match(input,57,FOLLOW_57_in_word2747); word="use"; } break; case 4 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:963:17: 'rule' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:957:17: 'rule' { - match(input,28,FOLLOW_28_in_word2770); + match(input,28,FOLLOW_28_in_word2759); word="rule"; } break; case 5 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:964:17: 'query' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:958:17: 'query' { - match(input,26,FOLLOW_26_in_word2781); + match(input,26,FOLLOW_26_in_word2770); word="query"; } break; case 6 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:965:17: 'salience' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:959:17: 'salience' { - match(input,33,FOLLOW_33_in_word2791); + match(input,33,FOLLOW_33_in_word2780); word="salience"; } break; case 7 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:966:17: 'no-loop' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:960:17: 'no-loop' { - match(input,34,FOLLOW_34_in_word2799); + match(input,34,FOLLOW_34_in_word2788); word="no-loop"; } break; case 8 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:967:17: 'when' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:961:17: 'when' { - match(input,29,FOLLOW_29_in_word2807); + match(input,29,FOLLOW_29_in_word2796); word="when"; } break; case 9 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:968:17: 'then' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:962:17: 'then' { - match(input,31,FOLLOW_31_in_word2818); + match(input,31,FOLLOW_31_in_word2807); word="then"; } break; case 10 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:969:17: 'end' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:963:17: 'end' { - match(input,27,FOLLOW_27_in_word2829); + match(input,27,FOLLOW_27_in_word2818); word="end"; } break; case 11 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:970:17: str= STRING + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:964:17: str= STRING { str=(Token)input.LT(1); - match(input,STRING,FOLLOW_STRING_in_word2843); + match(input,STRING,FOLLOW_STRING_in_word2832); word=getString(str); } @@ -6988,21 +6981,21 @@ public static final BitSet FOLLOW_lhs_column_in_lhs_not2612 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_56_in_lhs_eval2638 = new BitSet(new long[]{0x0000000000200000L}); public static final BitSet FOLLOW_21_in_lhs_eval2642 = new BitSet(new long[]{0x03FFFFFFFFFFFFF2L}); - public static final BitSet FOLLOW_paren_chunk2_in_lhs_eval2655 = new BitSet(new long[]{0x0000000000800000L}); - public static final BitSet FOLLOW_23_in_lhs_eval2664 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_ID_in_dotted_name2697 = new BitSet(new long[]{0x0002000000000002L}); - public static final BitSet FOLLOW_49_in_dotted_name2703 = new BitSet(new long[]{0x0000000000000020L}); - public static final BitSet FOLLOW_ID_in_dotted_name2707 = new BitSet(new long[]{0x0002000000000002L}); - public static final BitSet FOLLOW_ID_in_word2737 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_17_in_word2749 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_57_in_word2758 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_28_in_word2770 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_26_in_word2781 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_33_in_word2791 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_34_in_word2799 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_29_in_word2807 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_31_in_word2818 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_27_in_word2829 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_STRING_in_word2843 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_paren_chunk2_in_lhs_eval2650 = new BitSet(new long[]{0x0000000000800000L}); + public static final BitSet FOLLOW_23_in_lhs_eval2654 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_ID_in_dotted_name2686 = new BitSet(new long[]{0x0002000000000002L}); + public static final BitSet FOLLOW_49_in_dotted_name2692 = new BitSet(new long[]{0x0000000000000020L}); + public static final BitSet FOLLOW_ID_in_dotted_name2696 = new BitSet(new long[]{0x0002000000000002L}); + public static final BitSet FOLLOW_ID_in_word2726 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_17_in_word2738 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_57_in_word2747 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_28_in_word2759 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_26_in_word2770 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_33_in_word2780 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_34_in_word2788 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_29_in_word2796 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_31_in_word2807 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_27_in_word2818 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_STRING_in_word2832 = new BitSet(new long[]{0x0000000000000002L}); } \ No newline at end of file Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/RuleParserLexer.java =================================================================== --- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/RuleParserLexer.java 2006-04-23 03:03:39 UTC (rev 3914) +++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/RuleParserLexer.java 2006-04-23 03:11:49 UTC (rev 3915) @@ -1,4 +1,4 @@ -// $ANTLR 3.0ea8 /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g 2006-04-22 23:00:58 +// $ANTLR 3.0ea8 /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g 2006-04-22 23:10:17 package org.drools.lang; @@ -1235,7 +1235,7 @@ int charPosition = getCharPositionInLine(); int channel = Token.DEFAULT_CHANNEL; if ( backtracking>0 && alreadyParsedRule(input, 44) ) { return ; } - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:975:17: ( '!' | '@' | '$' | '%' | '^' | '&' | '*' | '_' | '-' | '+' | '|' | ',' | '{' | '}' | '[' | ']' | '=' | '/' | '(' | ')' | '\'' | '\\' | '||' | '&&' | '<<<' | '++' | '--' | '>>>' | '==' | '+=' | '=+' | '-=' | '=-' | '*=' | '=*' | '/=' | '=/' ) + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:969:17: ( '!' | '@' | '$' | '%' | '^' | '&' | '*' | '_' | '-' | '+' | '|' | ',' | '{' | '}' | '[' | ']' | '=' | '/' | '(' | ')' | '\'' | '\\' | '||' | '&&' | '<<<' | '++' | '--' | '>>>' | '==' | '+=' | '=+' | '-=' | '=-' | '*=' | '=*' | '/=' | '=/' ) int alt1=37; switch ( input.LA(1) ) { case '!': @@ -1369,168 +1369,168 @@ default: if (backtracking>0) {failed=true; return ;} NoViableAltException nvae = - new NoViableAltException("974:1: MISC : ( \'!\' | \'@\' | \'$\' | \'%\' | \'^\' | \'&\' | \'*\' | \'_\' | \'-\' | \'+\' | \'|\' | \',\' | \'{\' | \'}\' | \'[\' | \']\' | \'=\' | \'/\' | \'(\' | \')\' | \'\\\'\' | \'\\\\\' | \'||\' | \'&&\' | \'<<<\' | \'++\' | \'--\' | \'>>>\' | \'==\' | \'+=\' | \'=+\' | \'-=\' | \'=-\' | \'*=\' | \'=*\' | \'/=\' | \'=/\' );", 1, 0, input); + new NoViableAltException("968:1: MISC : ( \'!\' | \'@\' | \'$\' | \'%\' | \'^\' | \'&\' | \'*\' | \'_\' | \'-\' | \'+\' | \'|\' | \',\' | \'{\' | \'}\' | \'[\' | \']\' | \'=\' | \'/\' | \'(\' | \')\' | \'\\\'\' | \'\\\\\' | \'||\' | \'&&\' | \'<<<\' | \'++\' | \'--\' | \'>>>\' | \'==\' | \'+=\' | \'=+\' | \'-=\' | \'=-\' | \'*=\' | \'=*\' | \'/=\' | \'=/\' );", 1, 0, input); throw nvae; } switch (alt1) { case 1 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:975:17: '!' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:969:17: '!' { match('!'); if (failed) return ; } break; case 2 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:975:23: '@' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:969:23: '@' { match('@'); if (failed) return ; } break; case 3 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:975:29: '$' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:969:29: '$' { match('$'); if (failed) return ; } break; case 4 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:975:35: '%' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:969:35: '%' { match('%'); if (failed) return ; } break; case 5 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:975:41: '^' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:969:41: '^' { match('^'); if (failed) return ; } break; case 6 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:975:47: '&' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:969:47: '&' { match('&'); if (failed) return ; } break; case 7 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:975:53: '*' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:969:53: '*' { match('*'); if (failed) return ; } break; case 8 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:975:59: '_' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:969:59: '_' { match('_'); if (failed) return ; } break; case 9 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:975:65: '-' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:969:65: '-' { match('-'); if (failed) return ; } break; case 10 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:975:71: '+' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:969:71: '+' { match('+'); if (failed) return ; } break; case 11 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:976:19: '|' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:970:19: '|' { match('|'); if (failed) return ; } break; case 12 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:976:25: ',' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:970:25: ',' { match(','); if (failed) return ; } break; case 13 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:976:31: '{' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:970:31: '{' { match('{'); if (failed) return ; } break; case 14 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:976:37: '}' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:970:37: '}' { match('}'); if (failed) return ; } break; case 15 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:976:43: '[' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:970:43: '[' { match('['); if (failed) return ; } break; case 16 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:976:49: ']' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:970:49: ']' { match(']'); if (failed) return ; } break; case 17 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:976:55: '=' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:970:55: '=' { match('='); if (failed) return ; } break; case 18 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:976:61: '/' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:970:61: '/' { match('/'); if (failed) return ; } break; case 19 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:976:67: '(' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:970:67: '(' { match('('); if (failed) return ; } break; case 20 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:976:73: ')' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:970:73: ')' { match(')'); if (failed) return ; } break; case 21 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:976:79: '\'' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:970:79: '\'' { match('\''); if (failed) return ; } break; case 22 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:976:86: '\\' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:970:86: '\\' { match('\\'); if (failed) return ; } break; case 23 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:977:19: '||' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:971:19: '||' { match("||"); if (failed) return ; @@ -1538,7 +1538,7 @@ } break; case 24 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:977:26: '&&' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:971:26: '&&' { match("&&"); if (failed) return ; @@ -1546,7 +1546,7 @@ } break; case 25 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:977:33: '<<<' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:971:33: '<<<' { match("<<<"); if (failed) return ; @@ -1554,7 +1554,7 @@ } break; case 26 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:977:41: '++' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:971:41: '++' { match("++"); if (failed) return ; @@ -1562,7 +1562,7 @@ } break; case 27 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:977:48: '--' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:971:48: '--' { match("--"); if (failed) return ; @@ -1570,7 +1570,7 @@ } break; case 28 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:977:55: '>>>' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:971:55: '>>>' { match(">>>"); if (failed) return ; @@ -1578,7 +1578,7 @@ } break; case 29 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:977:63: '==' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:971:63: '==' { match("=="); if (failed) return ; @@ -1586,7 +1586,7 @@ } break; case 30 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:977:70: '+=' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:971:70: '+=' { match("+="); if (failed) return ; @@ -1594,7 +1594,7 @@ } break; case 31 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:977:77: '=+' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:971:77: '=+' { match("=+"); if (failed) return ; @@ -1602,7 +1602,7 @@ } break; case 32 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:977:84: '-=' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:971:84: '-=' { match("-="); if (failed) return ; @@ -1610,7 +1610,7 @@ } break; case 33 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:977:91: '=-' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:971:91: '=-' { match("=-"); if (failed) return ; @@ -1618,7 +1618,7 @@ } break; case 34 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:977:97: '*=' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:971:97: '*=' { match("*="); if (failed) return ; @@ -1626,7 +1626,7 @@ } break; case 35 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:977:104: '=*' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:971:104: '=*' { match("=*"); if (failed) return ; @@ -1634,7 +1634,7 @@ } break; case 36 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:978:19: '/=' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:972:19: '/=' { match("/="); if (failed) return ; @@ -1642,7 +1642,7 @@ } break; case 37 : - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:978:26: '=/' + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:972:26: '=/' { match("=/"); if (failed) return ; @@ -1670,8 +1670,8 @@ int charPosition = getCharPositionInLine(); int channel = Token.DEFAULT_CHANNEL; if ( backtracking>0 && alreadyParsedRule(input, 45) ) { return ; } - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:982:17: ( (' '|'\t'|'\f')) - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:982:17: (' '|'\t'|'\f') + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:976:17: ( (' '|'\t'|'\f')) + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:976:17: (' '|'\t'|'\f') { if ( input.LA(1)=='\t'||input.LA(1)=='\f'||input.LA(1)==' ' ) { input.consume(); @@ -1709,10 +1709,10 @@ int charPosition = getCharPositionInLine(); int channel = Token.DEFAULT_CHANNEL; if ( backtracking>0 && alreadyParsedRule(input, 46) ) { return ; } - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:990:17: ( ( ( '\r\n' )=> '\r\n' | '\r' | '\n' ) ) - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:990:17: ( ( '\r\n' )=> '\r\n' | '\r' | '\n' ) + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:984:17: ( ( ( '\r\n' )=> '\r\n' | '\r' | '\n' ) ) + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:984:17: ( ( '\r\n' )=> '\r\n' | '\r' | '\n' ) { - // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:990:17: ( ( '\r\n' )=> '\r\n' | '\r' | '\n' ) + // /Users/bob/checkouts/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:984:17: ( ( '\r\n' )=> '\r\n' | '\r' | '\n' ) int alt2=3; int LA2_0 = input.LA(1); if ( LA2_0=='\r' ) { @@ -1729,13 +1729,13 @@ else { if (backtracking>0) {failed=true; return ;... [truncated message content] |
From: <jbo...@li...> - 2006-04-23 02:52:17
|
Author: woolfel Date: 2006-04-22 22:52:13 -0400 (Sat, 22 Apr 2006) New Revision: 3913 Added: labs/jbossrules/trunk/drools-examples/src/test/java/com/sample/benchmark/SharedNodePerformanceTest.java Log: adding a new test for shared nodes peter Added: labs/jbossrules/trunk/drools-examples/src/test/java/com/sample/benchmark/SharedNodePerformanceTest.java =================================================================== --- labs/jbossrules/trunk/drools-examples/src/test/java/com/sample/benchmark/SharedNodePerformanceTest.java 2006-04-23 02:46:48 UTC (rev 3912) +++ labs/jbossrules/trunk/drools-examples/src/test/java/com/sample/benchmark/SharedNodePerformanceTest.java 2006-04-23 02:52:13 UTC (rev 3913) @@ -0,0 +1,420 @@ +package com.sample.benchmark; + +import junit.framework.TestCase; + +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.Reader; +import java.util.ArrayList; +import java.util.Iterator; + +import org.drools.PackageIntegrationException; +import org.drools.RuleBase; +import org.drools.RuleIntegrationException; +import org.drools.WorkingMemory; +import org.drools.compiler.DrlParser; +import org.drools.compiler.DroolsParserException; +import org.drools.compiler.PackageBuilder; +import org.drools.lang.descr.PackageDescr; +import org.drools.reteoo.RuleBaseImpl; +import org.drools.rule.InvalidPatternException; +import org.drools.rule.Package; + +import com.sample.benchmark.models.Address; + +/** + * @author Peter Lin + * + */ +public class SharedNodePerformanceTest extends TestCase { + public SharedNodePerformanceTest() { + super(); + } + + public void setUp() { + + } + + public void tearDown() { + + } + + private static RuleBase readRule(String file) throws IOException, DroolsParserException, RuleIntegrationException, PackageIntegrationException, InvalidPatternException { + //read in the source + Reader reader = + new InputStreamReader( + SharedNodePerformanceTest.class.getResourceAsStream( file ) ); + DrlParser parser = new DrlParser(); + PackageDescr packageDescr = parser.parse( reader ); + + //pre build the package + PackageBuilder builder = new PackageBuilder(); + builder.addPackage( packageDescr ); + Package pkg = builder.getPackage(); + + //add the package to a rulebase + RuleBaseImpl ruleBase = new RuleBaseImpl(); + ruleBase.addPackage( pkg ); + return ruleBase; + } + + /** + * test the performance with 50 facts and 5 rules. The test measures + * the load, assert and fire time. + */ + public void testFiveSharedNodes() { + try { + int factCount = 5000; + String file = "20rules_5shared.drl"; + int loop = 5; + long totalload = 0; + long totalassert = 0; + long totalfire = 0; + for (int c=0; c < loop; c++) { + long loadStart = System.currentTimeMillis(); + RuleBase ruleBase = readRule(file); + long loadEnd = System.currentTimeMillis(); + long loadet = loadEnd - loadStart; + totalload += loadet; + System.out.println("time to load " + file + + " " + loadet + "ms"); + WorkingMemory workingMemory = ruleBase.newWorkingMemory(); + ArrayList objects = new ArrayList(); + // create the objects + for (int idx=0; idx < factCount; idx++) { + Address addr = new Address(); + addr.setCity("boston"); + addr.setState("ma"); + addr.setHouseType("single family"); + addr.setStatus("not listed"); + addr.setCountry("usa"); + addr.setAccountId("acc" + idx); + objects.add(addr); + } + Iterator itr = objects.iterator(); + long assertStart = System.currentTimeMillis(); + while( itr.hasNext() ) { + workingMemory.assertObject(itr.next()); + } + long assertEnd = System.currentTimeMillis(); + long assertet = assertEnd - assertStart; + totalassert += assertet; + System.out.println("time to assert " + assertet + + " ms"); + long fireStart = System.currentTimeMillis(); + workingMemory.fireAllRules(); + long fireEnd = System.currentTimeMillis(); + long fireet = fireEnd - fireStart; + totalfire += fireet; + System.out.println("time to fireAllRules " + fireet + + " ms"); + workingMemory.dispose(); + } + System.out.println(file); + System.out.println("number of objects asserted " + factCount); + System.out.println("average load " + (totalload/loop) + " ms"); + System.out.println("average assert " + (totalassert/loop) + " ms"); + System.out.println("average fire " + (totalfire/loop) + " ms"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * + * + */ + public void testFourSharedNodes() { + try { + int factCount = 5000; + String file = "20rules_4shared.drl"; + int loop = 5; + long totalload = 0; + long totalassert = 0; + long totalfire = 0; + for (int c=0; c < loop; c++) { + long loadStart = System.currentTimeMillis(); + RuleBase ruleBase = readRule(file); + long loadEnd = System.currentTimeMillis(); + long loadet = loadEnd - loadStart; + totalload += loadet; + System.out.println("time to load " + file + + " " + loadet + "ms"); + WorkingMemory workingMemory = ruleBase.newWorkingMemory(); + ArrayList objects = new ArrayList(); + // create the objects + for (int idx=0; idx < factCount; idx++) { + Address addr = new Address(); + addr.setCity("boston"); + addr.setState("ma"); + addr.setHouseType("single family"); + addr.setStatus("not listed"); + addr.setCountry("usa" + idx); + objects.add(addr); + } + Iterator itr = objects.iterator(); + long assertStart = System.currentTimeMillis(); + while( itr.hasNext() ) { + workingMemory.assertObject(itr.next()); + } + long assertEnd = System.currentTimeMillis(); + long assertet = assertEnd - assertStart; + totalassert += assertet; + System.out.println("time to assert " + assertet + + " ms"); + long fireStart = System.currentTimeMillis(); + workingMemory.fireAllRules(); + long fireEnd = System.currentTimeMillis(); + long fireet = fireEnd - fireStart; + totalfire += fireet; + System.out.println("time to fireAllRules " + fireet + + " ms"); + workingMemory.dispose(); + } + System.out.println(file); + System.out.println("number of objects asserted " + factCount); + System.out.println("average load " + (totalload/loop) + " ms"); + System.out.println("average assert " + (totalassert/loop) + " ms"); + System.out.println("average fire " + (totalfire/loop) + " ms"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * + * + */ + public void testThreeSharedNodes() { + try { + int factCount = 5000; + String file = "20rules_3shared.drl"; + int loop = 5; + long totalload = 0; + long totalassert = 0; + long totalfire = 0; + for (int c=0; c < loop; c++) { + long loadStart = System.currentTimeMillis(); + RuleBase ruleBase = readRule(file); + long loadEnd = System.currentTimeMillis(); + long loadet = loadEnd - loadStart; + totalload += loadet; + System.out.println("time to load " + file + + " " + loadet + "ms"); + WorkingMemory workingMemory = ruleBase.newWorkingMemory(); + ArrayList objects = new ArrayList(); + // create the objects + for (int idx=0; idx < factCount; idx++) { + Address addr = new Address(); + addr.setCity("boston"); + addr.setState("ma"); + addr.setHouseType("single family"); + addr.setStatus("not listed" + idx); + addr.setCountry("usa"); + objects.add(addr); + } + Iterator itr = objects.iterator(); + long assertStart = System.currentTimeMillis(); + while( itr.hasNext() ) { + workingMemory.assertObject(itr.next()); + } + long assertEnd = System.currentTimeMillis(); + long assertet = assertEnd - assertStart; + totalassert += assertet; + System.out.println("time to assert " + assertet + + " ms"); + long fireStart = System.currentTimeMillis(); + workingMemory.fireAllRules(); + long fireEnd = System.currentTimeMillis(); + long fireet = fireEnd - fireStart; + totalfire += fireet; + System.out.println("time to fireAllRules " + fireet + + " ms"); + workingMemory.dispose(); + } + System.out.println(file); + System.out.println("number of objects asserted " + factCount); + System.out.println("average load " + (totalload/loop) + " ms"); + System.out.println("average assert " + (totalassert/loop) + " ms"); + System.out.println("average fire " + (totalfire/loop) + " ms"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * + * + */ + public void testTwoSharedNodes() { + try { + int factCount = 5000; + String file = "20rules_2shared.drl"; + int loop = 5; + long totalload = 0; + long totalassert = 0; + long totalfire = 0; + for (int c=0; c < loop; c++) { + long loadStart = System.currentTimeMillis(); + RuleBase ruleBase = readRule(file); + long loadEnd = System.currentTimeMillis(); + long loadet = loadEnd - loadStart; + totalload += loadet; + System.out.println("time to load " + file + + " " + loadet + "ms"); + WorkingMemory workingMemory = ruleBase.newWorkingMemory(); + ArrayList objects = new ArrayList(); + // create the objects + for (int idx=0; idx < factCount; idx++) { + Address addr = new Address(); + addr.setCity("boston"); + addr.setState("ma"); + addr.setHouseType("single family" + idx); + addr.setStatus("not listed"); + addr.setCountry("usa"); + objects.add(addr); + } + Iterator itr = objects.iterator(); + long assertStart = System.currentTimeMillis(); + while( itr.hasNext() ) { + workingMemory.assertObject(itr.next()); + } + long assertEnd = System.currentTimeMillis(); + long assertet = assertEnd - assertStart; + totalassert += assertet; + System.out.println("time to assert " + assertet + + " ms"); + long fireStart = System.currentTimeMillis(); + workingMemory.fireAllRules(); + long fireEnd = System.currentTimeMillis(); + long fireet = fireEnd - fireStart; + totalfire += fireet; + System.out.println("time to fireAllRules " + fireet + + " ms"); + workingMemory.dispose(); + } + System.out.println(file); + System.out.println("number of objects asserted " + factCount); + System.out.println("average load " + (totalload/loop) + " ms"); + System.out.println("average assert " + (totalassert/loop) + " ms"); + System.out.println("average fire " + (totalfire/loop) + " ms"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void testOneSharedNodes() { + try { + int factCount = 5000; + String file = "20rules_1shared.drl"; + int loop = 5; + long totalload = 0; + long totalassert = 0; + long totalfire = 0; + for (int c=0; c < loop; c++) { + long loadStart = System.currentTimeMillis(); + RuleBase ruleBase = readRule(file); + long loadEnd = System.currentTimeMillis(); + long loadet = loadEnd - loadStart; + totalload += loadet; + System.out.println("time to load " + file + + " " + loadet + "ms"); + WorkingMemory workingMemory = ruleBase.newWorkingMemory(); + ArrayList objects = new ArrayList(); + // create the objects + for (int idx=0; idx < factCount; idx++) { + Address addr = new Address(); + addr.setCity("boston"); + addr.setState("ma" + idx); + addr.setHouseType("single family"); + addr.setStatus("not listed"); + addr.setCountry("usa"); + objects.add(addr); + } + Iterator itr = objects.iterator(); + long assertStart = System.currentTimeMillis(); + while( itr.hasNext() ) { + workingMemory.assertObject(itr.next()); + } + long assertEnd = System.currentTimeMillis(); + long assertet = assertEnd - assertStart; + totalassert += assertet; + System.out.println("time to assert " + assertet + + " ms"); + long fireStart = System.currentTimeMillis(); + workingMemory.fireAllRules(); + long fireEnd = System.currentTimeMillis(); + long fireet = fireEnd - fireStart; + totalfire += fireet; + System.out.println("time to fireAllRules " + fireet + + " ms"); + workingMemory.dispose(); + } + System.out.println(file); + System.out.println("number of objects asserted " + factCount); + System.out.println("average load " + (totalload/loop) + " ms"); + System.out.println("average assert " + (totalassert/loop) + " ms"); + System.out.println("average fire " + (totalfire/loop) + " ms"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void testNoneSharedNodes() { + try { + int factCount = 50000; + String file = "20rules_0shared.drl"; + int loop = 5; + long totalload = 0; + long totalassert = 0; + long totalfire = 0; + for (int c=0; c < loop; c++) { + long loadStart = System.currentTimeMillis(); + RuleBase ruleBase = readRule(file); + long loadEnd = System.currentTimeMillis(); + long loadet = loadEnd - loadStart; + totalload += loadet; + System.out.println("time to load " + file + + " " + loadet + "ms"); + WorkingMemory workingMemory = ruleBase.newWorkingMemory(); + ArrayList objects = new ArrayList(); + // create the objects + for (int idx=0; idx < factCount; idx++) { + Address addr = new Address(); + addr.setAccountId("acc" + idx); + addr.setCity("boston"); + addr.setState("ma"); + addr.setHouseType("single family"); + addr.setStatus("not listed"); + addr.setCountry("usa"); + objects.add(addr); + } + Iterator itr = objects.iterator(); + long assertStart = System.currentTimeMillis(); + while( itr.hasNext() ) { + workingMemory.assertObject(itr.next()); + } + long assertEnd = System.currentTimeMillis(); + long assertet = assertEnd - assertStart; + totalassert += assertet; + System.out.println("time to assert " + assertet + + " ms"); + long fireStart = System.currentTimeMillis(); + workingMemory.fireAllRules(); + long fireEnd = System.currentTimeMillis(); + long fireet = fireEnd - fireStart; + totalfire += fireet; + System.out.println("time to fireAllRules " + fireet + + " ms"); + workingMemory.dispose(); + } + System.out.println(file); + System.out.println("number of objects asserted " + factCount); + System.out.println("average load " + (totalload/loop) + " ms"); + System.out.println("average assert " + (totalassert/loop) + " ms"); + System.out.println("average fire " + (totalfire/loop) + " ms"); + } catch (Exception e) { + e.printStackTrace(); + } + } +} |
From: <jbo...@li...> - 2006-04-23 02:46:53
|
Author: woolfel Date: 2006-04-22 22:46:48 -0400 (Sat, 22 Apr 2006) New Revision: 3912 Added: labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_0shared.drl labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_1shared.drl labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_2shared.drl labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_3shared.drl labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_4shared.drl labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_5shared.drl Log: adding rules with 0-5 shared nodes. peter Added: labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_0shared.drl =================================================================== --- labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_0shared.drl 2006-04-23 02:30:10 UTC (rev 3911) +++ labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_0shared.drl 2006-04-23 02:46:48 UTC (rev 3912) @@ -0,0 +1,143 @@ +package org.drools.samples +import com.sample.benchmark.models.Address; + +rule rule0 + when + $addr : Address(accountId == "acc0", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule0 fired"); +end + +rule rule1 + when + $addr : Address(accountId == "acc1", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule1 fired"); +end + +rule rule2 + when + $addr : Address(accountId == "acc2", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule2 fired"); +end + +rule rule3 + when + $addr : Address(accountId == "acc3", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule3 fired"); +end + +rule rule4 + when + $addr : Address(accountId == "acc4", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule4 fired"); +end + +rule rule5 + when + $addr : Address(accountId == "acc5", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule5 fired"); +end + +rule rule6 + when + $addr : Address(accountId == "acc6", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule6 fired"); +end + +rule rule7 + when + $addr : Address(accountId == "acc7", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule7 fired"); +end + +rule rule8 + when + $addr : Address(accountId == "acc8", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule8 fired"); +end + +rule rule9 + when + $addr : Address(accountId == "acc9", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule9 fired"); +end + +rule rule10 + when + $addr : Address(accountId == "acc10", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule10 fired"); +end + +rule rule11 + when + $addr : Address(accountId == "acc11", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule11 fired"); +end + +rule rule12 + when + $addr : Address(accountId == "acc12", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule12 fired"); +end + +rule rule13 + when + $addr : Address(accountId == "acc13", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule13 fired"); +end + +rule rule14 + when + $addr : Address(accountId == "acc14", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule14 fired"); +end + +rule rule15 + when + $addr : Address(accountId == "acc15", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule15 fired"); +end + +rule rule16 + when + $addr : Address(accountId == "acc16", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule16 fired"); +end + +rule rule17 + when + $addr : Address(accountId == "acc17", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule17 fired"); +end + +rule rule18 + when + $addr : Address(accountId == "acc18", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule18 fired"); +end + +rule rule19 + when + $addr : Address(accountId == "acc19", city == "boston", state == "ma", houseType == "single family", status == "not listed") + then + System.out.println("rule19 fired"); +end + Added: labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_1shared.drl =================================================================== --- labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_1shared.drl 2006-04-23 02:30:10 UTC (rev 3911) +++ labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_1shared.drl 2006-04-23 02:46:48 UTC (rev 3912) @@ -0,0 +1,143 @@ +package org.drools.samples +import com.sample.benchmark.models.Address; + +rule rule0 + when + $addr : Address(city == "boston", state == "ma0", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule0 fired"); +end + +rule rule1 + when + $addr : Address(city == "boston", state == "ma1", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule1 fired"); +end + +rule rule2 + when + $addr : Address(city == "boston", state == "ma2", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule2 fired"); +end + +rule rule3 + when + $addr : Address(city == "boston", state == "ma3", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule3 fired"); +end + +rule rule4 + when + $addr : Address(city == "boston", state == "ma4", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule4 fired"); +end + +rule rule5 + when + $addr : Address(city == "boston", state == "ma5", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule5 fired"); +end + +rule rule6 + when + $addr : Address(city == "boston", state == "ma6", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule6 fired"); +end + +rule rule7 + when + $addr : Address(city == "boston", state == "ma7", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule7 fired"); +end + +rule rule8 + when + $addr : Address(city == "boston", state == "ma8", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule8 fired"); +end + +rule rule9 + when + $addr : Address(city == "boston", state == "ma9", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule9 fired"); +end + +rule rule10 + when + $addr : Address(city == "boston", state == "ma10", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule10 fired"); +end + +rule rule11 + when + $addr : Address(city == "boston", state == "ma11", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule11 fired"); +end + +rule rule12 + when + $addr : Address(city == "boston", state == "ma12", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule12 fired"); +end + +rule rule13 + when + $addr : Address(city == "boston", state == "ma13", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule13 fired"); +end + +rule rule14 + when + $addr : Address(city == "boston", state == "ma14", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule14 fired"); +end + +rule rule15 + when + $addr : Address(city == "boston", state == "ma15", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule15 fired"); +end + +rule rule16 + when + $addr : Address(city == "boston", state == "ma16", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule16 fired"); +end + +rule rule17 + when + $addr : Address(city == "boston", state == "ma17", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule17 fired"); +end + +rule rule18 + when + $addr : Address(city == "boston", state == "ma18", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule18 fired"); +end + +rule rule19 + when + $addr : Address(city == "boston", state == "ma19", houseType == "single family", status == "not listed", country == "usa") + then + System.out.println("rule19 fired"); +end + Added: labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_2shared.drl =================================================================== --- labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_2shared.drl 2006-04-23 02:30:10 UTC (rev 3911) +++ labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_2shared.drl 2006-04-23 02:46:48 UTC (rev 3912) @@ -0,0 +1,143 @@ +package org.drools.samples +import com.sample.benchmark.models.Address; + +rule rule0 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family0", status == "not listed", country == "usa") + then + System.out.println("rule0 fired"); +end + +rule rule1 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family1", status == "not listed", country == "usa") + then + System.out.println("rule1 fired"); +end + +rule rule2 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family2", status == "not listed", country == "usa") + then + System.out.println("rule2 fired"); +end + +rule rule3 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family3", status == "not listed", country == "usa") + then + System.out.println("rule3 fired"); +end + +rule rule4 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family4", status == "not listed", country == "usa") + then + System.out.println("rule4 fired"); +end + +rule rule5 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family5", status == "not listed", country == "usa") + then + System.out.println("rule5 fired"); +end + +rule rule6 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family6", status == "not listed", country == "usa") + then + System.out.println("rule6 fired"); +end + +rule rule7 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family7", status == "not listed", country == "usa") + then + System.out.println("rule7 fired"); +end + +rule rule8 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family8", status == "not listed", country == "usa") + then + System.out.println("rule8 fired"); +end + +rule rule9 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family9", status == "not listed", country == "usa") + then + System.out.println("rule9 fired"); +end + +rule rule10 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family10", status == "not listed", country == "usa") + then + System.out.println("rule10 fired"); +end + +rule rule11 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family11", status == "not listed", country == "usa") + then + System.out.println("rule11 fired"); +end + +rule rule12 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family12", status == "not listed", country == "usa") + then + System.out.println("rule12 fired"); +end + +rule rule13 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family13", status == "not listed", country == "usa") + then + System.out.println("rule13 fired"); +end + +rule rule14 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family14", status == "not listed", country == "usa") + then + System.out.println("rule14 fired"); +end + +rule rule15 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family15", status == "not listed", country == "usa") + then + System.out.println("rule15 fired"); +end + +rule rule16 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family16", status == "not listed", country == "usa") + then + System.out.println("rule16 fired"); +end + +rule rule17 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family17", status == "not listed", country == "usa") + then + System.out.println("rule17 fired"); +end + +rule rule18 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family18", status == "not listed", country == "usa") + then + System.out.println("rule18 fired"); +end + +rule rule19 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family19", status == "not listed", country == "usa") + then + System.out.println("rule19 fired"); +end + Added: labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_3shared.drl =================================================================== --- labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_3shared.drl 2006-04-23 02:30:10 UTC (rev 3911) +++ labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_3shared.drl 2006-04-23 02:46:48 UTC (rev 3912) @@ -0,0 +1,143 @@ +package org.drools.samples +import com.sample.benchmark.models.Address; + +rule rule0 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed0", country == "usa") + then + System.out.println("rule0 fired"); +end + +rule rule1 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed1", country == "usa") + then + System.out.println("rule1 fired"); +end + +rule rule2 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed2", country == "usa") + then + System.out.println("rule2 fired"); +end + +rule rule3 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed3", country == "usa") + then + System.out.println("rule3 fired"); +end + +rule rule4 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed4", country == "usa") + then + System.out.println("rule4 fired"); +end + +rule rule5 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed5", country == "usa") + then + System.out.println("rule5 fired"); +end + +rule rule6 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed6", country == "usa") + then + System.out.println("rule6 fired"); +end + +rule rule7 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed7", country == "usa") + then + System.out.println("rule7 fired"); +end + +rule rule8 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed8", country == "usa") + then + System.out.println("rule8 fired"); +end + +rule rule9 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed9", country == "usa") + then + System.out.println("rule9 fired"); +end + +rule rule10 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed10", country == "usa") + then + System.out.println("rule10 fired"); +end + +rule rule11 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed11", country == "usa") + then + System.out.println("rule11 fired"); +end + +rule rule12 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed12", country == "usa") + then + System.out.println("rule12 fired"); +end + +rule rule13 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed13", country == "usa") + then + System.out.println("rule13 fired"); +end + +rule rule14 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed14", country == "usa") + then + System.out.println("rule14 fired"); +end + +rule rule15 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed15", country == "usa") + then + System.out.println("rule15 fired"); +end + +rule rule16 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed16", country == "usa") + then + System.out.println("rule16 fired"); +end + +rule rule17 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed17", country == "usa") + then + System.out.println("rule17 fired"); +end + +rule rule18 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed18", country == "usa") + then + System.out.println("rule18 fired"); +end + +rule rule19 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed19", country == "usa") + then + System.out.println("rule19 fired"); +end + Added: labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_4shared.drl =================================================================== --- labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_4shared.drl 2006-04-23 02:30:10 UTC (rev 3911) +++ labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_4shared.drl 2006-04-23 02:46:48 UTC (rev 3912) @@ -0,0 +1,143 @@ +package org.drools.samples +import com.sample.benchmark.models.Address; + +rule rule0 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa0") + then + System.out.println("rule0 fired"); +end + +rule rule1 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa1") + then + System.out.println("rule1 fired"); +end + +rule rule2 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa2") + then + System.out.println("rule2 fired"); +end + +rule rule3 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa3") + then + System.out.println("rule3 fired"); +end + +rule rule4 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa4") + then + System.out.println("rule4 fired"); +end + +rule rule5 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa5") + then + System.out.println("rule5 fired"); +end + +rule rule6 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa6") + then + System.out.println("rule6 fired"); +end + +rule rule7 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa7") + then + System.out.println("rule7 fired"); +end + +rule rule8 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa8") + then + System.out.println("rule8 fired"); +end + +rule rule9 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa9") + then + System.out.println("rule9 fired"); +end + +rule rule10 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa10") + then + System.out.println("rule10 fired"); +end + +rule rule11 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa11") + then + System.out.println("rule11 fired"); +end + +rule rule12 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa12") + then + System.out.println("rule12 fired"); +end + +rule rule13 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa13") + then + System.out.println("rule13 fired"); +end + +rule rule14 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa14") + then + System.out.println("rule14 fired"); +end + +rule rule15 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa15") + then + System.out.println("rule15 fired"); +end + +rule rule16 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa16") + then + System.out.println("rule16 fired"); +end + +rule rule17 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa17") + then + System.out.println("rule17 fired"); +end + +rule rule18 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa18") + then + System.out.println("rule18 fired"); +end + +rule rule19 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa19") + then + System.out.println("rule19 fired"); +end + Added: labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_5shared.drl =================================================================== --- labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_5shared.drl 2006-04-23 02:30:10 UTC (rev 3911) +++ labs/jbossrules/trunk/drools-examples/src/test/resources/com/sample/benchmark/20rules_5shared.drl 2006-04-23 02:46:48 UTC (rev 3912) @@ -0,0 +1,143 @@ +package org.drools.samples +import com.sample.benchmark.models.Address; + +rule rule0 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc0") + then + System.out.println("rule0 fired"); +end + +rule rule1 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc1") + then + System.out.println("rule1 fired"); +end + +rule rule2 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc2") + then + System.out.println("rule2 fired"); +end + +rule rule3 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc3") + then + System.out.println("rule3 fired"); +end + +rule rule4 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc4") + then + System.out.println("rule4 fired"); +end + +rule rule5 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc5") + then + System.out.println("rule5 fired"); +end + +rule rule6 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc6") + then + System.out.println("rule6 fired"); +end + +rule rule7 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc7") + then + System.out.println("rule7 fired"); +end + +rule rule8 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc8") + then + System.out.println("rule8 fired"); +end + +rule rule9 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc9") + then + System.out.println("rule9 fired"); +end + +rule rule10 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc10") + then + System.out.println("rule10 fired"); +end + +rule rule11 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc11") + then + System.out.println("rule11 fired"); +end + +rule rule12 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc12") + then + System.out.println("rule12 fired"); +end + +rule rule13 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc13") + then + System.out.println("rule13 fired"); +end + +rule rule14 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc14") + then + System.out.println("rule14 fired"); +end + +rule rule15 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc15") + then + System.out.println("rule15 fired"); +end + +rule rule16 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc16") + then + System.out.println("rule16 fired"); +end + +rule rule17 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc17") + then + System.out.println("rule17 fired"); +end + +rule rule18 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc18") + then + System.out.println("rule18 fired"); +end + +rule rule19 + when + $addr : Address(city == "boston", state == "ma", houseType == "single family", status == "not listed", country == "usa", accountId == "acc19") + then + System.out.println("rule19 fired"); +end + |