1 | /** |
---|
2 | * This software is copyright (c) 2013-2016 by |
---|
3 | * - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de) |
---|
4 | * This is free software. You can redistribute it |
---|
5 | * and/or modify it under the terms described in |
---|
6 | * the GNU General Public License v3 of which you |
---|
7 | * should have received a copy. Otherwise you can download |
---|
8 | * it from |
---|
9 | * |
---|
10 | * http://www.gnu.org/licenses/gpl-3.0.txt |
---|
11 | * |
---|
12 | * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de) |
---|
13 | * |
---|
14 | * @license http://www.gnu.org/licenses/gpl-3.0.txt |
---|
15 | * GNU General Public License v3 |
---|
16 | */ |
---|
17 | package eu.clarin.sru.server.fcs.parser; |
---|
18 | |
---|
19 | import java.util.Arrays; |
---|
20 | |
---|
21 | |
---|
22 | /** |
---|
23 | * FCS-QL expression tree QUERY-WITH-WITHIN node. |
---|
24 | */ |
---|
25 | public class QueryWithWithin extends QueryNode { |
---|
26 | |
---|
27 | /** |
---|
28 | * Constructor. |
---|
29 | * |
---|
30 | * @param query |
---|
31 | * the query node |
---|
32 | * @param within |
---|
33 | * the within node |
---|
34 | */ |
---|
35 | QueryWithWithin(QueryNode query, QueryNode within) { |
---|
36 | super(QueryNodeType.QUERY_WITH_WITHIN, Arrays.asList(query, within)); |
---|
37 | } |
---|
38 | |
---|
39 | |
---|
40 | /** |
---|
41 | * Get the query clause. |
---|
42 | * |
---|
43 | * @return the query clause |
---|
44 | */ |
---|
45 | public QueryNode getQuery() { |
---|
46 | return getChild(0); |
---|
47 | } |
---|
48 | |
---|
49 | |
---|
50 | /** |
---|
51 | * Get the within clause (= search context) |
---|
52 | * |
---|
53 | * @return the witin clause |
---|
54 | */ |
---|
55 | public QueryNode getWithin() { |
---|
56 | return getChild(1); |
---|
57 | } |
---|
58 | |
---|
59 | |
---|
60 | @Override |
---|
61 | public void accept(QueryVisitor visitor) { |
---|
62 | children.get(0).accept(visitor); |
---|
63 | if (children.size() > 1) { |
---|
64 | children.get(1).accept(visitor); |
---|
65 | } |
---|
66 | visitor.visit(this); |
---|
67 | } |
---|
68 | |
---|
69 | } // class QueryWithWithin |
---|