[jboss-svn-commits] JBL Code SVN: r16764 - in labs/jbossrules/contrib/benchmarks/src/java/benchmarks: dispatch and 6 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Nov 23 13:38:46 EST 2007


Author: shabino
Date: 2007-11-23 13:38:45 -0500 (Fri, 23 Nov 2007)
New Revision: 16764

Added:
   labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/
   labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/DispatchBenchmark.java
   labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/accumulator/
   labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/accumulator/TopWorkerAccumulator.java
   labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/
   labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/
   labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/Compatibility.java
   labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/DateWorkerInfo.java
   labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/DecimalInfo.java
   labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/Exclusion.java
   labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/Info.java
   labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/JobExclusion.java
   labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/PositionWorkerInfo.java
   labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/Score.java
   labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/ScoreComponent.java
   labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/TopWorkers.java
   labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/WorkerInfo.java
   labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/independent/
   labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/independent/DispatchState.java
   labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/independent/Job.java
   labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/independent/VehicleSize.java
   labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/independent/Worker.java
   labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/independent/WorkerPosition.java
   labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/function/
   labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/function/Helper.java
   labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/simulation/
   labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/simulation/JobGenerator.java
   labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/simulation/WorkerGenerator.java
Log:
initial commit of dispatch benchmark

