Clover coverage report - Code Coverage for hivemind release 1.0-beta-1
Coverage timestamp: Sat Jul 3 2004 09:41:37 EDT
file stats: LOC: 62   Methods: 2
NCLOC: 24   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
CompositeFilter.java 100% 100% 100% 100%
coverage
 1   
 //  Copyright 2004 The Apache Software Foundation
 2   
 //
 3   
 // Licensed under the Apache License, Version 2.0 (the "License");
 4   
 // you may not use this file except in compliance with the License.
 5   
 // You may obtain a copy of the License at
 6   
 //
 7   
 //     http://www.apache.org/licenses/LICENSE-2.0
 8   
 //
 9   
 // Unless required by applicable law or agreed to in writing, software
 10   
 // distributed under the License is distributed on an "AS IS" BASIS,
 11   
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12   
 // See the License for the specific language governing permissions and
 13   
 // limitations under the License.
 14   
 
 15   
 package org.apache.hivemind.methodmatch;
 16   
 
 17   
 import java.lang.reflect.Method;
 18   
 import java.util.Iterator;
 19   
 import java.util.List;
 20   
 
 21   
 import org.apache.hivemind.service.MethodSignature;
 22   
 
 23   
 /**
 24   
  * Runs a suite of {@link org.apache.hivemind.methodmatch.MethodFilter}s, returning
 25   
  * true only if each filter does. The tests short-circuit with the first filter
 26   
  * to return false.
 27   
  *
 28   
  * @author Howard Lewis Ship
 29   
  */
 30   
 public class CompositeFilter extends MethodFilter
 31   
 {
 32   
     private List _filters;
 33   
 
 34   
     /**
 35   
      * Creates a new composite filter; the list passed in is <em>retained not copied</em>
 36   
      * and should not be changed futher by the caller.
 37   
      * 
 38   
      * @param filters {@link List} of {@link MethodFilter}.
 39   
      */
 40  4
     public CompositeFilter(List filters)
 41   
     {
 42  4
         _filters = filters;
 43   
     }
 44   
 
 45  6
     public boolean matchMethod(MethodSignature sig)
 46   
     {
 47  6
         Iterator i = _filters.iterator();
 48  6
         while (i.hasNext())
 49   
         {
 50  11
             MethodFilter mf = (MethodFilter) i.next();
 51   
 
 52  11
             if (!mf.matchMethod(sig))
 53  3
                 return false;
 54   
         }
 55   
 
 56   
         // All matches!
 57   
 
 58  3
         return true;
 59   
     }
 60   
 
 61   
 }
 62