1 package com.quantum.sql;
3 import java.beans.PropertyChangeListener;
4 import java.beans.PropertyChangeSupport;
5 import java.util.ArrayList;
6 import java.util.Collections;
13 public class SQLResultSetCollection {
15 private static final SQLResultSetCollection instance = new SQLResultSetCollection();
17 private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
19 private List results = Collections.synchronizedList(new ArrayList());
21 private SQLResultSetCollection() {
23 public static SQLResultSetCollection getInstance() {
24 return SQLResultSetCollection.instance;
27 public void addPropertyChangeListener(PropertyChangeListener arg0) {
28 this.propertyChangeSupport.addPropertyChangeListener(arg0);
30 public void removePropertyChangeListener(PropertyChangeListener arg0) {
31 this.propertyChangeSupport.removePropertyChangeListener(arg0);
34 public void addSQLResultSet(SQLResultSetResults resultSet) {
35 this.results.add(resultSet);
36 this.propertyChangeSupport.firePropertyChange("resultSets", null, resultSet);
39 public void removeSQLResultSet(SQLResultSetResults resultSet) {
40 if (this.results.remove(resultSet)) {
41 this.propertyChangeSupport.firePropertyChange("resultSets", resultSet, null);
45 public void removeAllSQLResultSet() {
46 if (this.results.size() > 0) {
49 this.propertyChangeSupport.firePropertyChange("resultSets", null, null);
52 public SQLResultSetResults[] getResultSets() {
53 return (SQLResultSetResults[]) this.results.toArray(
54 new SQLResultSetResults[this.results.size()]);