[jboss-svn-commits] JBL Code SVN: r9388 - in labs/jbossrules/trunk/drools-examples: src/main/java/org/drools/benchmark/waltzdb and 4 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Feb 6 23:11:58 EST 2007


Author: mark.proctor at jboss.com
Date: 2007-02-06 23:11:58 -0500 (Tue, 06 Feb 2007)
New Revision: 9388

Modified:
   labs/jbossrules/trunk/drools-examples/.classpath
   labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/benchmark/waltzdb/Edge.java
   labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/benchmark/waltzdb/EdgeLabel.java
   labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/benchmark/waltzdb/Illegal.java
   labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/benchmark/waltzdb/Junction.java
   labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/benchmark/waltzdb/Label.java
   labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/benchmark/waltzdb/Line.java
   labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/benchmark/waltzdb/Stage.java
   labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/examples/State.java
   labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/examples/StateExampleUsingAgendGroup.java
   labs/jbossrules/trunk/drools-examples/src/main/rules/org/drools/benchmark/manners/manners.drl
   labs/jbossrules/trunk/drools-examples/src/main/rules/org/drools/benchmark/waltz/waltz.drl
   labs/jbossrules/trunk/drools-examples/src/main/rules/org/drools/examples/Fibonacci.drl
   labs/jbossrules/trunk/drools-examples/src/main/rules/org/drools/examples/golf.drl
Log:
-Fixed examples for trunk, mostly just intValues() as we handle primitives correctly now

Modified: labs/jbossrules/trunk/drools-examples/.classpath
===================================================================
--- labs/jbossrules/trunk/drools-examples/.classpath	2007-02-07 03:20:58 UTC (rev 9387)
+++ labs/jbossrules/trunk/drools-examples/.classpath	2007-02-07 04:11:58 UTC (rev 9388)
@@ -5,9 +5,10 @@
 	<classpathentry kind="src" path="src/main/rules"/>
 	<classpathentry output="target/test-classes" kind="src" path="src/test/java"/>
 	<classpathentry output="target/test-classes" kind="src" path="src/test/resources"/>
-	<classpathentry kind="con" path="DROOLS/JBoss Rules"/>
+	<classpathentry kind="con" path="DROOLS/JBoss Rules"/>	
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry kind="lib" path="lib/foxtrot-2.0.jar"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3.8.1"/>
+	<classpathentry kind="lib" path="lib/foxtrot-2.0.jar"/>	
 	<classpathentry kind="lib" path="lib/jgoodies-forms-1.0.4.jar"/>
-	<classpathentry kind="output" path="target/classes"/>
+	<classpathentry kind="output" path="target/classes"/>  
 </classpath>

Modified: labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/benchmark/waltzdb/Edge.java
===================================================================
--- labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/benchmark/waltzdb/Edge.java	2007-02-07 03:20:58 UTC (rev 9387)
+++ labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/benchmark/waltzdb/Edge.java	2007-02-07 04:11:58 UTC (rev 9388)
@@ -28,7 +28,7 @@
 		this.p1 = p1;
 		this.p2 = p2;
 	}
-	@Override
+	
 	public int hashCode() {
 		final int PRIME = 31;
 		int result = 1;
@@ -38,7 +38,7 @@
 		result = PRIME * result + ((type == null) ? 0 : type.hashCode());
 		return result;
 	}
-	@Override
+	
 	public boolean equals(Object obj) {
 		if (this == obj)
 			return true;

Modified: labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/benchmark/waltzdb/EdgeLabel.java
===================================================================
--- labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/benchmark/waltzdb/EdgeLabel.java	2007-02-07 03:20:58 UTC (rev 9387)
+++ labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/benchmark/waltzdb/EdgeLabel.java	2007-02-07 04:11:58 UTC (rev 9388)
@@ -15,7 +15,7 @@
 		this.labelName = labelName;
 		this.labelId = labelId;
 	}
-	@Override
+	
 	public int hashCode() {
 		final int PRIME = 31;
 		int result = 1;
@@ -25,7 +25,7 @@
 		result = PRIME * result + p2;
 		return result;
 	}
-	@Override
+	
 	public boolean equals(Object obj) {
 		if (this == obj)
 			return true;

Modified: labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/benchmark/waltzdb/Illegal.java
===================================================================
--- labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/benchmark/waltzdb/Illegal.java	2007-02-07 03:20:58 UTC (rev 9387)
+++ labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/benchmark/waltzdb/Illegal.java	2007-02-07 04:11:58 UTC (rev 9388)
@@ -11,7 +11,7 @@
 		this.basePoint = basePoint;
 		this.labelId = labelId;
 	}
-	@Override
+	
 	public int hashCode() {
 		final int PRIME = 31;
 		int result = 1;
@@ -19,7 +19,7 @@
 		result = PRIME * result + ((labelId == null) ? 0 : labelId.hashCode());
 		return result;
 	}
