1 /*--------------------------------------------------------------------------
\r
2 * Copyright 2009 Taro L. Saito
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
15 *--------------------------------------------------------------------------*/
\r
16 //--------------------------------------
\r
17 // Xerial Raquel Project
\r
20 // Since: 2009/03/15 14:13:50
\r
22 // $URL: http://www.xerial.org/svn/project/XerialJ/trunk/xerial-core/src/main/java/org/xerial/lens/relation/query/QuerySet.java $
\r
24 //--------------------------------------
\r
25 package org.xerial.lens.relation.query;
\r
27 import java.util.ArrayList;
\r
28 import java.util.Collection;
\r
29 import java.util.HashSet;
\r
30 import java.util.List;
\r
31 import java.util.Set;
\r
33 import org.xerial.lens.relation.schema.Schema;
\r
34 import org.xerial.util.IndexedSet;
\r
37 * Set of target queries for the stream amoeba join.
\r
42 public class QuerySet {
\r
43 private IndexedSet<Schema> queryTarget = new IndexedSet<Schema>();
\r
44 private Set<String> treeNodeSet = new HashSet<String>();
\r
46 public QuerySet() {}
\r
48 private QuerySet(Collection<Schema> schemaSet) {
\r
49 for (Schema eachSchema : schemaSet) {
\r
50 queryTarget.add(eachSchema);
\r
54 public Set<Schema> getTargetQuerySet() {
\r
58 public boolean isTreeNode(String nodeName) {
\r
59 return treeNodeSet.contains(nodeName);
\r
63 public String toString() {
\r
64 return queryTarget.toString();
\r
67 public static class QuerySetBuilder {
\r
68 List<Schema> schemaList = new ArrayList<Schema>();
\r
69 Set<String> treeNodeSet = new HashSet<String>();
\r
71 public void addTreeNode(String treeNode) {
\r
72 treeNodeSet.add(treeNode);
\r
75 public void addQueryTarget(Schema schema) {
\r
76 schemaList.add(schema);
\r
79 public QuerySet build() {
\r
80 return new QuerySet(schemaList);
\r