Added: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/DispatchBenchmark.java
===================================================================
--- labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/DispatchBenchmark.java	                        (rev 0)
+++ labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/DispatchBenchmark.java	2007-11-23 18:38:45 UTC (rev 16764)
@@ -0,0 +1,133 @@
+package benchmarks.dispatch;
+
+/*
+ * Copyright 2007 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.io.InputStreamReader;
+import java.io.Reader;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.drools.FactHandle;
+import org.drools.RuleBase;
+import org.drools.RuleBaseConfiguration;
+import org.drools.RuleBaseFactory;
+import org.drools.WorkingMemory;
+import org.drools.compiler.DrlParser;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.lang.descr.PackageDescr;
+
+import benchmarks.dispatch.fact.independent.DispatchState;
+import benchmarks.dispatch.fact.independent.Worker;
+import benchmarks.dispatch.fact.independent.WorkerPosition;
+import benchmarks.dispatch.simulation.JobGenerator;
+import benchmarks.dispatch.simulation.WorkerGenerator;
+
+public class DispatchBenchmark {
+
+	private static final Set<String> rules = new HashSet<String>();
+
+	static {
+		rules.add("/benchmarks/dispatch/Derivations.dslr");
+		rules.add("/benchmarks/dispatch/EligibilityExclusions.dslr");
+		rules.add("/benchmarks/dispatch/LogicalTopTier.dslr");
+		rules.add("/benchmarks/dispatch/Queries.drl");
+		rules.add("/benchmarks/dispatch/Scoring.dslr");
+		rules.add("/benchmarks/dispatch/ScoreManagement.dslr");
+		rules.add("/benchmarks/dispatch/WorkerEligibility.dslr");
+	}
+
+	private WorkingMemory wm;
+
+	private void createWM() throws Exception {
+
+		RuleBaseConfiguration conf = new RuleBaseConfiguration();
+
+		conf.setAssertBehaviour(RuleBaseConfiguration.AssertBehaviour.EQUALITY);
+		conf.setRemoveIdentities(true);
+		conf.setLogicalOverride(RuleBaseConfiguration.LogicalOverride.DISCARD);
+		conf.setMaintainTms(true);
+		conf.setShadowProxy(true);
+
+		RuleBase ruleBase = RuleBaseFactory.newRuleBase(conf);
+
+		PackageBuilderConfiguration pbc = new PackageBuilderConfiguration();
+
+		pbc
+				.addAccumulateFunction("top_workers",
+						"benchmarks.dispatch.accumulator.TopWorkerAccumulator");
+
+		PackageBuilder builder = new PackageBuilder(pbc);
+
+		for (String ruleFile : rules) {
+			DrlParser parser = new DrlParser();
+			PackageDescr desc = parser.parse(getReader(ruleFile),
+					getReader("/benchmarks/dispatch/dispatch.dsl"));
+			builder.addPackage(desc);
+		}
+
+		ruleBase.addPackage(builder.getPackage());
+
+		wm = ruleBase.newStatefulSession();
+	}
+
+	private Reader getReader(String resourceName) {
+		return new InputStreamReader(getClass().getResourceAsStream(
+				resourceName));
+	}
+
+	public void go(int numWorkers, int numJobs) throws Exception {
+		createWM();
+		
+		DispatchState ds = new DispatchState();
+		ds.setCurrentTime(new Date());
+		FactHandle dsfh = wm.insert(ds);
+
+		WorkerGenerator wg = new WorkerGenerator(100);
+
+		for (int i = 0; i < numWorkers; i++) {
+			Worker w = wg.generateWorker();
+			wm.insert(w);
+			WorkerPosition wp = wg.generateWorkerPosition(w);
+			wm.insert(wp);
+		}
+
+		JobGenerator jg = new JobGenerator(100);
+
+		for (int i = 0; i < numJobs; i++) {
+			wm.insert(jg.generateJob());
+		}
+
+		wm.fireAllRules();
+	}
+
+	public static void main(String args[]) throws Exception {
+		int numWorkers = 1;
+		int numJobs = 1;
+		
+		
+		if (args.length == 2){
+			numWorkers = new Integer(args[0]);
+			numJobs = new Integer(args[1]);
+		}
+		
+		DispatchBenchmark db = new DispatchBenchmark();
+		db.go(numWorkers, numJobs);
+	}
+
+}


Property changes on: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/DispatchBenchmark.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/accumulator/TopWorkerAccumulator.java
===================================================================
--- labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/accumulator/TopWorkerAccumulator.java	                        (rev 0)
+++ labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/accumulator/TopWorkerAccumulator.java	2007-11-23 18:38:45 UTC (rev 16764)
@@ -0,0 +1,70 @@
+package benchmarks.dispatch.accumulator;
+
+/*
+ * Copyright 2007 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.Comparator;
+import java.util.TreeSet;
+
+import org.drools.base.accumulators.AccumulateFunction;
+
+import benchmarks.dispatch.fact.derived.Score;
+
+
+ at SuppressWarnings("unchecked")
+public class TopWorkerAccumulator implements AccumulateFunction {
+
+    private static final long serialVersionUID = 1L;
+
+    public void accumulate(Object context, Object value) {
+	    TreeSet<Score> ts = (TreeSet<Score>)context;
+		ts.add( (Score)value);	
+	}
+	
+	public void reverse(Object context, Object value) throws Exception {
+	    TreeSet<Score> ts = (TreeSet<Score>)context;
+	    ts.remove( value );	
+	}
+
+	public Object createContext() {
+		return new TreeSet<Score>(new ScoreComparator());
+	}
+
+	public Object getResult(Object context) throws Exception {
+		return context;
+	}
+
+	public void init(Object context) throws Exception {
+	    TreeSet<Score> ts = (TreeSet<Score>)context;
+		ts.clear();
+	}
+
+	public boolean supportsReverse() {
+		return true;
+	}
+
+	private class ScoreComparator implements Comparator<Score> {
+
+		public int compare(Score o1, Score o2) {
+			if (o1.getScore() < o2.getScore()){
+				return -1;
+			} else {
+				return 1;
+			}
+		}	
+	}
+	
+}


Property changes on: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/accumulator/TopWorkerAccumulator.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/Compatibility.java
===================================================================
--- labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/Compatibility.java	                        (rev 0)
+++ labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/Compatibility.java	2007-11-23 18:38:45 UTC (rev 16764)
@@ -0,0 +1,78 @@
+package benchmarks.dispatch.fact.derived;
+
+/*
+ * Copyright 2007 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.io.Serializable;
+
+import benchmarks.dispatch.fact.independent.Job;
+import benchmarks.dispatch.fact.independent.Worker;
+
+public class Compatibility
+    implements
+    Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private String            workerId, jobId;
+
+    public Compatibility(Job job,
+                         Worker worker) {
+        this.jobId = job.getJobId();
+        this.workerId = worker.getWorkerId();
+    }
+    
+    public String getWorkerId() {
+        return workerId;
+    }
+
+    public void setWorkerId(String workerId) {
+        this.workerId = workerId;
+    }
+
+    public String getJobId() {
+        return jobId;
+    }
+
+    public void setJobId(String jobId) {
+        this.jobId = jobId;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((jobId == null) ? 0 : jobId.hashCode());
+        result = prime * result + ((workerId == null) ? 0 : workerId.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if ( this == obj ) return true;
+        if ( obj == null ) return false;
+        if ( getClass() != obj.getClass() ) return false;
+        final Compatibility other = (Compatibility) obj;
+        if ( jobId == null ) {
+            if ( other.jobId != null ) return false;
+        } else if ( !jobId.equals( other.jobId ) ) return false;
+        if ( workerId == null ) {
+            if ( other.workerId != null ) return false;
+        } else if ( !workerId.equals( other.workerId ) ) return false;
+        return true;
+    }
+
+}


Property changes on: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/Compatibility.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/DateWorkerInfo.java
===================================================================
--- labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/DateWorkerInfo.java	                        (rev 0)
+++ labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/DateWorkerInfo.java	2007-11-23 18:38:45 UTC (rev 16764)
@@ -0,0 +1,39 @@
+package benchmarks.dispatch.fact.derived;
+
+/*
+ * Copyright 2007 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.Date;
+
+public class DateWorkerInfo extends WorkerInfo {
+
+	private static final long serialVersionUID = 1L;
+	
+	private Date value;
+	
+	public Date getValue() {
+		return value;
+	}
+
+	public void setValue(Date value) {
+		this.value = value;
+	}
+
+	public DateWorkerInfo(String workerId) {
+		super(workerId);
+	}
+
+}


Property changes on: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/DateWorkerInfo.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/DecimalInfo.java
===================================================================
--- labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/DecimalInfo.java	                        (rev 0)
+++ labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/DecimalInfo.java	2007-11-23 18:38:45 UTC (rev 16764)
@@ -0,0 +1,40 @@
+package benchmarks.dispatch.fact.derived;
+
+/*
+ * Copyright 2007 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 benchmarks.dispatch.fact.independent.Job;
+import benchmarks.dispatch.fact.independent.Worker;
+
+public class DecimalInfo extends Info {
+	
+	private static final long serialVersionUID = 1L;
+	
+	public DecimalInfo(Job job, Worker worker) {
+		super(job, worker);
+	}
+
+	private Double value;
+
+	public Double getValue() {
+		return value;
+	}
+
+	public void setValue(Double value) {
+		this.value = value;
+	}
+
+}


Property changes on: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/DecimalInfo.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/Exclusion.java
===================================================================
--- labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/Exclusion.java	                        (rev 0)
+++ labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/Exclusion.java	2007-11-23 18:38:45 UTC (rev 16764)
@@ -0,0 +1,66 @@
+package benchmarks.dispatch.fact.derived;
+
+/*
+ * Copyright 2007 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 benchmarks.dispatch.fact.independent.Job;
+import benchmarks.dispatch.fact.independent.Worker;
+
+public class Exclusion extends Compatibility {
+
+    private static final long serialVersionUID = 1L;
+
+    public enum Type {
+        VEHICLE_SIZE, WRENCH_REQUIRED, NUM_STICKS, NUM_ROCKS
+    }
+
+    private Type type;
+
+    public Exclusion(Job job,
+                     Worker worker) {
+        super( job,
+               worker );
+    }
+
+    public Type getType() {
+        return type;
+    }
+
+    public void setType(Type type) {
+        this.type = type;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((type == null) ? 0 : type.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if ( this == obj ) return true;
+        if ( !super.equals( obj ) ) return false;
+        if ( getClass() != obj.getClass() ) return false;
+        final Exclusion other = (Exclusion) obj;
+        if ( type == null ) {
+            if ( other.type != null ) return false;
+        } else if ( !type.equals( other.type ) ) return false;
+        return true;
+    }
+
+}


Property changes on: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/Exclusion.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/Info.java
===================================================================
--- labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/Info.java	                        (rev 0)
+++ labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/Info.java	2007-11-23 18:38:45 UTC (rev 16764)
@@ -0,0 +1,73 @@
+package benchmarks.dispatch.fact.derived;
+
+/*
+ * Copyright 2007 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 benchmarks.dispatch.fact.independent.Job;
+import benchmarks.dispatch.fact.independent.Worker;
+
+public class Info extends Compatibility {
+
+	private static final long serialVersionUID = 1L;
+	
+	public enum Type {
+
+		WORKER_POSITION_AGE_MINUTES,
+		DISTANCE_TO_JOB_MILES,
+		TIME_TO_JOB_MINUTES,
+		MINUTES_LATE_TO_JOB;
+	}
+	
+	private Type type;
+	
+	public Info(Job job, Worker worker) {
+		super(job, worker);
+	}
+
+	public Type getType() {
+		return type;
+	}
+
+	public void setType(Type type) {
+		this.type = type;
+	}
+
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = super.hashCode();
+		result = prime * result + ((type == null) ? 0 : type.hashCode());
+		return result;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (!super.equals(obj))
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		final Info other = (Info) obj;
+		if (type == null) {
+			if (other.type != null)
+				return false;
+		} else if (!type.equals(other.type))
+			return false;
+		return true;
+	}
+
+}


Property changes on: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/Info.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/JobExclusion.java
===================================================================
--- labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/JobExclusion.java	                        (rev 0)
+++ labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/JobExclusion.java	2007-11-23 18:38:45 UTC (rev 16764)
@@ -0,0 +1,57 @@
+package benchmarks.dispatch.fact.derived;
+
+/*
+ * Copyright 2007 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.io.Serializable;
+
+public class JobExclusion
+    implements
+    Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private String            jobId;
+
+    public String getJobId() {
+        return jobId;
+    }
+
+    public void setJobId(String jobId) {
+        this.jobId = jobId;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((jobId == null) ? 0 : jobId.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if ( this == obj ) return true;
+        if ( obj == null ) return false;
+        if ( getClass() != obj.getClass() ) return false;
+        final JobExclusion other = (JobExclusion) obj;
+        if ( jobId == null ) {
+            if ( other.jobId != null ) return false;
+        } else if ( !jobId.equals( other.jobId ) ) return false;
+        return true;
+    }
+
+}


Property changes on: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/JobExclusion.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/PositionWorkerInfo.java
===================================================================
--- labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/PositionWorkerInfo.java	                        (rev 0)
+++ labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/PositionWorkerInfo.java	2007-11-23 18:38:45 UTC (rev 16764)
@@ -0,0 +1,45 @@
+package benchmarks.dispatch.fact.derived;
+
+/*
+ * Copyright 2007 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.
+ */
+
+public class PositionWorkerInfo extends WorkerInfo {
+
+    private static final long serialVersionUID = 1L;
+
+    private Double            latitude, longitude;
+
+    public PositionWorkerInfo(String workerId) {
+        super( workerId );
+    }
+
+    public Double getLatitude() {
+        return latitude;
+    }
+
+    public void setLatitude(Double latitude) {
+        this.latitude = latitude;
+    }
+
+    public Double getLongitude() {
+        return longitude;
+    }
+
+    public void setLongitude(Double longitude) {
+        this.longitude = longitude;
+    }
+
+}


