-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQueries.java
More file actions
executable file
·46 lines (40 loc) · 1.08 KB
/
Queries.java
File metadata and controls
executable file
·46 lines (40 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package devinfalgoust.sqlquerygenerator;
import java.util.List;
import java.util.ArrayList;
/**
* This is a Generic class that houses a list of Query objects.
* It's main purpose is to house a series of queries and print
* them all simultaneously using its generateAll function.
*
* @author Devin Falgoust
*/
public class Queries {
// List of Query objects
private List<Query> queries;
// Constructor initializing the List of Query objects
public Queries() {
queries = new ArrayList<Query>();
}
/**
* This function returns a String holding all of the Strings
* generated by each Query's generate function, all sepearated
* by a newline.
*
* @return
*/
public String generateAll() {
StringBuilder all = new StringBuilder();
for (Query query : queries) {
all.append(query.generate()).append("\n");
}
return all.toString();
}
/**
* This function allows you to add a Query to the List
*
* @param query - Query object to add to the List
*/
public void addQuery(Query query) {
queries.add(query);
}
}