[jboss-svn-commits] JBL Code SVN: r20956 - labs/jbossrules/trunk/drools-verifier/src/test/resources/org/drools/verifier.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Jul 8 03:57:11 EDT 2008
Author: Rikkola
Date: 2008-07-08 03:57:11 -0400 (Tue, 08 Jul 2008)
New Revision: 20956
Added:
labs/jbossrules/trunk/drools-verifier/src/test/resources/org/drools/verifier/Enums.drl
Log:
1. JBRULES-1341: Analytics fails on Inner Class Enums.
2. Changed ObjectTypes from Class to ObjectType.
Added: labs/jbossrules/trunk/drools-verifier/src/test/resources/org/drools/verifier/Enums.drl
===================================================================
--- labs/jbossrules/trunk/drools-verifier/src/test/resources/org/drools/verifier/Enums.drl (rev 0)
+++ labs/jbossrules/trunk/drools-verifier/src/test/resources/org/drools/verifier/Enums.drl 2008-07-08 07:57:11 UTC (rev 20956)
@@ -0,0 +1,118 @@
+package org.drools.benchmark.manners
+
+
+
+rule assignFirstSeat
+ when
+ context : Context( state == Context.START_UP )
+ guest : Guest()
+ count : Count()
+ then
+ #
+end
+
+/*
+rule assignFirstSeat
+ when
+ context : Context( state == Context.START_UP )
+ guest : Guest()
+ count : Count()
+ then
+ String guestName = guest.getName();
+
+ Seating seating = new Seating( count.getValue(), 1, true, 1, guestName, 1, guestName);
+ insert( seating );
+
+ Path path = new Path( count.getValue(), 1, guestName );
+ insert( path );
+
+ modify( count ) { setValue ( count.getValue() + 1 ) }
+
+ System.out.println( "assign first seat : " + seating + " : " + path );
+
+ modify( context ) {
+ setState( Context.ASSIGN_SEATS )
+ }
+end
+
+rule findSeating
+ when
+ context : Context( state == Context.ASSIGN_SEATS )
+ $s : Seating( pathDone == true )
+ $g1 : Guest( name == $s.rightGuestName )
+ $g2 : Guest( sex != $g1.sex, hobby == $g1.hobby )
+
+ count : Count()
+
+ not ( Path( id == $s.id, guestName == $g2.name) )
+ not ( Chosen( id == $s.id, guestName == $g2.name, hobby == $g1.hobby) )
+ then
+ int rightSeat = $s.getRightSeat();
+ int seatId = $s.getId();
+ int countValue = count.getValue();
+
+ Seating seating = new Seating( countValue, seatId, false, rightSeat, $s.getRightGuestName(), rightSeat + 1, $g2.getName() );
+ insert( seating );
+
+ Path path = new Path( countValue, rightSeat + 1, $g2.getName() );
+ insert( path );
+
+ Chosen chosen = new Chosen( seatId, $g2.getName(), $g1.getHobby() );
+ insert( chosen );
+
+ System.err.println( "find seating : " + seating + " : " + path + " : " + chosen);
+
+ modify( count ) {setValue( countValue + 1 )}
+ modify( context ) {setState( Context.MAKE_PATH )}
+end
+
+rule makePath
+ when
+ Context( state == Context.MAKE_PATH )
+ Seating( seatingId:id, seatingPid:pid, pathDone == false )
+ Path( id == seatingPid, pathGuestName:guestName, pathSeat:seat )
+ not Path( id == seatingId, guestName == pathGuestName )
+ then
+ insert( new Path( seatingId, pathSeat, pathGuestName ) );
+end
+
+rule pathDone
+ when
+ context : Context( state == Context.MAKE_PATH )
+ seating : Seating( pathDone == false )
+ then
+ modify( seating ) {setPathDone( true )}
+
+ modify( context ) {setState( Context.CHECK_DONE)}
+end
+
+
+rule areWeDone
+ when
+ context : Context( state == Context.CHECK_DONE )
+ LastSeat( lastSeat: seat )
+ Seating( rightSeat == lastSeat )
+ then
+ modify( context ) {setState(Context.PRINT_RESULTS )}
+end
+
+rule continue
+ when
+ context : Context( state == Context.CHECK_DONE )
+ then
+ modify( context ) {setState( Context.ASSIGN_SEATS )}
+end
+
+
+rule allDone
+ when
+ context : Context( state == Context.PRINT_RESULTS )
+ then
+ System.out.println( "All Done" );
+end
+*/
+
+//query getResults
+// context : Context( state == Context.PRINT_RESULTS )
+//end
+
\ No newline at end of file
More information about the jboss-svn-commits
mailing list