Property changes on: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/PositionWorkerInfo.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/Score.java
===================================================================
--- labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/Score.java	                        (rev 0)
+++ labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/Score.java	2007-11-23 18:38:45 UTC (rev 16764)
@@ -0,0 +1,40 @@
+package benchmarks.dispatch.fact.derived;
+
+/*
+ * Copyright 2007 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 benchmarks.dispatch.fact.independent.Job;
+import benchmarks.dispatch.fact.independent.Worker;
+
+public class Score extends Compatibility {
+
+	private static final long serialVersionUID = 1L;
+	
+	private double score;
+	
+	public Score(Job job, Worker worker) {
+		super(job, worker);
+	}
+
+	public double getScore() {
+		return score;
+	}
+
+	public void setScore(double score) {
+		this.score = score;
+	}
+
+}


Property changes on: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/Score.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/ScoreComponent.java
===================================================================
--- labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/ScoreComponent.java	                        (rev 0)
+++ labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/ScoreComponent.java	2007-11-23 18:38:45 UTC (rev 16764)
@@ -0,0 +1,75 @@
+package benchmarks.dispatch.fact.derived;
+
+/*
+ * Copyright 2007 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 benchmarks.dispatch.fact.independent.Job;
+import benchmarks.dispatch.fact.independent.Worker;
+
+public class ScoreComponent extends Compatibility {
+
+    private static final long serialVersionUID = 1L;
+
+    public enum Type {
+        LATE_TO_JOB, EXCESSIVE_DISTANCE_TO_JOB, DEFAULT
+    }
+
+    private Double contribution;
+    private Type   type;
+
+    public ScoreComponent(Job job,
+                          Worker worker) {
+        super( job,
+               worker );
+    }
+
+    public void setContribution(Double scoreContribution) {
+        this.contribution = scoreContribution;
+    }
+
+    public Double getContribution() {
+        return contribution;
+    }
+
+    public Type getType() {
+        return type;
+    }
+
+    public void setType(Type type) {
+        this.type = type;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((type == null) ? 0 : type.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if ( this == obj ) return true;
+        if ( !super.equals( obj ) ) return false;
+        if ( getClass() != obj.getClass() ) return false;
+        final ScoreComponent other = (ScoreComponent) obj;
+        if ( type == null ) {
+            if ( other.type != null ) return false;
+        } else if ( !type.equals( other.type ) ) return false;
+        return true;
+    }
+
+}


Property changes on: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/ScoreComponent.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/TopWorkers.java
===================================================================
--- labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/TopWorkers.java	                        (rev 0)
+++ labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/TopWorkers.java	2007-11-23 18:38:45 UTC (rev 16764)
@@ -0,0 +1,80 @@
+package benchmarks.dispatch.fact.derived;
+
+/*
+ * Copyright 2007 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.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/*
+ * Copyright 2007 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.
+ */
+
+public class TopWorkers
+    implements
+    Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private String            jobId;
+    private List<String>      workerScores    = new ArrayList<String>();
+
+    public List<String> getTopWorkers() {
+        return workerScores;
+    }
+
+    public String getJobId() {
+        return jobId;
+    }
+
+    public void setJobId(String jobId) {
+        this.jobId = jobId;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((jobId == null) ? 0 : jobId.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if ( this == obj ) return true;
+        if ( obj == null ) return false;
+        if ( getClass() != obj.getClass() ) return false;
+        final TopWorkers other = (TopWorkers) obj;
+        if ( jobId == null ) {
+            if ( other.jobId != null ) return false;
+        } else if ( !jobId.equals( other.jobId ) ) return false;
+        return true;
+    }
+
+}
\ No newline at end of file


