[jboss-svn-commits] JBL Code SVN: r18137 - in labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark: manners and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Jan 25 21:14:13 EST 2008


Author: mark.proctor at jboss.com
Date: 2008-01-25 21:14:12 -0500 (Fri, 25 Jan 2008)
New Revision: 18137

Added:
   labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/
   labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Chosen.java
   labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Context.java
   labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Count.java
   labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Guest.java
   labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Hobby.java
   labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/LastSeat.java
   labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/MannersBenchmark.java
   labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Path.java
   labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Seating.java
   labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Sex.java
   labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/models/
   labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/models/Account.java
   labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/models/Address.java
   labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/models/GroupTransaction.java
   labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/models/Security.java
   labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/models/SubTransaction.java
   labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/models/Transaction.java
Log:
JBRULES-1434 Drools Spring

Added: labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Chosen.java
===================================================================
--- labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Chosen.java	                        (rev 0)
+++ labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Chosen.java	2008-01-26 02:14:12 UTC (rev 18137)
@@ -0,0 +1,55 @@
+package org.drools.benchmark.manners;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.Serializable;
+
+public class Chosen implements Serializable {
+
+	private int id;
+
+	private String guestName;
+
+	private Hobby hobby;
+	
+	public Chosen() {
+		
+	}
+
+	public Chosen(int id, String guestName, Hobby hobby) {
+		this.id = id;
+		this.guestName = guestName;
+		this.hobby = hobby;
+	}
+
+	public int getId() {
+		return this.id;
+	}
+
+	public String getGuestName() {
+		return this.guestName;
+	}
+
+	public Hobby getHobby() {
+		return this.hobby;
+	}
+
+	public String toString() {
+		return "{Chosen id=" + this.id + ", name=" + this.guestName
+				+ ", hobbies=" + this.hobby + "}";
+	}
+}
\ No newline at end of file

Added: labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Context.java
===================================================================
--- labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Context.java	                        (rev 0)
+++ labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Context.java	2008-01-26 02:14:12 UTC (rev 18137)
@@ -0,0 +1,74 @@
+package org.drools.benchmark.manners;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.Serializable;
+
+public class Context implements Serializable {
+
+	public static final int START_UP = 0;
+
+	public static final int ASSIGN_SEATS = 1;
+
+	public static final int MAKE_PATH = 2;
+
+	public static final int CHECK_DONE = 3;
+
+	public static final int PRINT_RESULTS = 4;
+
+	public static final String[] stateStrings = { "START_UP", "ASSIGN_SEATS",
+			"MAKE_PATH", "CHECK_DONE", "PRINT_RESULTS" };
+
+	private int state;
+	
+	public Context() {
+		
+	}
+
+	public Context(String state) {
+		if ("start".equals(state)) {
+			this.state = Context.START_UP;
+		} else {
+			throw new RuntimeException("Context '" + state
+					+ "' does not exist for Context Enum");
+		}
+	}
+
+	public Context(int state) {
+		this.state = state;
+	}
+
+	public void setState(int state) {
+		this.state = state;
+	}
+
+	public boolean isState(int state) {
+		return this.state == state;
+	}
+
+	public int getState() {
+		return this.state;
+	}
+
+	public String getStringValue() {
+		return stateStrings[this.state];
+	}
+
+	public String toString() {
+		return "[Context state=" + getStringValue() + "]";
+	}
+}
\ No newline at end of file

