01: package net.refractions.udig.ui.operations;
02:
03: import java.util.ArrayList;
04: import java.util.List;
05:
06: /**
07: * Represents the Or element in the operation extension point.
08: * @author jones
09: * @since 1.1.0
10: */
11: public class Or implements OpFilter {
12:
13: private List<OpFilter> filters = new ArrayList<OpFilter>();
14:
15: /**
16: * @return Returns the filters.
17: */
18: public List<OpFilter> getFilters() {
19: return filters;
20: }
21:
22: public boolean accept(Object object) {
23: for (OpFilter filter : filters) {
24: if (filter.accept(object))
25: return true;
26: }
27: return false;
28: }
29:
30: public void addListener(IOpFilterListener listener) {
31: for (OpFilter filter : filters) {
32: filter.addListener(listener);
33: }
34: }
35:
36: public boolean canCacheResult() {
37: for (OpFilter filter : filters) {
38: if (!filter.canCacheResult())
39: return false;
40: }
41:
42: return true;
43: }
44:
45: public boolean isBlocking() {
46: for (OpFilter filter : filters) {
47: if (filter.isBlocking())
48: return true;
49: }
50:
51: return false;
52: }
53:
54: public void removeListener(IOpFilterListener listener) {
55: for (OpFilter filter : filters) {
56: filter.removeListener(listener);
57: }
58: }
59:
60: }
|