Property changes on: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/TopWorkers.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/WorkerInfo.java
===================================================================
--- labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/WorkerInfo.java	                        (rev 0)
+++ labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/WorkerInfo.java	2007-11-23 18:38:45 UTC (rev 16764)
@@ -0,0 +1,78 @@
+package benchmarks.dispatch.fact.derived;
+
+/*
+ * Copyright 2007 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.io.Serializable;
+
+public class WorkerInfo
+    implements
+    Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private String            workerId;
+    private Type              type;
+
+    public enum Type {
+        TIME_AVAILABLE_FOR_DISPATCH, POSITION_AVAILABLE_FOR_DISPATCH
+    }
+
+    public WorkerInfo(String workerId) {
+        this.workerId = workerId;
+    }
+
+    public String getWorkerId() {
+        return workerId;
+    }
+
+    public void setWorkerId(String workerId) {
+        this.workerId = workerId;
+    }
+
+    public Type getType() {
+        return type;
+    }
+
+    public void setType(Type type) {
+        this.type = type;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((type == null) ? 0 : type.hashCode());
+        result = prime * result + ((workerId == null) ? 0 : workerId.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if ( this == obj ) return true;
+        if ( obj == null ) return false;
+        if ( getClass() != obj.getClass() ) return false;
+        final WorkerInfo other = (WorkerInfo) obj;
+        if ( type == null ) {
+            if ( other.type != null ) return false;
+        } else if ( !type.equals( other.type ) ) return false;
+        if ( workerId == null ) {
+            if ( other.workerId != null ) return false;
+        } else if ( !workerId.equals( other.workerId ) ) return false;
+        return true;
+    }
+
+}


Property changes on: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/derived/WorkerInfo.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/independent/DispatchState.java
===================================================================
--- labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/independent/DispatchState.java	                        (rev 0)
+++ labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/independent/DispatchState.java	2007-11-23 18:38:45 UTC (rev 16764)
@@ -0,0 +1,52 @@
+package benchmarks.dispatch.fact.independent;
+
+/*
+ * Copyright 2007 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.Date;
+
+public class DispatchState {
+    private Date currentTime;
+    private Date cutoff;
+    private Date positionCutOff;
+
+    public DispatchState() {
+
+    }
+
+    public Date getCurrentTime() {
+        return currentTime;
+    }
+
+    public void setCurrentTime(Date currentTime) {
+        this.currentTime = currentTime;
+        
+        //3 days
+        cutoff = new Date( currentTime.getTime() + 1000 * 60 * 60 * 24 * 3 );
+
+        // 2 hours
+        positionCutOff = new Date( currentTime.getTime() - 1000 * 60 * 60 * 2 );
+    }
+
+    public Date getStartTimeCutOff() {
+        return cutoff;
+    }
+
+    public Date getPositionCutOff() {
+        return positionCutOff;
+    }
+    
+}


Property changes on: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/independent/DispatchState.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/independent/Job.java
===================================================================
--- labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/independent/Job.java	                        (rev 0)
+++ labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/independent/Job.java	2007-11-23 18:38:45 UTC (rev 16764)
@@ -0,0 +1,136 @@
+package benchmarks.dispatch.fact.independent;
+
+import java.util.Date;
+
+/*
+ * Copyright 2007 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.
+ */
+
+public class Job {
+
+    public enum Status {
+        PENDING, DISPATCHED
+    }
+
+    private String      jobId;
+    private Status      status;
+    private Date        startTime, endTime;
+    private Double      latitude, longitude;
+    private VehicleSize vehicleSizeRequired;
+    private Boolean     wrenchRequired;
+    private Integer     numberOfSticksRequired;
+    private Integer     numberOfRocksRequired;
+
+    public String getJobId() {
+        return jobId;
+    }
+
+    public void setJobId(String jobId) {
+        this.jobId = jobId;
+    }
+
+    public Boolean getWrenchRequired() {
+        return wrenchRequired;
+    }
+
+    public void setWrenchRequired(Boolean wrenchRequired) {
+        this.wrenchRequired = wrenchRequired;
+    }
+
+    public Integer getNumberOfSticksRequired() {
+        return numberOfSticksRequired;
+    }
+
+    public void setNumberOfSticksRequired(Integer numberOfSticksRequired) {
+        this.numberOfSticksRequired = numberOfSticksRequired;
+    }
+
+    public Integer getNumberOfRocksRequired() {
+        return numberOfRocksRequired;
+    }
+
+    public void setNumberOfRocksRequired(Integer numberOfRocksRequired) {
+        this.numberOfRocksRequired = numberOfRocksRequired;
+    }
+
+    public Double getLatitude() {
+        return latitude;
+    }
+
+    public void setLatitude(Double latitude) {
+        this.latitude = latitude;
+    }
+
+    public Double getLongitude() {
+        return longitude;
+    }
+
+    public void setLongitude(Double longitude) {
+        this.longitude = longitude;
+    }
+
+    public VehicleSize getVehicleSizeRequired() {
+        return vehicleSizeRequired;
+    }
+
+    public void setVehicleSizeRequired(VehicleSize vehicleSizeRequired) {
+        this.vehicleSizeRequired = vehicleSizeRequired;
+    }
+
+    public Status getStatus() {
+        return status;
+    }
+
+    public void setStatus(Status status) {
+        this.status = status;
+    }
+
+    public Date getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(Date startTime) {
+        this.startTime = startTime;
+    }
+
+    public Date getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(Date endTime) {
+        this.endTime = endTime;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((jobId == null) ? 0 : jobId.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if ( this == obj ) return true;
+        if ( obj == null ) return false;
+        if ( getClass() != obj.getClass() ) return false;
+        final Job other = (Job) obj;
+        if ( jobId == null ) {
+            if ( other.jobId != null ) return false;
+        } else if ( !jobId.equals( other.jobId ) ) return false;
+        return true;
+    }
+
+}


Property changes on: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/independent/Job.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/independent/VehicleSize.java
===================================================================
--- labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/independent/VehicleSize.java	                        (rev 0)
+++ labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/independent/VehicleSize.java	2007-11-23 18:38:45 UTC (rev 16764)
@@ -0,0 +1,15 @@
+package benchmarks.dispatch.fact.independent;
+
+public enum VehicleSize {
+    SMALL(1), MEDIUM(2), LARGE(3), EXTRA_LARGE(4);
+    
+    private int sizeNumber;
+    
+    VehicleSize(int sizeNumber){
+        this.sizeNumber = sizeNumber;
+    }
+    
+    public int getSizeNumber(){
+        return sizeNumber;
+    }
+}


Property changes on: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/independent/VehicleSize.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/independent/Worker.java
===================================================================
--- labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/independent/Worker.java	                        (rev 0)
+++ labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/independent/Worker.java	2007-11-23 18:38:45 UTC (rev 16764)
@@ -0,0 +1,127 @@
+package benchmarks.dispatch.fact.independent;
+
+import java.util.Date;
+
+/*
+ * Copyright 2007 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.
+ */
+
+public class Worker {
+
+    public enum Status {
+        WAITING_FOR_JOB, DISPATCHED_FOR_JOB, OUT_OF_SERVICE, INACTIVE
+    }
+
+    private String      workerId;
+    private Status      status;
+    private Date        timeAvailable;
+    private Double      currentJobLatitude, currentJobLongitude;
+    private VehicleSize vehicleSize;
+    private Boolean     hasWrench;
+    private Integer     numberOfSticks, numberOfRocks;
+
+    public Status getStatus() {
+        return status;
+    }
+
+    public void setStatus(Status status) {
+        this.status = status;
+    }
+
+    public String getWorkerId() {
+        return workerId;
+    }
+
+    public void setWorkerId(String workerId) {
+        this.workerId = workerId;
+    }
+
+    public Date getTimeAvailable() {
+        return timeAvailable;
+    }
+
+    public void setTimeAvailable(Date timeAvailable) {
+        this.timeAvailable = timeAvailable;
+    }
+
+    public Double getCurrentJobLatitude() {
+        return currentJobLatitude;
+    }
+
+    public void setCurrentJobLatitude(Double currentJobLatitude) {
+        this.currentJobLatitude = currentJobLatitude;
+    }
+
+    public Double getCurrentJobLongitude() {
+        return currentJobLongitude;
+    }
+
+    public void setCurrentJobLongitude(Double currentJobLongitude) {
+        this.currentJobLongitude = currentJobLongitude;
+    }
+
+    public Boolean getHasWrench() {
+        return hasWrench;
+    }
+
+    public void setHasWrench(Boolean hasWrench) {
+        this.hasWrench = hasWrench;
+    }
+
+    public Integer getNumberOfSticks() {
+        return numberOfSticks;
+    }
+
+    public void setNumberOfSticks(Integer numberOfSticks) {
+        this.numberOfSticks = numberOfSticks;
+    }
+
+    public Integer getNumberOfRocks() {
+        return numberOfRocks;
+    }
+
+    public void setNumberOfRocks(Integer numberOfRocks) {
+        this.numberOfRocks = numberOfRocks;
+    }
+
+    public VehicleSize getVehicleSize() {
+        return vehicleSize;
+    }
+
+    public void setVehicleSize(VehicleSize vehicleSize) {
+        this.vehicleSize = vehicleSize;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((workerId == null) ? 0 : workerId.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if ( this == obj ) return true;
+        if ( obj == null ) return false;
+        if ( getClass() != obj.getClass() ) return false;
+        final Worker other = (Worker) obj;
+        if ( workerId == null ) {
+            if ( other.workerId != null ) return false;
+        } else if ( !workerId.equals( other.workerId ) ) return false;
+        return true;
+    }
+
+}


Property changes on: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/independent/Worker.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/independent/WorkerPosition.java
===================================================================
--- labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/independent/WorkerPosition.java	                        (rev 0)
+++ labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/independent/WorkerPosition.java	2007-11-23 18:38:45 UTC (rev 16764)
@@ -0,0 +1,84 @@
+package benchmarks.dispatch.fact.independent;
+
+import java.util.Date;
+
+/*
+ * Copyright 2007 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.
+ */
+
+public class WorkerPosition {
+    private String workerId;
+    private Double latitude, longitude;
+    private Date positionObservationDate;
+
+    public WorkerPosition() {
+
+    }
+
+    public String getWorkerId() {
+        return workerId;
+    }
+
+    public void setWorkerId(String workerId) {
+        this.workerId = workerId;
+    }
+
+    public Double getLatitude() {
+        return latitude;
+    }
+
+    public void setLatitude(Double latitude) {
+        this.latitude = latitude;
+    }
+
+    public Double getLongitude() {
+        return longitude;
+    }
+
+    public void setLongitude(Double longitude) {
+        this.longitude = longitude;
+    }
+    
+    public Date getPositionObservationDate() {
+        return positionObservationDate;
+    }
+
+    public void setPositionObservationDate(Date positionObservationDate) {
+        this.positionObservationDate = positionObservationDate;
+    }
+
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((workerId == null) ? 0 : workerId.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if ( this == obj ) return true;
+        if ( obj == null ) return false;
+        if ( getClass() != obj.getClass() ) return false;
+        final WorkerPosition other = (WorkerPosition) obj;
+        if ( workerId == null ) {
+            if ( other.workerId != null ) return false;
+        } else if ( !workerId.equals( other.workerId ) ) return false;
+        return true;
+    }
+
+
+}


Property changes on: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/fact/independent/WorkerPosition.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/function/Helper.java
===================================================================
--- labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/function/Helper.java	                        (rev 0)
+++ labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/function/Helper.java	2007-11-23 18:38:45 UTC (rev 16764)
@@ -0,0 +1,52 @@
+package benchmarks.dispatch.function;
+
+/*
+ * Copyright 2007 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.Date;
+
+import benchmarks.dispatch.fact.independent.Job;
+
+public class Helper {
+
+    public static Double distanceToPickupInMiles(Job job,
+                                                 Double workerLatitude,
+                                                 Double workerLongitude) {
+
+        Double jobLatitude = job.getLatitude();
+        Double jobLongitude = job.getLongitude();
+
+        jobLatitude = Math.toRadians( jobLatitude );
+        workerLatitude = Math.toRadians( workerLatitude );
+        jobLongitude = Math.toRadians( jobLongitude );
+        workerLongitude = Math.toRadians( workerLongitude );
+
+        double angle = Math.acos( Math.sin( jobLatitude ) * Math.sin( workerLatitude ) + Math.cos( jobLatitude ) * Math.cos( workerLatitude ) * Math.cos( jobLongitude - workerLongitude ) );
+
+        return Math.toDegrees( angle ) * 69.1105; //miles per degree
+    }
+
+    public static Double minutesLateToJob(Date jobStartTime,
+                                          Date workerAvailableTime,
+                                          Double minutesToJob) {
+        return 1D;
+    }
+
+    public static Double minutesBetweenDates(Date start,
+                                             Date end) {
+        return 0D;
+    }
+}


Property changes on: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/function/Helper.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/simulation/JobGenerator.java
===================================================================
--- labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/simulation/JobGenerator.java	                        (rev 0)
+++ labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/simulation/JobGenerator.java	2007-11-23 18:38:45 UTC (rev 16764)
@@ -0,0 +1,47 @@
+package benchmarks.dispatch.simulation;
+
+import java.util.Date;
+import java.util.Random;
+
+import benchmarks.dispatch.fact.independent.Job;
+import benchmarks.dispatch.fact.independent.VehicleSize;
+
+/*
+ * Copyright 2007 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.
+ */
+
+public class JobGenerator {
+    Random random;
+    public JobGenerator(long seed){
+        random = new Random(seed);
+    }
+    
+    public Job generateJob(){
+        Job j = new Job();
+        
+        j.setEndTime( new Date() );
+        j.setStartTime( new Date() );
+        j.setJobId( new Integer(random.nextInt()).toString() );
+        j.setLatitude( -100D );
+        j.setLongitude( -100D );
+        j.setNumberOfRocksRequired( 1 );
+        j.setNumberOfSticksRequired( 1 );
+        j.setStatus( Job.Status.PENDING );
+        j.setVehicleSizeRequired( VehicleSize.SMALL );
+        j.setWrenchRequired( false );
+        return j;
+    }
+
+}


Property changes on: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/simulation/JobGenerator.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/simulation/WorkerGenerator.java
===================================================================
--- labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/simulation/WorkerGenerator.java	                        (rev 0)
+++ labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/simulation/WorkerGenerator.java	2007-11-23 18:38:45 UTC (rev 16764)
@@ -0,0 +1,53 @@
+package benchmarks.dispatch.simulation;
+
+import java.util.Random;
+
+import benchmarks.dispatch.fact.independent.VehicleSize;
+import benchmarks.dispatch.fact.independent.Worker;
+import benchmarks.dispatch.fact.independent.WorkerPosition;
+
+/*
+ * Copyright 2007 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.
+ */
+
+public class WorkerGenerator {
+
+    Random random;
+
+    public WorkerGenerator(long seed) {
+        random = new Random( seed );
+    }
+
+    public Worker generateWorker() {
+
+        Worker w = new Worker();
+        w.setWorkerId( new Integer( random.nextInt() ).toString() );
+        w.setHasWrench( false );
+        w.setNumberOfRocks( 1 );
+        w.setNumberOfSticks( 2 );
+        w.setStatus( Worker.Status.WAITING_FOR_JOB );
+        w.setVehicleSize( VehicleSize.SMALL );
+
+        return w;
+    }
+
+    public WorkerPosition generateWorkerPosition(Worker w) {
+        WorkerPosition wp = new WorkerPosition();
+        wp.setLatitude( -90D );
+        wp.setLongitude( -90D );
+        wp.setWorkerId( w.getWorkerId() );
+        return wp;
+    }
+}


Property changes on: labs/jbossrules/contrib/benchmarks/src/java/benchmarks/dispatch/simulation/WorkerGenerator.java
___________________________________________________________________
Name: svn:eol-style
   + native




More information about the jboss-svn-commits mailing list