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 Lost class is a {@link Snapshot} that enumerates the lost
27 * tuples rather than the added tuples, and it also treats adding and
28 * removing like {@link Not}.
30 public class Lost extends Snapshot {
35 public Lost(Query q) {
40 * Alternative constructor with synchronization object.
42 public Lost(Object s,Query q) {
47 * The {@link Query#copy} method implemented by creating a new
48 * Lost with a copy of the monitored {@link #query}, and sharing
49 * any {@link #sync} object.
51 public Query copy(Vector/*<Ref>*/ newrefs) throws Exception {
52 return new Lost( sync, query.copy( newrefs ) );
56 * The {@link Query#reset} method implemented by forwarding to the
59 public void reset() throws Exception {
61 bindings = lost.iterator();
65 * Implements {@link Query#addable} by calling {@link
66 * Query#removable} on the wrapped query.
68 public boolean addable() {
69 return query.removable();
73 * Implements {@link Query#add} by calling {@link Query#remove} on
76 public boolean add() {
77 return query.remove();
81 * Implements {@link Query#removable} by calling {@link
82 * Query#addable} on the wrapped query.
84 public boolean removable() {
85 return query.addable();
89 * Implements {@link Query#remove} by calling {@link Query#add} on
92 public boolean remove() {
97 * Returns the textual representation of the wrapped query, within
100 public String toString() {
101 return "Lost(" + query + ")";