1 /*********************************************************************
2 Copyright 2012, Ralph Ronnquist.
4 This file is part of GORITE.
6 GORITE is free software: you can redistribute it and/or modify it
7 under the terms of the Lesser GNU General Public License as published
8 by the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 GORITE is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the Lesser GNU General Public
17 License along with GORITE. If not, see <http://www.gnu.org/licenses/>.
18 **********************************************************************/
20 package com.intendico.data;
22 import java.util.Observer;
23 import java.util.Vector;
26 * The QueryBase class is a wrapper class that provides transparent
27 * implementations for the {@link Query} methods. It is intended to be
28 * base class for simple query implementations that only need to
29 * override one or a few of the implementations, typically the
32 public class QueryBase implements Query {
35 * Holds a/the sub query wrapped by this QueryBase.
48 public QueryBase(Query q) {
53 * The {@link Query#copy} method implemented by returning this
56 public Query copy(Vector/*<Ref>*/ newrefs) throws Exception {
61 * The {@link Query#reset} method implemented by forwarding to the
64 public void reset() throws Exception {
69 * The {@link Query#next} method implemented by forwarding to the
72 public boolean next() throws Exception {
77 * The {@link Query#getRefs} method implemented by forwarding to the
80 public Vector/*<Ref>*/ getRefs(Vector/*<Ref>*/ v) {
81 return query.getRefs( v );
85 * The {@link Query#addObserver} method implemented by forwarding
86 * to the wrapped query.
88 public void addObserver(Observer x) {
89 query.addObserver( x );
93 * The {@link Query#deleteObserver} method implemented by
94 * forwarding to the wrapped query.
96 public void deleteObserver(Observer x) {
97 query.deleteObserver( x );
101 * The {@link Query#addable} method implemented by forwarding to
104 public boolean addable() {
105 return query.addable();
109 * The {@link Query#add} method implemented by forwarding to the
112 public boolean add() {
117 * The {@link Query#removable} method implemented by forwarding to
120 public boolean removable() {
121 return query.removable();
125 * The {@link Query#remove} method implemented by forwarding to
128 public boolean remove() {
129 return query.remove();
133 * Returns the textual representation of the wrapped query, within
136 public String toString() {
137 return "(" + query + ")";