Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
QueryInfo |
|
| 0.0;0 |
1 | package us.daveread.basicquery.queries; | |
2 | ||
3 | import java.lang.ref.SoftReference; | |
4 | import javax.swing.table.TableModel; | |
5 | ||
6 | /** | |
7 | * Title: QueryInfo | |
8 | * <p> | |
9 | * Description: Represents an individual SQL statement index and associated URL. | |
10 | * This is used in a collection to retain a history list of executed queries. | |
11 | * <p> | |
12 | * Copyright: Copyright (c) 2004-2014, David Read | |
13 | * </p> | |
14 | * <p> | |
15 | * This program is free software; you can redistribute it and/or modify it under | |
16 | * the terms of the GNU General Public License as published by the Free Software | |
17 | * Foundation; either version 2 of the License, or (at your option) any later | |
18 | * version. | |
19 | * </p> | |
20 | * <p> | |
21 | * This program is distributed in the hope that it will be useful, but WITHOUT | |
22 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
23 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
24 | * details. | |
25 | * </p> | |
26 | * <p> | |
27 | * You should have received a copy of the GNU General Public License along with | |
28 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple | |
29 | * Place, Suite 330, Boston, MA 02111-1307 USA | |
30 | * </p> | |
31 | * <p> | |
32 | * </p> | |
33 | * | |
34 | * @author David Read | |
35 | */ | |
36 | ||
37 | public class QueryInfo { | |
38 | /** | |
39 | * The index in the list of SQL statements represented by this history entry | |
40 | */ | |
41 | private int sqlIndex; | |
42 | ||
43 | /** | |
44 | * The index in the list of connection strings represented by this history | |
45 | * entry | |
46 | */ | |
47 | private int urlIndex; | |
48 | ||
49 | /** | |
50 | * The result model represented by this history entry | |
51 | */ | |
52 | private SoftReference<TableModel> results; | |
53 | ||
54 | /** | |
55 | * Create a history instance. | |
56 | * | |
57 | * @param pSQLIndex | |
58 | * The index in the list of SQL statements | |
59 | * @param pURLIndex | |
60 | * The index in the list of connection strings | |
61 | * @param pResults | |
62 | * The result model | |
63 | */ | |
64 | 1039 | public QueryInfo(int pSQLIndex, int pURLIndex, TableModel pResults) { |
65 | 1039 | setSQLIndex(pSQLIndex); |
66 | 1039 | setURLIndex(pURLIndex); |
67 | 1039 | setResults(pResults); |
68 | 1039 | } |
69 | ||
70 | /** | |
71 | * Set the index in the list of connection strings represented by this history | |
72 | * instance. | |
73 | * | |
74 | * @param pURLIndex | |
75 | * The index value | |
76 | */ | |
77 | public void setURLIndex(int pURLIndex) { | |
78 | 1041 | urlIndex = pURLIndex; |
79 | 1041 | } |
80 | ||
81 | /** | |
82 | * Get the index in the list of connection strings represented by this history | |
83 | * instance | |
84 | * | |
85 | * @return The index value | |
86 | */ | |
87 | public int getURLIndex() { | |
88 | 4 | return urlIndex; |
89 | } | |
90 | ||
91 | /** | |
92 | * Set the index in the list of SQL statements represented by this history | |
93 | * instance | |
94 | * | |
95 | * @param pSQLIndex | |
96 | * The index value | |
97 | */ | |
98 | public void setSQLIndex(int pSQLIndex) { | |
99 | 1041 | sqlIndex = pSQLIndex; |
100 | 1041 | } |
101 | ||
102 | /** | |
103 | * Get the index in the list of SQL statements represented by this history | |
104 | * instance | |
105 | * | |
106 | * @return The index value | |
107 | */ | |
108 | public int getSQLIndex() { | |
109 | 4099 | return sqlIndex; |
110 | } | |
111 | ||
112 | /** | |
113 | * Set the result model represented by this history instance | |
114 | * | |
115 | * @param pResults | |
116 | * The result model | |
117 | */ | |
118 | public void setResults(TableModel pResults) { | |
119 | 1041 | results = new SoftReference<TableModel>(pResults); |
120 | 1041 | } |
121 | ||
122 | /** | |
123 | * Set the result model represented by this history instance. This may be null | |
124 | * if the reference was released due to a low memory condition. | |
125 | * | |
126 | * @return The result model or null if the reference was freed | |
127 | */ | |
128 | public TableModel getResults() { | |
129 | 4 | return results.get(); |
130 | } | |
131 | } |