KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > maven > artifact > resolver > filter > AndArtifactFilter


1 package org.apache.maven.artifact.resolver.filter;
2
3 /*
4  * Copyright 2001-2005 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18
19 import org.apache.maven.artifact.Artifact;
20
21 import java.util.ArrayList JavaDoc;
22 import java.util.Iterator JavaDoc;
23 import java.util.List JavaDoc;
24
25 /**
26  * Apply multiple filters.
27  *
28  * @author <a HREF="mailto:brett@apache.org">Brett Porter</a>
29  * @version $Id: AndArtifactFilter.java 163923 2005-04-13 04:29:25Z brett $
30  */

31 public class AndArtifactFilter
32     implements ArtifactFilter
33 {
34     private final List JavaDoc filters = new ArrayList JavaDoc();
35
36     public boolean include( Artifact artifact )
37     {
38         boolean include = true;
39         for ( Iterator JavaDoc i = filters.iterator(); i.hasNext() && include; )
40         {
41             ArtifactFilter filter = (ArtifactFilter) i.next();
42             if ( !filter.include( artifact ) )
43             {
44                 include = false;
45             }
46         }
47         return include;
48     }
49
50     public void add( ArtifactFilter artifactFilter )
51     {
52         filters.add( artifactFilter );
53     }
54 }
55
Popular Tags