root / branches / Mobile_Compatible_Hito_1 / libFMap_data / src / org / gvsig / data / vectorial / filter / AndImpl.java @ 21563
History | View | Annotate | Download (1.58 KB)
1 |
/*
|
---|---|
2 |
* GeoTools - OpenSource mapping toolkit
|
3 |
* http://geotools.org
|
4 |
* (C) 2006, GeoTools Project Managment Committee (PMC)
|
5 |
*
|
6 |
* This library is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU Lesser General Public
|
8 |
* License as published by the Free Software Foundation;
|
9 |
* version 2.1 of the License.
|
10 |
*
|
11 |
* This library is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 |
* Lesser General Public License for more details.
|
15 |
*/
|
16 |
package org.gvsig.data.vectorial.filter; |
17 |
|
18 |
import java.util.Iterator; |
19 |
import java.util.List; |
20 |
|
21 |
import org.opengis.filter.And; |
22 |
import org.opengis.filter.Filter; |
23 |
import org.opengis.filter.FilterVisitor; |
24 |
|
25 |
/**
|
26 |
* Direct implementation of And filter.
|
27 |
*
|
28 |
* @author jdeolive
|
29 |
* @author jcarrasco
|
30 |
*/
|
31 |
public class AndImpl implements And { |
32 |
/**
|
33 |
* list of filters
|
34 |
*/
|
35 |
List children;
|
36 |
|
37 |
protected AndImpl(List children) { |
38 |
this.children = children;
|
39 |
} |
40 |
|
41 |
public boolean evaluate( Object object ) { |
42 |
for (Iterator itr = children.iterator(); itr.hasNext();) { |
43 |
Filter filter = (Filter) itr.next(); |
44 |
if( !filter.evaluate( object )) {
|
45 |
return false; // short circuit |
46 |
} |
47 |
} |
48 |
return true; |
49 |
} |
50 |
|
51 |
public Object accept(FilterVisitor visitor, Object extraData) { |
52 |
return visitor.visit(this,extraData); |
53 |
} |
54 |
|
55 |
public List getChildren() { |
56 |
return children;
|
57 |
} |
58 |
} |
59 |
|