Added: labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Count.java
===================================================================
--- labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Count.java	                        (rev 0)
+++ labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Count.java	2008-01-26 02:14:12 UTC (rev 18137)
@@ -0,0 +1,59 @@
+package org.drools.benchmark.manners;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Count {
+	private int value;
+	
+	public Count() {
+		
+	}
+
+	public Count(int value) {
+		super();
+		this.value = value;
+	}
+
+	public int getValue() {
+		return this.value;
+	}
+
+	public void setValue(int value) {
+		this.value = value;
+	}
+
+	public String toString() {
+		return "[Count value=" + this.value + "]";
+	}
+
+	public boolean equals(Object object) {
+		if (object == this) {
+			return true;
+		}
+
+		if ((object == null) || !(object instanceof Count)) {
+			return false;
+		}
+
+		return this.value == ((Count) object).value;
+	}
+
+	public int hashCode() {
+		return this.value;
+	}
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Guest.java
===================================================================
--- labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Guest.java	                        (rev 0)
+++ labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Guest.java	2008-01-26 02:14:12 UTC (rev 18137)
@@ -0,0 +1,54 @@
+package org.drools.benchmark.manners;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.Serializable;
+
+public class Guest implements Serializable {
+	private String name;
+
+	private Sex sex;
+
+	private Hobby hobby;
+	
+	public Guest() {
+		
+	}
+
+	public Guest(String name, Sex sex, Hobby hobby) {
+		this.name = name;
+		this.sex = sex;
+		this.hobby = hobby;
+	}
+
+	public String getName() {
+		return this.name;
+	}
+
+	public Hobby getHobby() {
+		return this.hobby;
+	}
+
+	public Sex getSex() {
+		return this.sex;
+	}
+
+	public String toString() {
+		return "[Guest name=" + this.name + ", sex=" + this.sex + ", hobbies="
+				+ this.hobby + "]";
+	}
+}
\ No newline at end of file

Added: labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Hobby.java
===================================================================
--- labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Hobby.java	                        (rev 0)
+++ labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Hobby.java	2008-01-26 02:14:12 UTC (rev 18137)
@@ -0,0 +1,89 @@
+package org.drools.benchmark.manners;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Hobby {
+	public static final String stringH1 = "h1";
+
+	public static final String stringH2 = "h2";
+
+	public static final String stringH3 = "h3";
+
+	public static final String stringH4 = "h4";
+
+	public static final String stringH5 = "h5";
+
+	public static final String[] hobbyStrings = new String[] { stringH1,
+			stringH2, stringH3, stringH4, stringH5 };
+
+	public static final Hobby H1 = new Hobby(1);
+
+	public static final Hobby H2 = new Hobby(2);
+
+	public static final Hobby H3 = new Hobby(3);
+
+	public static final Hobby H4 = new Hobby(4);
+
+	public static final Hobby H5 = new Hobby(5);
+
+	private String hobbyStr;
+
+	private int hobbyIndex;
+
+	public Hobby() {
+		
+	}
+	
+	private Hobby(int hobby) {
+		this.hobbyIndex = hobby - 1;
+		this.hobbyStr = hobbyStrings[this.hobbyIndex];
+	}
+
+	public String getHobby() {
+		return this.hobbyStr;
+	}
+
+	public static Hobby resolve(String hobby) {
+		if (stringH1.equals(hobby)) {
+			return Hobby.H1;
+		} else if (stringH2.equals(hobby)) {
+			return Hobby.H2;
+		} else if (stringH3.equals(hobby)) {
+			return Hobby.H3;
+		} else if (stringH4.equals(hobby)) {
+			return Hobby.H4;
+		} else if (stringH5.equals(hobby)) {
+			return Hobby.H5;
+		} else {
+			throw new RuntimeException("Hobby '" + hobby
+					+ "' does not exist for Hobby Enum");
+		}
+	}
+
+	public String toString() {
+		return getHobby();
+	}
+
+	public boolean equals(Object object) {
+		return (this == object);
+	}
+
+	public int hashCode() {
+		return this.hobbyIndex;
+	}
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/LastSeat.java
===================================================================
--- labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/LastSeat.java	                        (rev 0)
+++ labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/LastSeat.java	2008-01-26 02:14:12 UTC (rev 18137)
@@ -0,0 +1,39 @@
+package org.drools.benchmark.manners;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.Serializable;
+
+public class LastSeat implements Serializable {
+	private int seat;
+	
+	public LastSeat() {
+		
+	}
+
+	public LastSeat(int seat) {
+		this.seat = seat;
+	}
+
+	public int getSeat() {
+		return this.seat;
+	}
+
+	public String toString() {
+		return "[LastSeat seat=" + this.seat + "]";
+	}
+}
\ No newline at end of file

Added: labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/MannersBenchmark.java
===================================================================
--- labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/MannersBenchmark.java	                        (rev 0)
+++ labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/MannersBenchmark.java	2008-01-26 02:14:12 UTC (rev 18137)
@@ -0,0 +1,182 @@
+package org.drools.benchmark.manners;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Random;
+import java.util.StringTokenizer;
+
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.StatefulSession;
+import org.drools.compiler.PackageBuilder;
+import org.drools.rule.Package;
+import org.drools.spring.core.RuleBaseBeanFactory;
+import org.springframework.beans.factory.FactoryBean;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class MannersBenchmark {
+	/** Number of guests at the dinner (default: 16). */
+	private int numGuests = 16;
+
+	/** Number of seats at the table (default: 16). */
+	private int numSeats = 16;
+
+	/** Minimum number of hobbies each guest should have (default: 2). */
+	private int minHobbies = 2;
+
+	/** Maximun number of hobbies each guest should have (default: 3). */
+	private int maxHobbies = 3;
+	
+	public static void main(final String[] args) throws Exception {
+		String applicationContextClassPath = "org/drools/benchmark/manners/application-context.xml";
+		ApplicationContext applicationContext = new ClassPathXmlApplicationContext(applicationContextClassPath);
+		
+		// get the rule base from spring context
+		final RuleBase ruleBase = (RuleBase) applicationContext.getBean("ruleBase");
+
+		StatefulSession session = ruleBase.newStatefulSession();
+
+		String filename;
+		if (args.length != 0) {
+			String arg = args[0];
+			filename = arg;
+		} else {
+			filename = "manners64.dat";
+		}
+
+		InputStream is = MannersBenchmark.class.getResourceAsStream(filename);
+		List list = getInputObjects(is);
+		for (Iterator it = list.iterator(); it.hasNext();) {
+			Object object = it.next();
+			session.insert(object);
+		}
+
+		session.insert(new Count(1));
+
+		long start = System.currentTimeMillis();
+		session.fireAllRules();
+		System.err.println(System.currentTimeMillis() - start);
+        session.dispose();
+	}
+
+	/**
+	 * Convert the facts from the <code>InputStream</code> to a list of
+	 * objects.
+	 */
+	protected static List getInputObjects(InputStream inputStream)
+			throws IOException {
+		List list = new ArrayList();
+
+		BufferedReader br = new BufferedReader(new InputStreamReader(
+				inputStream));
+
+		String line;
+		while ((line = br.readLine()) != null) {
+			if (line.trim().length() == 0 || line.trim().startsWith(";")) {
+				continue;
+			}
+			StringTokenizer st = new StringTokenizer(line, "() ");
+			String type = st.nextToken();
+
+			if ("guest".equals(type)) {
+				if (!"name".equals(st.nextToken())) {
+					throw new IOException("expected 'name' in: " + line);
+				}
+				String name = st.nextToken();
+				if (!"sex".equals(st.nextToken())) {
+					throw new IOException("expected 'sex' in: " + line);
+				}
+				String sex = st.nextToken();
+				if (!"hobby".equals(st.nextToken())) {
+					throw new IOException("expected 'hobby' in: " + line);
+				}
+				String hobby = st.nextToken();
+
+				Guest guest = new Guest(name, Sex.resolve(sex), Hobby
+						.resolve(hobby));
+
+				list.add(guest);
+			}
+
+			if ("last_seat".equals(type)) {
+				if (!"seat".equals(st.nextToken())) {
+					throw new IOException("expected 'seat' in: " + line);
+				}
+				list.add(new LastSeat(new Integer(st.nextToken()).intValue()));
+			}
+
+			if ("context".equals(type)) {
+				if (!"state".equals(st.nextToken())) {
+					throw new IOException("expected 'state' in: " + line);
+				}
+				list.add(new Context(st.nextToken()));
+			}
+		}
+		inputStream.close();
+
+		return list;
+	}
+
+	private InputStream generateData() {
+		final String LINE_SEPARATOR = System.getProperty("line.separator");
+
+		StringWriter writer = new StringWriter();
+
+		int maxMale = numGuests / 2;
+		int maxFemale = numGuests / 2;
+
+		int maleCount = 0;
+		int femaleCount = 0;
+
+		// init hobbies
+		List hobbyList = new ArrayList();
+		for (int i = 1; i <= maxHobbies; i++) {
+			hobbyList.add("h" + i);
+		}
+
+		Random rnd = new Random();
+		for (int i = 1; i <= numGuests; i++) {
+			char sex = rnd.nextBoolean() ? 'm' : 'f';
+			if (sex == 'm' && maleCount == maxMale) {
+				sex = 'f';
+			}
+			if (sex == 'f' && femaleCount == maxFemale) {
+				sex = 'm';
+			}
+			if (sex == 'm') {
+				maleCount++;
+			}
+			if (sex == 'f') {
+				femaleCount++;
+			}
+
+			List guestHobbies = new ArrayList(hobbyList);
+
+			int numHobbies = minHobbies
+					+ rnd.nextInt(maxHobbies - minHobbies + 1);
+			for (int j = 0; j < numHobbies; j++) {
+				int hobbyIndex = rnd.nextInt(guestHobbies.size());
+				String hobby = (String) guestHobbies.get(hobbyIndex);
+				writer.write("(guest (name n" + i + ") (sex " + sex
+						+ ") (hobby " + hobby + "))" + LINE_SEPARATOR);
+				guestHobbies.remove(hobbyIndex);
+			}
+		}
+		writer.write("(last_seat (seat " + numSeats + "))" + LINE_SEPARATOR);
+
+		writer.write(LINE_SEPARATOR);
+		writer.write("(context (state start))" + LINE_SEPARATOR);
+
+		return new ByteArrayInputStream(writer.getBuffer().toString()
+				.getBytes());
+	}
+
+}

Added: labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Path.java
===================================================================
--- labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Path.java	                        (rev 0)
+++ labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Path.java	2008-01-26 02:14:12 UTC (rev 18137)
@@ -0,0 +1,53 @@
+package org.drools.benchmark.manners;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Path {
+	private int id;
+
+	private String guestName;
+
+	private int seat;
+
+	public Path() {
+		
+	}
+	
+	public Path(int id, int seat, String guestName) {
+		this.id = id;
+		this.seat = seat;
+		this.guestName = guestName;
+	}
+
+	public int getSeat() {
+		return this.seat;
+	}
+
+	public String getGuestName() {
+		return this.guestName;
+	}
+
+	public int getId() {
+		return this.id;
+	}
+
+	public String toString() {
+		return "[Path id=" + this.id + ", seat=" + this.seat + ", guest="
+				+ this.guestName + "]";
+	}
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Seating.java
===================================================================
--- labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Seating.java	                        (rev 0)
+++ labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Seating.java	2008-01-26 02:14:12 UTC (rev 18137)
@@ -0,0 +1,86 @@
+package org.drools.benchmark.manners;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.Serializable;
+
+public class Seating implements Serializable {
+	private int id, pid;
+
+	private int leftSeat, rightSeat;
+
+	private String leftGuestName, rightGuestName;
+
+	private boolean pathDone;
+	
+	public Seating() {
+		
+	}
+
+	public Seating( int id,  int pid,  boolean pathDone,
+			 int leftSeat,  String leftGuestName,
+			 int rightSeat,  String rightGuestName) {
+		super();
+		this.id = id;
+		this.pid = pid;
+		this.pathDone = pathDone;
+		this.leftSeat = leftSeat;
+		this.leftGuestName = leftGuestName;
+		this.rightSeat = rightSeat;
+		this.rightGuestName = rightGuestName;
+	}
+
+	public  boolean isPathDone() {
+		return this.pathDone;
+	}
+
+	public  void setPathDone(boolean pathDone) {
+		this.pathDone = pathDone;
+	}
+
+	public  int getId() {
+		return this.id;
+	}
+
+	public  String getLeftGuestName() {
+		return this.leftGuestName;
+	}
+
+	public  int getLeftSeat() {
+		return this.leftSeat;
+	}
+
+	public  int getPid() {
+		return this.pid;
+	}
+
+	public  String getRightGuestName() {
+		return this.rightGuestName;
+	}
+
+	public  int getRightSeat() {
+		return this.rightSeat;
+	}
+
+	public  String toString() {
+		return "[Seating id=" + this.id + " , pid=" + this.pid + " , pathDone="
+				+ this.pathDone + " , leftSeat=" + this.leftSeat
+				+ ", leftGuestName=" + this.leftGuestName + ", rightSeat="
+				+ this.rightSeat + ", rightGuestName=" + this.rightGuestName
+				+ "]";
+	}
+}
\ No newline at end of file

Added: labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Sex.java
===================================================================
--- labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Sex.java	                        (rev 0)
+++ labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/manners/Sex.java	2008-01-26 02:14:12 UTC (rev 18137)
@@ -0,0 +1,67 @@
+package org.drools.benchmark.manners;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Sex {
+	public static final Sex M = new Sex(0);
+
+	public static final Sex F = new Sex(1);
+
+	public static final String stringM = "m";
+
+	public static final String stringF = "f";
+
+	public static final String[] sexList = new String[] { stringM, stringF };
+
+	private int sex;
+
+	public Sex() {
+		
+	}
+	
+	private Sex(int sex) {
+		this.sex = sex;
+	}
+
+	public  String getSex() {
+		return sexList[this.sex];
+	}
+
+	public  static Sex resolve(String sex) {
+		if (stringM.equals(sex)) {
+			return Sex.M;
+		} else if (stringF.equals(sex)) {
+			return Sex.F;
+		} else {
+			throw new RuntimeException("Sex '" + sex
+					+ "' does not exist for Sex Enum");
+		}
+	}
+
+	public  String toString() {
+		return getSex();
+	}
+
+	public  boolean equals(Object object) {
+		return this == object;
+	}
+
+	public  int hashCode() {
+		return this.sex;
+	}
+
+}
\ No newline at end of file

Added: labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/models/Account.java
===================================================================
--- labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/models/Account.java	                        (rev 0)
+++ labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/models/Account.java	2008-01-26 02:14:12 UTC (rev 18137)
@@ -0,0 +1,274 @@
+package org.drools.benchmark.models;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.Serializable;
+import java.util.ArrayList;
+
+/**
+ * @author Peter Lin
+ *
+ * A simple test bean that represents a generic account. It could be
+ * a bank account, shopping card account, or any type of membership
+ * account with a nationwide company.
+ */
+public class Account
+    implements
+    Serializable {
+
+    protected String    first       = null;
+    protected String    middle      = null;
+    protected String    last        = null;
+    /**
+     * mr, mrs, ms, junior, etc
+     */
+    protected String    title       = null;
+    protected String    accountId   = null;
+    protected String    accountType = null;
+    protected String    status      = null;
+    protected String    username    = null;
+    /**
+     * this would represent the region of the office the account
+     * was opened at.
+     */
+    protected String    regionCode  = null;
+    /**
+     * the code for the office where the account was opened.
+     */
+    protected String    officeCode  = null;
+    protected String    areaCode    = null;
+    protected String    exchange    = null;
+    protected String    number      = null;
+    protected String    ext         = null;
+
+    protected ArrayList listeners   = new ArrayList();
+
+    /**
+     * 
+     */
+    public Account() {
+        super();
+    }
+
+    public void setTitle(String val) {
+        if ( !val.equals( this.title ) ) {
+            String old = this.title;
+            this.title = val;
+            notifyListener( "title",
+                            old,
+                            this.title );
+        }
+    }
+
+    public String getTitle() {
+        return this.title;
+    }
+
+    public void setFirst(String val) {
+        if ( !val.equals( this.first ) ) {
+            String old = this.first;
+            this.first = val;
+            notifyListener( "first",
+                            old,
+                            this.first );
+        }
+    }
+
+    public String getFirst() {
+        return this.first;
+    }
+
+    public void setLast(String val) {
+        if ( !val.equals( this.last ) ) {
+            String old = this.last;
+            this.last = val;
+            notifyListener( "last",
+                            old,
+                            this.last );
+        }
+    }
+
+    public String getLast() {
+        return this.last;
+    }
+
+    public void setMiddle(String val) {
+        if ( !val.equals( this.middle ) ) {
+            String old = this.middle;
+            this.middle = val;
+            notifyListener( "middle",
+                            old,
+                            this.middle );
+        }
+    }
+
+    public String getMiddle() {
+        return this.middle;
+    }
+
+    public void setOfficeCode(String val) {
+        if ( !val.equals( this.officeCode ) ) {
+            String old = this.officeCode;
+            this.officeCode = val;
+            notifyListener( "officeCode",
+                            old,
+                            this.officeCode );
+        }
+    }
+
+    public String getOfficeCode() {
+        return this.officeCode;
+    }
+
+    public void setRegionCode(String val) {
+        if ( !val.equals( this.regionCode ) ) {
+            String old = this.regionCode;
+            this.regionCode = val;
+            notifyListener( "regionCode",
+                            old,
+                            this.regionCode );
+        }
+    }
+
+    public String getRegionCode() {
+        return this.regionCode;
+    }
+
+    public void setStatus(String val) {
+        if ( !val.equals( this.status ) ) {
+            String old = this.status;
+            this.status = val;
+            notifyListener( "status",
+                            old,
+                            this.status );
+        }
+    }
+
+    public String getStatus() {
+        return this.status;
+    }
+
+    public void setAccountId(String val) {
+        if ( !val.equals( this.accountId ) ) {
+            String old = this.accountId;
+            this.accountId = val;
+            notifyListener( "accountId",
+                            old,
+                            this.accountId );
+        }
+    }
+
+    public String getAccountId() {
+        return this.accountId;
+    }
+
+    public void setAccountType(String val) {
+        if ( !val.equals( this.accountType ) ) {
+            String old = this.accountType;
+            this.accountType = val;
+            notifyListener( "accountType",
+                            old,
+                            this.accountType );
+        }
+    }
+
+    public String getAccountType() {
+        return this.accountType;
+    }
+
+    public void setUsername(String val) {
+        if ( !val.equals( this.username ) ) {
+            String old = this.username;
+            this.username = val;
+            notifyListener( "username",
+                            old,
+                            this.username );
+        }
+    }
+
+    public String getUsername() {
+        return this.username;
+    }
+
+    public String getAreaCode() {
+        return this.areaCode;
+    }
+
+    public void setAreaCode(String val) {
+        if ( !val.equals( this.areaCode ) ) {
+            String old = this.areaCode;
+            this.areaCode = val;
+            notifyListener( "areaCode",
+                            old,
+                            this.areaCode );
+        }
+    }
+
+    public String getExchange() {
+        return this.exchange;
+    }
+
+    public void setExchange(String val) {
+        if ( !val.equals( this.exchange ) ) {
+            String old = this.exchange;
+            this.exchange = val;
+            notifyListener( "exchange",
+                            old,
+                            this.exchange );
+        }
+    }
+
+    public String getNumber() {
+        return this.number;
+    }
+
+    public void setNumber(String val) {
+        if ( !val.equals( this.number ) ) {
+            String old = this.number;
+            this.number = val;
+            notifyListener( "number",
+                            old,
+                            this.number );
+        }
+    }
+
+    public String getExt() {
+        return this.ext;
+    }
+
+    public void setExt(String val) {
+        if ( !val.equals( this.ext ) ) {
+            String old = this.ext;
+            this.ext = val;
+            notifyListener( "ext",
+                            old,
+                            this.ext );
+        }
+    }
+
+    public void addPropertyChangeListener(PropertyChangeListener listener) {
+        this.listeners.add( listener );
+    }
+
+    public void removePropertyChangeListener(PropertyChangeListener listener) {
+        this.listeners.remove( listener );
+    }
+
+    protected void notifyListener(String field,
+                                  Object oldValue,
+                                  Object newValue) {
+        if ( listeners == null || listeners.size() == 0 ) {
+            return;
+        } else {
+            PropertyChangeEvent event = new PropertyChangeEvent( this,
+                                                                 field,
+                                                                 oldValue,
+                                                                 newValue );
+
+            for ( int i = 0; i < listeners.size(); i++ ) {
+                ((java.beans.PropertyChangeListener) listeners.get( i )).propertyChange( event );
+            }
+        }
+
+    }
+}

Added: labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/models/Address.java
===================================================================
--- labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/models/Address.java	                        (rev 0)
+++ labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/models/Address.java	2008-01-26 02:14:12 UTC (rev 18137)
@@ -0,0 +1,202 @@
+package org.drools.benchmark.models;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.Serializable;
+import java.util.ArrayList;
+
+/**
+ * @author Peter Lin
+ *
+ * A simple address class that represents a house a person owns.
+ */
+public class Address
+    implements
+    Serializable {
+
+    protected String    title      = null;
+    protected String    accountId  = null;
+    protected String    street     = null;
+    protected String    street2    = null;
+    protected String    status     = null;
+    protected String    city       = null;
+    protected String    state      = null;
+    protected String    postalCode = null;
+    protected String    houseType  = null;
+    protected String    country    = null;
+
+    protected ArrayList listeners  = new ArrayList();
+
+    /**
+     * 
+     */
+    public Address() {
+        super();
+    }
+
+    public void setTitle(String val) {
+        if ( !val.equals( this.title ) ) {
+            String old = this.title;
+            this.title = val;
+            notifyListener( "title",
+                            old,
+                            this.title );
+        }
+    }
+
+    public String getTitle() {
+        return this.title;
+    }
+
+    public void setState(String val) {
+        if ( !val.equals( this.state ) ) {
+            String old = this.state;
+            this.state = val;
+            notifyListener( "officeCode",
+                            old,
+                            this.state );
+        }
+    }
+
+    public String getState() {
+        return this.state;
+    }
+
+    public void setCity(String val) {
+        if ( !val.equals( this.city ) ) {
+            String old = this.city;
+            this.city = val;
+            notifyListener( "regionCode",
+                            old,
+                            this.city );
+        }
+    }
+
+    public String getCity() {
+        return this.city;
+    }
+
+    public void setStreet2(String val) {
+        if ( !val.equals( this.street2 ) ) {
+            String old = this.street2;
+            this.street2 = val;
+            notifyListener( "status",
+                            old,
+                            this.street2 );
+        }
+    }
+
+    public String getStreet2() {
+        return this.street2;
+    }
+
+    public void setAccountId(String val) {
+        if ( !val.equals( this.accountId ) ) {
+            String old = this.accountId;
+            this.accountId = val;
+            notifyListener( "accountId",
+                            old,
+                            this.accountId );
+        }
+    }
+
+    public String getAccountId() {
+        return this.accountId;
+    }
+
+    public void setStreet(String val) {
+        if ( !val.equals( this.street ) ) {
+            String old = this.street;
+            this.street = val;
+            notifyListener( "accountType",
+                            old,
+                            this.street );
+        }
+    }
+
+    public String getStreet() {
+        return this.street;
+    }
+
+    public void setStatus(String val) {
+        if ( !val.equals( this.status ) ) {
+            String old = this.status;
+            this.status = val;
+            notifyListener( "username",
+                            old,
+                            this.status );
+        }
+    }
+
+    public String getStatus() {
+        return this.status;
+    }
+
+    public String getPostalCode() {
+        return this.postalCode;
+    }
+
+    public void setPostalCode(String val) {
+        if ( !val.equals( this.postalCode ) ) {
+            String old = this.postalCode;
+            this.postalCode = val;
+            notifyListener( "areaCode",
+                            old,
+                            this.postalCode );
+        }
+    }
+
+    public String getHouseType() {
+        return this.houseType;
+    }
+
+    public void setHouseType(String val) {
+        if ( !val.equals( this.houseType ) ) {
+            String old = this.houseType;
+            this.houseType = val;
+            notifyListener( "exchange",
+                            old,
+                            this.houseType );
+        }
+    }
+
+    public String getCountry() {
+        return this.country;
+    }
+
+    public void setCountry(String val) {
+        if ( !val.equals( this.country ) ) {
+            String old = this.country;
+            this.country = val;
+            notifyListener( "number",
+                            old,
+                            this.country );
+        }
+    }
+
+    public void addPropertyChangeListener(PropertyChangeListener listener) {
+        this.listeners.add( listener );
+    }
+
+    public void removePropertyChangeListener(PropertyChangeListener listener) {
+        this.listeners.remove( listener );
+    }
+
+    protected void notifyListener(String field,
+                                  Object oldValue,
+                                  Object newValue) {
+        if ( listeners == null || listeners.size() == 0 ) {
+            return;
+        } else {
+            PropertyChangeEvent event = new PropertyChangeEvent( this,
+                                                                 field,
+                                                                 oldValue,
+                                                                 newValue );
+
+            for ( int i = 0; i < listeners.size(); i++ ) {
+                ((java.beans.PropertyChangeListener) listeners.get( i )).propertyChange( event );
+            }
+        }
+
+    }
+}

Added: labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/models/GroupTransaction.java
===================================================================
--- labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/models/GroupTransaction.java	                        (rev 0)
+++ labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/models/GroupTransaction.java	2008-01-26 02:14:12 UTC (rev 18137)
@@ -0,0 +1,135 @@
+package org.drools.benchmark.models;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
+
+/**
+ * @author Peter Lin
+ *
+ */
+public class GroupTransaction extends Security {
+
+    protected String[]  accountIds    = null;
+    protected double    buyPrice;
+    protected String    purchaseDate  = null;
+    protected double    shares;
+    protected double    total;
+    protected String    transactionId = null;
+
+    protected ArrayList listeners     = new ArrayList();
+
+    public GroupTransaction() {
+        super();
+    }
+
+    public void setAccountIds(String[] id) {
+        if ( id != this.accountIds ) {
+            String[] old = this.accountIds;
+            this.accountIds = id;
+            this.notifyListener( "accountIds",
+                                 old,
+                                 this.accountIds );
+        }
+    }
+
+    public String[] getAccountIds() {
+        return this.accountIds;
+    }
+
+    public void setBuyPrice(double price) {
+        if ( price != this.buyPrice ) {
+            Double old = new Double( this.buyPrice );
+            this.buyPrice = price;
+            this.notifyListener( "buyPrice",
+                                 old,
+                                 new Double( this.buyPrice ) );
+        }
+    }
+
+    public double getBuyPrice() {
+        return this.buyPrice;
+    }
+
+    public void setPurchaseDate(String date) {
+        if ( !date.equals( this.purchaseDate ) ) {
+            String old = this.purchaseDate;
+            this.purchaseDate = date;
+            this.notifyListener( "purchaseDate",
+                                 old,
+                                 this.purchaseDate );
+        }
+    }
+
+    public String getPurchaseDate() {
+        return this.purchaseDate;
+    }
+
+    public void setShares(double shares) {
+        if ( shares != this.shares ) {
+            Double old = new Double( this.shares );
+            this.shares = shares;
+            this.notifyListener( "shares",
+                                 old,
+                                 new Double( this.shares ) );
+        }
+    }
+
+    public double getShares() {
+        return this.shares;
+    }
+
+    public void setTotal(double value) {
+        if ( value != this.total ) {
+            Double old = new Double( this.total );
+            this.total = value;
+            this.notifyListener( "total",
+                                 old,
+                                 new Double( this.total ) );
+        }
+    }
+
+    public double getTotal() {
+        return this.total;
+    }
+
+    public void setTransactionId(String id) {
+        if ( !id.equals( this.transactionId ) ) {
+            String old = this.transactionId;
+            this.transactionId = id;
+            this.notifyListener( "transactionId",
+                                 old,
+                                 this.transactionId );
+        }
+    }
+
+    public String getTransactionId() {
+        return this.transactionId;
+    }
+
+    public void addPropertyChangeListener(PropertyChangeListener listener) {
+        this.listeners.add( listener );
+    }
+
+    public void removePropertyChangeListener(PropertyChangeListener listener) {
+        this.listeners.remove( listener );
+    }
+
+    protected void notifyListener(String field,
+                                  Object oldValue,
+                                  Object newValue) {
+        if ( listeners == null || listeners.size() == 0 ) {
+            return;
+        } else {
+            PropertyChangeEvent event = new PropertyChangeEvent( this,
+                                                                 field,
+                                                                 oldValue,
+                                                                 newValue );
+
+            for ( int i = 0; i < listeners.size(); i++ ) {
+                ((java.beans.PropertyChangeListener) listeners.get( i )).propertyChange( event );
+            }
+        }
+
+    }
+}

Added: labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/models/Security.java
===================================================================
--- labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/models/Security.java	                        (rev 0)
+++ labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/models/Security.java	2008-01-26 02:14:12 UTC (rev 18137)
@@ -0,0 +1,198 @@
+package org.drools.benchmark.models;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.Serializable;
+import java.util.ArrayList;
+
+/**
+ * @author Peter Lin
+ *
+ */
+public class Security
+    implements
+    Serializable {
+
+    protected String    countryCode = null;
+    protected double    currentPrice;
+    protected int       cusip;
+    protected String    exchange    = null;
+    protected int       industryGroupID;
+    protected int       industryID;
+    protected String    issuer      = null;
+    protected double    lastPrice;
+    protected int       sectorID;
+    protected int       subIndustryID;
+
+    protected ArrayList listeners   = new ArrayList();
+
+    public Security() {
+        super();
+    }
+
+    public void setCountryCode(String code) {
+        if ( !code.equals( this.countryCode ) ) {
+            String old = this.countryCode;
+            this.countryCode = code;
+            this.notifyListener( "countryCode",
+                                 old,
+                                 this.countryCode );
+        }
+    }
+
+    public String getCountryCode() {
+        return this.countryCode;
+    }
+
+    public void setCurrentPrice(double price) {
+        if ( price != this.currentPrice ) {
+            Double old = new Double( this.currentPrice );
+            this.currentPrice = price;
+            this.notifyListener( "currentPrice",
+                                 old,
+                                 new Double( this.currentPrice ) );
+        }
+    }
+
+    public double getCurrentPrice() {
+        return this.currentPrice;
+    }
+
+    public void setCusip(int value) {
+        if ( value != this.cusip ) {
+            Integer old = new Integer( this.cusip );
+            this.cusip = value;
+            this.notifyListener( "cusip",
+                                 old,
+                                 new Integer( this.cusip ) );
+        }
+    }
+
+    public int getCusip() {
+        return this.cusip;
+    }
+
+    public void setExchange(String exc) {
+        if ( !exc.equals( this.exchange ) ) {
+            String old = this.exchange;
+            this.exchange = exc;
+            this.notifyListener( "exchange",
+                                 old,
+                                 this.exchange );
+        }
+    }
+
+    public String getExchange() {
+        return this.exchange;
+    }
+
+    public void setIndustryGroupID(int id) {
+        if ( id != this.industryGroupID ) {
+            int old = this.industryGroupID;
+            this.industryGroupID = id;
+            this.notifyListener( "industryGroupID",
+                                 new Integer( old ),
+                                 new Integer( this.industryGroupID ) );
+        }
+    }
+
+    public int getIndustryGroupID() {
+        return this.industryGroupID;
+    }
+
+    public void setIndustryID(int id) {
+        if ( id != this.industryID ) {
+            int old = this.industryID;
+            this.industryID = id;
+            this.notifyListener( "industryID",
+                                 new Integer( old ),
+                                 new Integer( this.industryID ) );
+        }
+    }
+
+    public int getIndustryID() {
+        return this.industryID;
+    }
+
+    public void setIssuer(String name) {
+        if ( !name.equals( this.issuer ) ) {
+            String old = this.issuer;
+            this.issuer = name;
+            this.notifyListener( "issuer",
+                                 old,
+                                 this.issuer );
+        }
+    }
+
+    public String getIssuer() {
+        return this.issuer;
+    }
+
+    public void setLastPrice(double price) {
+        if ( price != this.lastPrice ) {
+            Double old = new Double( this.lastPrice );
+            this.lastPrice = price;
+            this.notifyListener( "lastPrice",
+                                 old,
+                                 new Double( this.lastPrice ) );
+        }
+    }
+
+    public double getLastPrice() {
+        return this.lastPrice;
+    }
+
+    public void setSectorID(int id) {
+        if ( id != this.sectorID ) {
+            int old = this.sectorID;
+            this.sectorID = id;
+            this.notifyListener( "sectorID",
+                                 new Integer( old ),
+                                 new Integer( this.sectorID ) );
+        }
+    }
+
+    public int getSectorID() {
+        return this.sectorID;
+    }
+
+    public void setSubIndustryID(int id) {
+        if ( id != this.subIndustryID ) {
+            int old = this.subIndustryID;
+            this.subIndustryID = id;
+            this.notifyListener( "subIndustryID",
+                                 new Integer( old ),
+                                 new Integer( this.subIndustryID ) );
+        }
+    }
+
+    public int getSubIndustryID() {
+        return this.subIndustryID;
+    }
+
+    public void addPropertyChangeListener(PropertyChangeListener listener) {
+        this.listeners.add( listener );
+    }
+
+    public void removePropertyChangeListener(PropertyChangeListener listener) {
+        this.listeners.remove( listener );
+    }
+
+    protected void notifyListener(String field,
+                                  Object oldValue,
+                                  Object newValue) {
+        if ( listeners == null || listeners.size() == 0 ) {
+            return;
+        } else {
+            PropertyChangeEvent event = new PropertyChangeEvent( this,
+                                                                 field,
+                                                                 oldValue,
+                                                                 newValue );
+
+            for ( int i = 0; i < listeners.size(); i++ ) {
+                ((java.beans.PropertyChangeListener) listeners.get( i )).propertyChange( event );
+            }
+        }
+
+    }
+}

Added: labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/models/SubTransaction.java
===================================================================
--- labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/models/SubTransaction.java	                        (rev 0)
+++ labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/models/SubTransaction.java	2008-01-26 02:14:12 UTC (rev 18137)
@@ -0,0 +1,59 @@
+package org.drools.benchmark.models;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
+
+/**
+ * @author Peter Lin
+ *
+ */
+public class SubTransaction extends Security {
+
+    protected String[]  transactionSet = null;
+    protected ArrayList listeners      = new ArrayList();
+
+    public SubTransaction() {
+        super();
+    }
+
+    public void setTransactionSet(String[] ids) {
+        if ( ids != this.transactionSet ) {
+            String[] old = this.transactionSet;
+            this.transactionSet = ids;
+            this.notifyListener( "transactionSet",
+                                 old,
+                                 this.transactionSet );
+        }
+    }
+
+    public String[] getTransactionSet() {
+        return this.transactionSet;
+    }
+
+    public void addPropertyChangeListener(PropertyChangeListener listener) {
+        this.listeners.add( listener );
+    }
+
+    public void removePropertyChangeListener(PropertyChangeListener listener) {
+        this.listeners.remove( listener );
+    }
+
+    protected void notifyListener(String field,
+                                  Object oldValue,
+                                  Object newValue) {
+        if ( listeners == null || listeners.size() == 0 ) {
+            return;
+        } else {
+            PropertyChangeEvent event = new PropertyChangeEvent( this,
+                                                                 field,
+                                                                 oldValue,
+                                                                 newValue );
+
+            for ( int i = 0; i < listeners.size(); i++ ) {
+                ((java.beans.PropertyChangeListener) listeners.get( i )).propertyChange( event );
+            }
+        }
+
+    }
+}

Added: labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/models/Transaction.java
===================================================================
--- labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/models/Transaction.java	                        (rev 0)
+++ labs/jbossrules/branches/drools-spring/drools-spring/drools-spring-examples/src/main/java/org/drools/benchmark/models/Transaction.java	2008-01-26 02:14:12 UTC (rev 18137)
@@ -0,0 +1,135 @@
+package org.drools.benchmark.models;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
+
+/**
+ * @author Peter Lin
+ *
+ */
+public class Transaction extends Security {
+
+    protected String    accountId     = null;
+    protected double    buyPrice;
+    protected String    purchaseDate  = null;
+    protected double    shares;
+    protected double    total;
+    protected String    transactionId = null;
+
+    protected ArrayList listeners     = new ArrayList();
+
+    public Transaction() {
+        super();
+    }
+
+    public void setAccountId(String id) {
+        if ( !id.equals( this.accountId ) ) {
+            String old = this.accountId;
+            this.accountId = id;
+            this.notifyListener( "accountId",
+                                 old,
+                                 this.accountId );
+        }
+    }
+
+    public String getAccountId() {
+        return this.accountId;
+    }
+
+    public void setBuyPrice(double price) {
+        if ( price != this.buyPrice ) {
+            Double old = new Double( this.buyPrice );
+            this.buyPrice = price;
+            this.notifyListener( "buyPrice",
+                                 old,
+                                 new Double( this.buyPrice ) );
+        }
+    }
+
+    public double getBuyPrice() {
+        return this.buyPrice;
+    }
+
+    public void setPurchaseDate(String date) {
+        if ( !date.equals( this.purchaseDate ) ) {
+            String old = this.purchaseDate;
+            this.purchaseDate = date;
+            this.notifyListener( "purchaseDate",
+                                 old,
+                                 this.purchaseDate );
+        }
+    }
+
+    public String getPurchaseDate() {
+        return this.purchaseDate;
+    }
+
+    public void setShares(double shares) {
+        if ( shares != this.shares ) {
+            Double old = new Double( this.shares );
+            this.shares = shares;
+            this.notifyListener( "shares",
+                                 old,
+                                 new Double( this.shares ) );
+        }
+    }
+
+    public double getShares() {
+        return this.shares;
+    }
+
+    public void setTotal(double value) {
+        if ( value != this.total ) {
+            Double old = new Double( this.total );
+            this.total = value;
+            this.notifyListener( "total",
+                                 old,
+                                 new Double( this.total ) );
+        }
+    }
+
+    public double getTotal() {
+        return this.total;
+    }
+
+    public void setTransactionId(String id) {
+        if ( !id.equals( this.transactionId ) ) {
+            String old = this.transactionId;
+            this.transactionId = id;
+            this.notifyListener( "transactionId",
+                                 old,
+                                 this.transactionId );
+        }
+    }
+
+    public String getTransactionId() {
+        return this.transactionId;
+    }
+
+    public void addPropertyChangeListener(PropertyChangeListener listener) {
+        this.listeners.add( listener );
+    }
+
+    public void removePropertyChangeListener(PropertyChangeListener listener) {
+        this.listeners.remove( listener );
+    }
+
+    protected void notifyListener(String field,
+                                  Object oldValue,
+                                  Object newValue) {
+        if ( listeners == null || listeners.size() == 0 ) {
+            return;
+        } else {
+            PropertyChangeEvent event = new PropertyChangeEvent( this,
+                                                                 field,
+                                                                 oldValue,
+                                                                 newValue );
+
+            for ( int i = 0; i < listeners.size(); i++ ) {
+                ((java.beans.PropertyChangeListener) listeners.get( i )).propertyChange( event );
+            }
+        }
+
+    }
+}




More information about the jboss-svn-commits mailing list