-	@Override
+	
 	public boolean equals(Object obj) {
 		if (this == obj)
 			return true;

Modified: labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/benchmark/waltzdb/Junction.java
===================================================================
--- labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/benchmark/waltzdb/Junction.java	2007-02-07 03:20:58 UTC (rev 9387)
+++ labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/benchmark/waltzdb/Junction.java	2007-02-07 04:11:58 UTC (rev 9388)
@@ -6,7 +6,7 @@
 	public Junction() {
 		super();
 	}
-	@Override
+	
 	public String toString() {
 		String result = "JUNCTION: P1=" + p1 + ",P2=" + p2 + ",P3=" + 
 		p3 + ",BasePoint=" + basePoint + ", Type=" + type +
@@ -88,7 +88,7 @@
 	public void setVisited(String visited) {
 		this.visited = visited;
 	}
-	@Override
+	
 	public int hashCode() {
 		final int PRIME = 31;
 		int result = 1;
@@ -101,7 +101,7 @@
 		result = PRIME * result + ((visited == null) ? 0 : visited.hashCode());
 		return result;
 	}
-	@Override
+	
 	public boolean equals(Object obj) {
 		if (this == obj)
 			return true;

Modified: labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/benchmark/waltzdb/Label.java
===================================================================
--- labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/benchmark/waltzdb/Label.java	2007-02-07 03:20:58 UTC (rev 9387)
+++ labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/benchmark/waltzdb/Label.java	2007-02-07 04:11:58 UTC (rev 9388)
@@ -55,7 +55,7 @@
 	public void setType(String type) {
 		this.type = type;
 	}
-	@Override
+	
 	public int hashCode() {
 		final int PRIME = 31;
 		int result = 1;
@@ -67,7 +67,7 @@
 		result = PRIME * result + ((type == null) ? 0 : type.hashCode());
 		return result;
 	}
-	@Override
+	
 	public boolean equals(Object obj) {
 		if (this == obj)
 			return true;

Modified: labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/benchmark/waltzdb/Line.java
===================================================================
--- labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/benchmark/waltzdb/Line.java	2007-02-07 03:20:58 UTC (rev 9387)
+++ labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/benchmark/waltzdb/Line.java	2007-02-07 04:11:58 UTC (rev 9388)
@@ -18,7 +18,7 @@
 	public void setP2(int p2) {
 		this.p2 = p2;
 	}
-	@Override
+	
 	public int hashCode() {
 		final int PRIME = 31;
 		int result = 1;
@@ -26,7 +26,7 @@
 		result = PRIME * result + p2;
 		return result;
 	}
-	@Override
+	
 	public boolean equals(Object obj) {
 		if (this == obj)
 			return true;

Modified: labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/benchmark/waltzdb/Stage.java
===================================================================
--- labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/benchmark/waltzdb/Stage.java	2007-02-07 03:20:58 UTC (rev 9387)
+++ labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/benchmark/waltzdb/Stage.java	2007-02-07 04:11:58 UTC (rev 9388)
@@ -24,7 +24,6 @@
 		this.value = value;
 	}
 
-	@Override
 	public int hashCode() {
 		final int PRIME = 31;
 		int result = 1;
@@ -32,7 +31,6 @@
 		return result;
 	}
 
-	@Override
 	public boolean equals(Object obj) {
 		if (this == obj)
 			return true;

Modified: labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/examples/State.java
===================================================================
--- labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/examples/State.java	2007-02-07 03:20:58 UTC (rev 9387)
+++ labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/examples/State.java	2007-02-07 04:11:58 UTC (rev 9388)
@@ -12,6 +12,10 @@
     private String                name;
     private int                   state;
 
+    public State() {
+        
+    }
+    
     public State(final String name) {
         this.name = name;
         this.state = State.NOTRUN;

Modified: labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/examples/StateExampleUsingAgendGroup.java
===================================================================
--- labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/examples/StateExampleUsingAgendGroup.java	2007-02-07 03:20:58 UTC (rev 9387)
+++ labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/examples/StateExampleUsingAgendGroup.java	2007-02-07 04:11:58 UTC (rev 9388)
@@ -27,7 +27,7 @@
 
         workingMemory.addEventListener( new DefaultAgendaEventListener() {
             public void afterActivationFired(final AfterActivationFiredEvent arg0) {
-                super.afterActivationFired( arg0 );
+                super.afterActivationFired( arg0, workingMemory );
             }
         } );
 

Modified: labs/jbossrules/trunk/drools-examples/src/main/rules/org/drools/benchmark/manners/manners.drl
===================================================================
--- labs/jbossrules/trunk/drools-examples/src/main/rules/org/drools/benchmark/manners/manners.drl	2007-02-07 03:20:58 UTC (rev 9387)
+++ labs/jbossrules/trunk/drools-examples/src/main/rules/org/drools/benchmark/manners/manners.drl	2007-02-07 04:11:58 UTC (rev 9388)
@@ -35,8 +35,8 @@
        not ( Path( id == seatingId, guestName == leftGuestName) )
        not ( Chosen( id == seatingId, guestName == leftGuestName, hobby == rightGuestHobby) )
    then
-       int rightSeat = seatingRightSeat.intValue();
-       int seatId = seatingId.intValue();
+       int rightSeat = seatingRightSeat;
+       int seatId = seatingId;
        int countValue = count.getValue();
        
        Seating seating = new Seating( countValue, seatId, false, rightSeat, seatingRightGuestName, rightSeat + 1, leftGuestName );
@@ -51,7 +51,7 @@
 	   System.err.println( "find seating : " + seating + " : " + path + " : " + chosen);
 
        count.setValue(  countValue + 1 );
-       modify( count );
+       modify( count );       
 
        context.setState( Context.MAKE_PATH );
        modify( context );
@@ -64,7 +64,7 @@
         Path( id == seatingPid, pathGuestName:guestName, pathSeat:seat )
         not Path( id == seatingId, guestName == pathGuestName )
     then
-        assert( new Path( seatingId.intValue(), pathSeat.intValue(), pathGuestName ) );
+        assert( new Path( seatingId, pathSeat, pathGuestName ) );
 end 
 
 rule pathDone

Modified: labs/jbossrules/trunk/drools-examples/src/main/rules/org/drools/benchmark/waltz/waltz.drl
===================================================================
--- labs/jbossrules/trunk/drools-examples/src/main/rules/org/drools/benchmark/waltz/waltz.drl	2007-02-07 03:20:58 UTC (rev 9387)
+++ labs/jbossrules/trunk/drools-examples/src/main/rules/org/drools/benchmark/waltz/waltz.drl	2007-02-07 04:11:58 UTC (rev 9388)
@@ -1,5 +1,5 @@
 #created on: 25/03/2006
-package org.drools.integrationtests.waltz
+package benchmarks.waltz
 
 import org.drools.benchmark.waltz.Stage
 import org.drools.benchmark.waltz.Line
@@ -16,8 +16,8 @@
 		$line : Line ( $p1:p1, $p2:p2 )
 	then 
 		System.out.println("Draw "+$p1+" "+$p2);
-		assert( new Edge ( $p1.intValue(), $p2.intValue(), false, Edge.NIL, false ) );
-		assert( new Edge ( $p2.intValue(), $p1.intValue(), false, Edge.NIL, false ) );
+		assert( new Edge ( $p1, $p2, false, Edge.NIL, false ) );
+		assert( new Edge ( $p2, $p1, false, Edge.NIL, false ) );
 		retract( $line ); 
 end
 
@@ -26,10 +26,11 @@
 rule "reversing done" salience -10
 	when
         $stage: Stage ( value == Stage.DUPLICATE )
+        not ( Line() )
 	then
         $stage.setValue ( Stage.DETECT_JUNCTIONS );
         modify($stage);
-    	System.out.println("Stage: detect junctions");
+    	System.out.println("reversing done");
 end
 
 #If three edges meet at a point and none of them have already been joined in
@@ -44,7 +45,8 @@
         $edge2: Edge( p1==$basePoint, $edge2P2:p2 != $edge1P2, joined == false )
         $edge3: Edge( p1==$basePoint, $edge3P2:p2 != $edge1P2, p2 != $edge2P2, joined == false )
 	then
-	    Junction junction = WaltzUtil.make_3_junction ( $basePoint.intValue(), $edge1P2.intValue(), $edge2P2.intValue(), $edge3P2.intValue() );
+	    Junction junction = WaltzUtil.make_3_junction( $basePoint, $edge1P2, $edge2P2, $edge3P2 );
+        System.out.println( junction );
 	    assert( junction );
 	    $edge1.setJoined(true);
 	    $edge2.setJoined(true);
@@ -63,11 +65,12 @@
         $edge2: Edge( p1==$basePoint, $edge2P2:p2 != $edge1P2, joined == false )
         not Edge( p1==$basePoint, p2 != $edge1P2, p2 != $edge2P2 )
 	then
-	    assert( new Junction($edge1P2.intValue(), $edge2P2.intValue(), 0, $basePoint.intValue(), Junction.L) );
+	    assert( new Junction($edge1P2, $edge2P2, 0, $basePoint, Junction.L) );
 	    $edge1.setJoined(true);
 	    $edge2.setJoined(true);
 	    modify( $edge1 );
 	    modify( $edge2 );
+	    System.out.println("make L");
 end
 
 #If the detect junctions flag is set, and there are no more un_joined edges,
@@ -78,17 +81,17 @@
  	then
  	    $stage.setValue( Stage.FIND_INITIAL_BOUNDARY );
  	    modify( $stage );
-    	System.out.println("Stage: find initial boundary");
+    	System.out.println("detecting done");
 end
 
 #If the initial boundary junction is an L, then we know it's labelling
 rule "initial boundary junction L"
 	when
 	    $stage : Stage ( value == Stage.FIND_INITIAL_BOUNDARY )
-	    Junction( type == Junction.L, $basePoint:basePoint, $p1:p1, $p2:p2 )
+	             Junction( type == Junction.L, $basePoint:basePoint, $p1:p1, $p2:p2 )
 	    $edge1 : Edge ( p1 == $basePoint, p2 == $p1 )
 	    $edge2 : Edge ( p1 == $basePoint, p2 == $p2 )
-        not Junction( $bp:basePoint > $basePoint )
+        not Junction( basePoint > $basePoint )
 	then
 	    $edge1.setLabel( Edge.B );
 	    $edge2.setLabel( Edge.B );
@@ -96,18 +99,18 @@
 	    modify( $edge1 );
 	    modify( $edge2 );
 	    modify( $stage );
-    	System.out.println("Stage: find second boundary");
+    	System.out.println("initial boundary junction L");
 end
 
 # Ditto for an arrow
 rule "initial boundary junction arrow"
 	when
 	    $stage : Stage ( value == Stage.FIND_INITIAL_BOUNDARY )
-	    Junction( type == Junction.ARROW, $basePoint:basePoint, $p1:p1, $p2:p2, $p3:p3 )
+	             Junction( type == Junction.ARROW, $basePoint:basePoint, $p1:p1, $p2:p2, $p3:p3 )
 	    $edge1 : Edge ( p1 == $basePoint, p2 == $p1 )
 	    $edge2 : Edge ( p1 == $basePoint, p2 == $p2 )
 	    $edge3 : Edge ( p1 == $basePoint, p2 == $p3 )
-        not Junction( $bp:basePoint > $basePoint )
+        not Junction( basePoint > $basePoint )
 	then
 	    $edge1.setLabel( Edge.B );
 	    $edge2.setLabel( Edge.PLUS );
@@ -117,7 +120,7 @@
 	    modify( $edge2 );
 	    modify( $edge3 );
 	    modify( $stage );
-    	System.out.println("Stage: find second boundary");
+    	System.out.println("initial boundary junction arrow");
 end
 
 # If we have already found the first boundary point, then find the second
@@ -128,7 +131,7 @@
 	             Junction( type == Junction.L, $basePoint:basePoint, $p1:p1, $p2:p2 )
 	    $edge1 : Edge ( p1 == $basePoint, p2 == $p1 )
 	    $edge2 : Edge ( p1 == $basePoint, p2 == $p2 )
-        not Junction( $bp:basePoint < $basePoint )
+        not Junction( basePoint < $basePoint )
 	then
 	    $edge1.setLabel( Edge.B );
 	    $edge2.setLabel( Edge.B );
@@ -136,7 +139,7 @@
 	    modify( $edge1 );
 	    modify( $edge2 );
 	    modify( $stage );
-    	System.out.println("Stage: labeling");
+    	System.out.println("second boundary junction L");
 end
 
 # Ditto for arrow
@@ -147,7 +150,7 @@
 	    $edge1 : Edge ( p1 == $basePoint, p2 == $p1 )
 	    $edge2 : Edge ( p1 == $basePoint, p2 == $p2 )
 	    $edge3 : Edge ( p1 == $basePoint, p2 == $p3 )
-        not Junction( $bp:basePoint < $basePoint )
+        not Junction( basePoint < $basePoint )
 	then
 	    $edge1.setLabel( Edge.B );
 	    $edge2.setLabel( Edge.PLUS );
@@ -157,7 +160,7 @@
 	    modify( $edge2 );
 	    modify( $edge3 );
 	    modify( $stage );
-    	System.out.println("Stage: labeling");
+    	System.out.println("second boundary junction arrow");
 end
  
 # If we have an edge whose label we already know definitely, then
@@ -165,7 +168,7 @@
 rule "match edge"
 	when
 	    Stage( value == Stage.LABELING )
-        $edge1: Edge( $p1:p1, $p2:p2, $label:label != Edge.NIL )
+        $edge1: Edge( $p1:p1, $p2:p2, $label:label == Edge.PLUS | == Edge.MINUS | == Edge.B )
         $edge2: Edge( p1 == $p2, p2 == $p1, label == Edge.NIL )
 	then
 	    $edge1.setPlotted( true );
@@ -173,7 +176,7 @@
 	    $edge2.setPlotted( true );
 	    modify( $edge1 );
 	    modify( $edge2 );
-	    System.out.println("Plot "+$label+" "+$p1+" "+$p2);
+	    System.out.println("match edge - Plot "+$label+" "+$p1+" "+$p2);
 end
 
 # The following productions propogate the possible labellings of the edges
@@ -187,228 +190,245 @@
 	when
 	    Stage( value == Stage.LABELING )
 	    Junction( type == Junction.L, $basePoint:basePoint )
-        Edge( $p1:p1, $p2:p2, $label:label -> ( $label.equals(Edge.PLUS) || $label.equals(Edge.MINUS) ) )
-        $edge: Edge( p1 == $p1, p2 != $p2, label == Edge.NIL )
+	    Edge( p1 == $basePoint, $Edge1P2 : p2, label == Edge.PLUS | == Edge.MINUS )
+        $edge: Edge( p1 == $basePoint, p2 != $Edge1P2, label == Edge.NIL )
 	then
 	    $edge.setLabel( Edge.B );
 	    modify( $edge );
+  	    System.out.println("Label L");
 end 
  
 rule "label tee A" salience 5
 	when
         Stage( value == Stage.LABELING )
-        Junction( type == Junction.TEE, $bp:basePoint, $p1:p1, $p2:p2, $p3:p3 )
-        $edge1: Edge( p1 == $bp, p2 == $p1, label == Edge.NIL )
-        $edge2: Edge( p1 == $bp, p2 == $p3 )
+        Junction( type == Junction.TEE, $basePoint:basePoint, $p1:p1, $p2:p2, $p3:p3 )
+        $edge1: Edge( p1 == $basePoint, p2 == $p1, label == Edge.NIL )
+        $edge2: Edge( p1 == $basePoint, p2 == $p3 )
 	then
 	    $edge1.setLabel( Edge.B );
 	    $edge2.setLabel( Edge.B );
 	    modify( $edge1 );
 	    modify( $edge2 );
+  	    System.out.println("Label tee A");	    
 end 
 
 
 rule "label tee B"
 	when
         Stage( value == Stage.LABELING )
-        Junction( type == Junction.TEE, $bp:basePoint, $p1:p1, $p2:p2, $p3:p3 )
-        $edge1: Edge( p1 == $bp, p2 == $p1 )
-        $edge2: Edge( p1 == $bp, p2 == $p3, label == Edge.NIL )
+        Junction( type == Junction.TEE, $basePoint:basePoint, $p1:p1, $p2:p2, $p3:p3 )
+        $edge1: Edge( p1 == $basePoint, p2 == $p1 )
+        $edge2: Edge( p1 == $basePoint, p2 == $p3, label == Edge.NIL )
 	then
 	    $edge1.setLabel( Edge.B );
 	    $edge2.setLabel( Edge.B );
 	    modify( $edge1 );
 	    modify( $edge2 );
+  	    System.out.println("Label tee B");	    	    
 end
 
 rule "label fork 1"
 	when
         Stage( value == Stage.LABELING )
-        Junction( type == Junction.FORK, $bp:basePoint )
-        Edge( p1 == $bp, $p1:p2, label == Edge.PLUS )
-        $edge1: Edge( p1 == $bp, $p2:p2 != $p1, label == Edge.NIL )
-        $edge2: Edge( p1 == $bp, $p3:p2 != $p1, p2 != $p2 )
+        Junction( type == Junction.FORK, $basePoint:basePoint )
+                Edge( p1 == $basePoint, $p1:p2, label == Edge.PLUS )
+        $edge1: Edge( p1 == $basePoint, $p2:p2 != $p1, label == Edge.NIL )
+        $edge2: Edge( p1 == $basePoint, p2 != $p1, p2 != $p2 )
 	then
 	    $edge1.setLabel( Edge.PLUS );
 	    $edge2.setLabel( Edge.PLUS );
 	    modify( $edge1 );
 	    modify( $edge2 );
+  	    System.out.println("label fork 1");	    	    
 end
 
 rule "label fork 2"
 	when
         Stage( value == Stage.LABELING )
-        Junction( type == Junction.FORK, $bp:basePoint )
-        Edge( p1 == $bp, $p1:p2, label == Edge.B )
-        Edge( p1 == $bp, $p2:p2 != $p1, label == Edge.MINUS )
-        $edge: Edge( p1 == $bp, $p3:p2 != $p1, p2 != $p2, label == Edge.NIL )
+        Junction( type == Junction.FORK, $basePoint:basePoint )
+        Edge( p1 == $basePoint, $p1:p2, label == Edge.B )
+        Edge( p1 == $basePoint, $p2:p2 != $p1, label == Edge.MINUS )
+        $edge: Edge( p1 == $basePoint, p2 != $p1, p2 != $p2, label == Edge.NIL )
 	then
 	    $edge.setLabel( Edge.B );
 	    modify( $edge );
+  	    System.out.println("label fork 2");	   	    
 end
 
 rule "label fork 3"
 	when
         Stage( value == Stage.LABELING )
-        Junction( type == Junction.FORK, $bp:basePoint )
-        Edge( p1 == $bp, $p1:p2, label == Edge.B )
-        Edge( p1 == $bp, $p2:p2 != $p1, label == Edge.B )
-        $edge: Edge( p1 == $bp, $p3:p2 != $p1, p2 != $p2, label == Edge.NIL )
+        Junction( type == Junction.FORK, $basePoint:basePoint )
+        Edge( p1 == $basePoint, $p1:p2, label == Edge.B )
+        Edge( p1 == $basePoint, $p2:p2 != $p1, label == Edge.B )
+        $edge: Edge( p1 == $basePoint, p2 != $p1, p2 != $p2, label == Edge.NIL )
 	then
 	    $edge.setLabel( Edge.MINUS );
 	    modify( $edge );
+  	    System.out.println("label fork 3");	   	    
 end
 
 rule "label fork 4"
 	when
         Stage( value == Stage.LABELING )
-        Junction( type == Junction.FORK, $bp:basePoint )
-        Edge( p1 == $bp, $p1:p2, label == Edge.MINUS )
-        Edge( p1 == $bp, $p2:p2 != $p1, label == Edge.MINUS )
-        $edge: Edge( p1 == $bp, $p3:p2 != $p1, p2 != $p2, label == Edge.NIL )
+        Junction( type == Junction.FORK, $basePoint:basePoint )
+        Edge( p1 == $basePoint, $p1:p2, label == Edge.MINUS )
+        Edge( p1 == $basePoint, $p2:p2 != $p1, label == Edge.MINUS )
+        $edge: Edge( p1 == $basePoint, p2 != $p1, p2 != $p2, label == Edge.NIL )
 	then
 	    $edge.setLabel( Edge.MINUS );
 	    modify( $edge );
+  	    System.out.println("label fork 4");	   	    
 end
  
 rule "label arrow 1A" salience 5
 	when
         Stage( value == Stage.LABELING )
-        Junction( type == Junction.ARROW, $bp:basePoint, $p1:p1, $p2:p2, $p3:p3 )
-        Edge( p1 == $bp, p2 == $p1, $label:label -> ( $label.equals(Edge.B) || $label.equals(Edge.MINUS) ) )
-        $edge1: Edge( p1 == $bp, p2 == $p2, label == Edge.NIL )
-        $edge2: Edge( p1 == $bp, p2 == $p3 )
+        Junction( type == Junction.ARROW, $basePoint:basePoint, $p1:p1, $p2:p2, $p3:p3 )
+        Edge( p1 == $basePoint, p2 == $p1, $label:label == Edge.B | == Edge.MINUS )
+        $edge1: Edge( p1 == $basePoint, p2 == $p2, label == Edge.NIL )
+        $edge2: Edge( p1 == $basePoint, p2 == $p3 )
 	then
 	    $edge1.setLabel( Edge.PLUS );
 	    $edge2.setLabel( $label );
 	    modify( $edge1 );
 	    modify( $edge2 );
+  	    System.out.println("label arrow 1A");	   	    
 end
  
 rule "label arrow 1B" 
 	when
         Stage( value == Stage.LABELING )
-        Junction( type == Junction.ARROW, $bp:basePoint, $p1:p1, $p2:p2, $p3:p3 )
-        Edge( p1 == $bp, p2 == $p1, $label:label -> ( $label.equals(Edge.B) || $label.equals(Edge.MINUS) ) )
-        $edge1: Edge( p1 == $bp, p2 == $p2 )
-        $edge2: Edge( p1 == $bp, p2 == $p3, label == Edge.NIL )
+        Junction( type == Junction.ARROW, $basePoint:basePoint, $p1:p1, $p2:p2, $p3:p3 )
+        Edge( p1 == $basePoint, p2 == $p1, $label:label == Edge.B | == Edge.MINUS )
+        $edge1: Edge( p1 == $basePoint, p2 == $p2 )
+        $edge2: Edge( p1 == $basePoint, p2 == $p3, label == Edge.NIL )
 	then
 	    $edge1.setLabel( Edge.PLUS );
 	    $edge2.setLabel( $label );
 	    modify( $edge1 );
 	    modify( $edge2 );
+  	    System.out.println("label arrow 1B");	  
 end
  
 rule "label arrow 2A" salience 5 
 	when
         Stage( value == Stage.LABELING )
-        Junction( type == Junction.ARROW, $bp:basePoint, $p1:p1, $p2:p2, $p3:p3 )
-        Edge( p1 == $bp, p2 == $p3, $label:label -> ( $label.equals(Edge.B) || $label.equals(Edge.MINUS) ) )
-        $edge1: Edge( p1 == $bp, p2 == $p2, label == Edge.NIL )
-        $edge2: Edge( p1 == $bp, p2 == $p1 )
+        Junction( type == Junction.ARROW, $basePoint:basePoint, $p1:p1, $p2:p2, $p3:p3 )
+        Edge( p1 == $basePoint, p2 == $p3, $label:label == Edge.B | == Edge.MINUS )
+        $edge1: Edge( p1 == $basePoint, p2 == $p2, label == Edge.NIL )
+        $edge2: Edge( p1 == $basePoint, p2 == $p1 )
 	then
 	    $edge1.setLabel( Edge.PLUS );
 	    $edge2.setLabel( $label );
 	    modify( $edge1 );
 	    modify( $edge2 );
+  	    System.out.println("label arrow 2A");	  	    
 end
  
 rule "label arrow 2B"
 	when
         Stage( value == Stage.LABELING )
-        Junction( type == Junction.ARROW, $bp:basePoint, $p1:p1, $p2:p2, $p3:p3 )
-        Edge( p1 == $bp, p2 == $p3, $label:label -> ( $label.equals(Edge.B) || $label.equals(Edge.MINUS) ) )
-        $edge1: Edge( p1 == $bp, p2 == $p2 )
-        $edge2: Edge( p1 == $bp, p2 == $p1, label == Edge.NIL )
+        Junction( type == Junction.ARROW, $basePoint:basePoint, $p1:p1, $p2:p2, $p3:p3 )
+        Edge( p1 == $basePoint, p2 == $p3,  $label:label == Edge.B | == Edge.MINUS  )
+        $edge1: Edge( p1 == $basePoint, p2 == $p2 )
+        $edge2: Edge( p1 == $basePoint, p2 == $p1, label == Edge.NIL )
 	then
 	    $edge1.setLabel( Edge.PLUS );
 	    $edge2.setLabel( $label );
 	    modify( $edge1 );
 	    modify( $edge2 );
+  	    System.out.println("label arrow 2B");	  	    	    
 end
  
 rule "label arrow 3A" salience 5 
 	when
         Stage( value == Stage.LABELING )
-        Junction( type == Junction.ARROW, $bp:basePoint, $p1:p1, $p2:p2, $p3:p3 )
-        Edge( p1 == $bp, p2 == $p1, label == Edge.PLUS )
-        $edge1: Edge( p1 == $bp, p2 == $p2, label == Edge.NIL )
-        $edge2: Edge( p1 == $bp, p2 == $p3 )
+        Junction( type == Junction.ARROW, $basePoint:basePoint, $p1:p1, $p2:p2, $p3:p3 )
+        Edge( p1 == $basePoint, p2 == $p1, label == Edge.PLUS )
+        $edge1: Edge( p1 == $basePoint, p2 == $p2, label == Edge.NIL )
+        $edge2: Edge( p1 == $basePoint, p2 == $p3 )
 	then
 	    $edge1.setLabel( Edge.MINUS );
 	    $edge2.setLabel( Edge.PLUS );
 	    modify( $edge1 );
 	    modify( $edge2 );
+  	    System.out.println("label arrow 3A");	  	    	    
 end
  
 rule "label arrow 3B" 
 	when
         Stage( value == Stage.LABELING )
-        Junction( type == Junction.ARROW, $bp:basePoint, $p1:p1, $p2:p2, $p3:p3 )
-        Edge( p1 == $bp, p2 == $p1, label == Edge.PLUS )
-        $edge1: Edge( p1 == $bp, p2 == $p2 )
-        $edge2: Edge( p1 == $bp, p2 == $p3, label == Edge.NIL )
+        Junction( type == Junction.ARROW, $basePoint:basePoint, $p1:p1, $p2:p2, $p3:p3 )
+        Edge( p1 == $basePoint, p2 == $p1, label == Edge.PLUS )
+        $edge1: Edge( p1 == $basePoint, p2 == $p2 )
+        $edge2: Edge( p1 == $basePoint, p2 == $p3, label == Edge.NIL )
 	then
 	    $edge1.setLabel( Edge.MINUS );
 	    $edge2.setLabel( Edge.PLUS );
 	    modify( $edge1 );
 	    modify( $edge2 );
+  	    System.out.println("label arrow 3B");	  	    	    
 end
  
 rule "label arrow 4A" salience 5 
 	when
         Stage( value == Stage.LABELING )
-        Junction( type == Junction.ARROW, $bp:basePoint, $p1:p1, $p2:p2, $p3:p3 )
-        Edge( p1 == $bp, p2 == $p3, label == Edge.PLUS )
-        $edge1: Edge( p1 == $bp, p2 == $p2, label == Edge.NIL )
-        $edge2: Edge( p1 == $bp, p2 == $p1 )
+        Junction( type == Junction.ARROW, $basePoint:basePoint, $p1:p1, $p2:p2, $p3:p3 )
+        Edge( p1 == $basePoint, p2 == $p3, label == Edge.PLUS )
+        $edge1: Edge( p1 == $basePoint, p2 == $p2, label == Edge.NIL )
+        $edge2: Edge( p1 == $basePoint, p2 == $p1 )
 	then
 	    $edge1.setLabel( Edge.MINUS );
 	    $edge2.setLabel( Edge.PLUS );
 	    modify( $edge1 );
 	    modify( $edge2 );
+  	    System.out.println("label arrow 4A");	  	    	    
 end
  
 rule "label arrow 4B" 
 	when
         Stage( value == Stage.LABELING )
-        Junction( type == Junction.ARROW, $bp:basePoint, $p1:p1, $p2:p2, $p3:p3 )
-        Edge( p1 == $bp, p2 == $p3, label == Edge.PLUS )
-        $edge1: Edge( p1 == $bp, p2 == $p2 )
-        $edge2: Edge( p1 == $bp, p2 == $p1, label == Edge.NIL )
+        Junction( type == Junction.ARROW, $basePoint:basePoint, $p1:p1, $p2:p2, $p3:p3 )
+        Edge( p1 == $basePoint, p2 == $p3, label == Edge.PLUS )
+        $edge1: Edge( p1 == $basePoint, p2 == $p2 )
+        $edge2: Edge( p1 == $basePoint, p2 == $p1, label == Edge.NIL )
 	then
 	    $edge1.setLabel( Edge.MINUS );
 	    $edge2.setLabel( Edge.PLUS );
 	    modify( $edge1 );
 	    modify( $edge2 );
+  	    System.out.println("label arrow 4B");	  	    	    
 end
  
 rule "label arrow 5A" salience 5 
 	when
         Stage( value == Stage.LABELING )
-        Junction( type == Junction.ARROW, $bp:basePoint, $p1:p1, $p2:p2, $p3:p3 )
-        Edge( p1 == $bp, p2 == $p2, label == Edge.MINUS )
-        $edge1: Edge( p1 == $bp, p2 == $p1 )
-        $edge2: Edge( p1 == $bp, p2 == $p3, label == Edge.NIL )
+        Junction( type == Junction.ARROW, $basePoint:basePoint, $p1:p1, $p2:p2, $p3:p3 )
+        Edge( p1 == $basePoint, p2 == $p2, label == Edge.MINUS )
+        $edge1: Edge( p1 == $basePoint, p2 == $p1 )
+        $edge2: Edge( p1 == $basePoint, p2 == $p3, label == Edge.NIL )
 	then
 	    $edge1.setLabel( Edge.PLUS );
 	    $edge2.setLabel( Edge.PLUS );
 	    modify( $edge1 );
 	    modify( $edge2 );
+  	    System.out.println("label arrow 5A");	  	    	    
 end
 
 rule "label arrow 5B" 
 	when
         Stage( value == Stage.LABELING )
-        Junction( type == Junction.ARROW, $bp:basePoint, $p1:p1, $p2:p2, $p3:p3 )
-        Edge( p1 == $bp, p2 == $p2, label == Edge.MINUS )
-        $edge1: Edge( p1 == $bp, p2 == $p1, label == Edge.NIL )
-        $edge2: Edge( p1 == $bp, p2 == $p3 )
+        Junction( type == Junction.ARROW, $basePoint:basePoint, $p1:p1, $p2:p2, $p3:p3 )
+        Edge( p1 == $basePoint, p2 == $p2, label == Edge.MINUS )
+        $edge1: Edge( p1 == $basePoint, p2 == $p1, label == Edge.NIL )
+        $edge2: Edge( p1 == $basePoint, p2 == $p3 )
 	then
 	    $edge1.setLabel( Edge.PLUS );
 	    $edge2.setLabel( Edge.PLUS );
 	    modify( $edge1 );
 	    modify( $edge2 );
+  	    System.out.println("label arrow 5B");	  	    	    
 end
  
 # The conflict resolution mechanism will only execute a production if no
@@ -421,7 +441,7 @@
 	then
         $stage.setValue( Stage.PLOT_REMAINING_EDGES );
         modify( $stage );
-    	System.out.println("Stage: plot remaining edges");
+    	System.out.println("done labeling");
 end
 
 # At this point, some labellings may have not been plotted, so plot them
@@ -456,5 +476,4 @@
 	    $stage.setValue( Stage.DONE );
 	    modify( $stage );
     	System.out.println("Stage: done");
-end
- 
+end
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-examples/src/main/rules/org/drools/examples/Fibonacci.drl
===================================================================
--- labs/jbossrules/trunk/drools-examples/src/main/rules/org/drools/examples/Fibonacci.drl	2007-02-07 03:20:58 UTC (rev 9387)
+++ labs/jbossrules/trunk/drools-examples/src/main/rules/org/drools/examples/Fibonacci.drl	2007-02-07 04:11:58 UTC (rev 9388)
@@ -33,8 +33,8 @@
 rule Calculate
 	when
 		f1 : Fibonacci( s1 : sequence, value != -1 )
-		f2 : Fibonacci( s2 : sequence == (new Integer( s1.intValue() + 1  ) ), value != -1 )
- 		f3 : Fibonacci( sequence == (new Integer( s2.intValue() + 1 ) ), value == -1 )				
+		f2 : Fibonacci( s2 : sequence == (s1 + 1 ), value != -1 )
+ 		f3 : Fibonacci( sequence == (s2 + 1 ), value == -1 )				
 	then	
 		f3.setValue( f1.getValue() + f2.getValue() );
 		modify( f3 );

Modified: labs/jbossrules/trunk/drools-examples/src/main/rules/org/drools/examples/golf.drl
===================================================================
--- labs/jbossrules/trunk/drools-examples/src/main/rules/org/drools/examples/golf.drl	2007-02-07 03:20:58 UTC (rev 9387)
+++ labs/jbossrules/trunk/drools-examples/src/main/rules/org/drools/examples/golf.drl	2007-02-07 04:11:58 UTC (rev 9388)
@@ -13,7 +13,7 @@
   		// The golfer to Fred's immediate right
   		// is wearing blue pants
         Golfer( $unknownsName : name != "Fred", 
-                $unknownsPosition :  position == ( new Integer( $fredsPosition.intValue() + 1 ) ),
+                $unknownsPosition :  position == ( $fredsPosition + 1 ),
                 $unknownsColor : color == "blue",
                 color != $fredsColor )
 




More information about the jboss-svn-commits mailing list