--- /dev/null
+package com.quantum.sql;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+
+/**
+ * @author BC
+ */
+public class SQLResultSetCollection {
+
+ private static final SQLResultSetCollection instance = new SQLResultSetCollection();
+
+ private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
+
+ private List results = Collections.synchronizedList(new ArrayList());
+
+ private SQLResultSetCollection() {
+ }
+ public static SQLResultSetCollection getInstance() {
+ return SQLResultSetCollection.instance;
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener arg0) {
+ this.propertyChangeSupport.addPropertyChangeListener(arg0);
+ }
+ public void removePropertyChangeListener(PropertyChangeListener arg0) {
+ this.propertyChangeSupport.removePropertyChangeListener(arg0);
+ }
+
+ public void addSQLResultSet(SQLResultSetResults resultSet) {
+ this.results.add(resultSet);
+ this.propertyChangeSupport.firePropertyChange("resultSets", null, resultSet);
+ }
+
+ public void removeSQLResultSet(SQLResultSetResults resultSet) {
+ if (this.results.remove(resultSet)) {
+ this.propertyChangeSupport.firePropertyChange("resultSets", resultSet, null);
+ }
+ }
+
+ public void removeAllSQLResultSet() {
+ if (this.results.size() > 0) {
+ this.results.clear();
+ }
+ this.propertyChangeSupport.firePropertyChange("resultSets", null, null);
+ }
+
+ public SQLResultSetResults[] getResultSets() {
+ return (SQLResultSetResults[]) this.results.toArray(
+ new SQLResultSetResults[this.results.size()]);
+ }
+}