suppress "variable not initialized" error for break statements. In switch-case statem...
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / sql / SQLResultSetCollection.java
1 package com.quantum.sql;
2
3 import java.beans.PropertyChangeListener;
4 import java.beans.PropertyChangeSupport;
5 import java.util.ArrayList;
6 import java.util.Collections;
7 import java.util.List;
8
9
10 /**
11  * @author BC
12  */
13 public class SQLResultSetCollection {
14
15         private static final SQLResultSetCollection instance = new SQLResultSetCollection();
16         
17         private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
18         
19         private List results = Collections.synchronizedList(new ArrayList());
20         
21         private SQLResultSetCollection() {
22         }
23         public static SQLResultSetCollection getInstance() {
24                 return SQLResultSetCollection.instance;
25         }
26         
27         public void addPropertyChangeListener(PropertyChangeListener arg0) {
28                 this.propertyChangeSupport.addPropertyChangeListener(arg0);
29         }
30         public void removePropertyChangeListener(PropertyChangeListener arg0) {
31                 this.propertyChangeSupport.removePropertyChangeListener(arg0);
32         }
33         
34         public void addSQLResultSet(SQLResultSetResults resultSet) {
35                 this.results.add(resultSet);
36                 this.propertyChangeSupport.firePropertyChange("resultSets", null, resultSet);
37         }
38
39         public void removeSQLResultSet(SQLResultSetResults resultSet) {
40                 if (this.results.remove(resultSet)) {
41                         this.propertyChangeSupport.firePropertyChange("resultSets", resultSet, null);
42                 }
43         }
44         
45         public void removeAllSQLResultSet() {
46                 if (this.results.size() > 0) {
47                         this.results.clear();
48                 }
49                 this.propertyChangeSupport.firePropertyChange("resultSets", null, null);
50         }
51         
52         public SQLResultSetResults[] getResultSets() {
53                 return (SQLResultSetResults[]) this.results.toArray(
54                                 new SQLResultSetResults[this.results.size()]);
55         }
56 }