01: /* uDig - User Friendly Desktop Internet GIS client
02: * http://udig.refractions.net
03: * (C) 2004, Refractions Research Inc.
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation;
08: * version 2.1 of the License.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: */
15: package net.refractions.udig.ui.operations;
16:
17: import java.util.ArrayList;
18: import java.util.List;
19:
20: /**
21: * Represents the Not element in the operation extension point.
22: * @author jones
23: * @since 1.1.0
24: */
25: public class And implements OpFilter {
26: private List<OpFilter> filters = new ArrayList<OpFilter>();
27:
28: /**
29: * @return Returns the filters.
30: */
31: public List<OpFilter> getFilters() {
32: return filters;
33: }
34:
35: public boolean accept(Object object) {
36: for (OpFilter filter : filters) {
37: if (!filter.accept(object))
38: return false;
39: }
40: return true;
41: }
42:
43: public void addListener(IOpFilterListener listener) {
44: for (OpFilter filter : filters) {
45: filter.addListener(listener);
46: }
47: }
48:
49: public boolean canCacheResult() {
50: for (OpFilter filter : filters) {
51: if (!filter.canCacheResult())
52: return false;
53: }
54:
55: return true;
56: }
57:
58: public boolean isBlocking() {
59: for (OpFilter filter : filters) {
60: if (filter.isBlocking())
61: return true;
62: }
63:
64: return false;
65: }
66:
67: public void removeListener(IOpFilterListener listener) {
68: for (OpFilter filter : filters) {
69: filter.removeListener(listener);
70: }
71: }
72:
73: }
|