[jboss-svn-commits] JBL Code SVN: r16837 - labs/jbossrules/contrib/benchmarks/src/rules/benchmarks/dispatch.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Nov 26 13:13:25 EST 2007


Author: shabino
Date: 2007-11-26 13:13:25 -0500 (Mon, 26 Nov 2007)
New Revision: 16837

Modified:
   labs/jbossrules/contrib/benchmarks/src/rules/benchmarks/dispatch/Scoring.dslr
Log:
Split excessive distance to job score rule to avoid "if" in consequence

Modified: labs/jbossrules/contrib/benchmarks/src/rules/benchmarks/dispatch/Scoring.dslr
===================================================================
--- labs/jbossrules/contrib/benchmarks/src/rules/benchmarks/dispatch/Scoring.dslr	2007-11-26 18:12:51 UTC (rev 16836)
+++ labs/jbossrules/contrib/benchmarks/src/rules/benchmarks/dispatch/Scoring.dslr	2007-11-26 18:13:25 UTC (rev 16837)
@@ -22,24 +22,35 @@
 
 expander dispatch.dsl
 
-rule "Distance to Job Score"
+rule "Distance to Job Score - Extra Large"
 	when
 		j: Job()
 		job dispatchable
-		w: Worker()
+		w: Worker(vehicleSize == VehicleSize.EXTRA_LARGE)
 		i: DecimalInfo(workerId == w.workerId, jobId == j.jobId,
 			type == Info.Type.DISTANCE_TO_JOB_MILES, dist: value >= 100)
 	then 
 		ScoreComponent sc = new ScoreComponent(j, w);
 		sc.setType(ScoreComponent.Type.EXCESSIVE_DISTANCE_TO_JOB);
-		if (w.getVehicleSize() == VehicleSize.EXTRA_LARGE){
-			sc.setContribution(- 0.55 * (dist - 100));
-		} else {
-			sc.setContribution(- 0.4 * (dist - 100));
-		}
+		sc.setContribution(- 0.55 * (dist - 100));
 		insertLogical(sc);
 end
 
+
+rule "Distance to Job Score - Regular"
+	when
+		j: Job()
+		job dispatchable
+		w: Worker(vehicleSize <> VehicleSize.EXTRA_LARGE)
+		i: DecimalInfo(workerId == w.workerId, jobId == j.jobId,
+			type == Info.Type.DISTANCE_TO_JOB_MILES, dist: value >= 100)
+	then 
+		ScoreComponent sc = new ScoreComponent(j, w);
+		sc.setType(ScoreComponent.Type.EXCESSIVE_DISTANCE_TO_JOB);
+		sc.setContribution(- 0.4 * (dist - 100));
+		insertLogical(sc);
+end
+
 rule "Late to Job Score"
 	when
 		j : Job 




More information about the jboss-svn-commits mailing list