Clover coverage report - Ant Coverage
Coverage timestamp: Tue Apr 8 2003 20:43:55 EST
file stats: LOC: 175   Methods: 16
NCLOC: 82   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
FilterChain.java 50% 75% 81.2% 75%
 1   
 /*
 2   
  * The Apache Software License, Version 1.1
 3   
  *
 4   
  * Copyright (c) 2002-2003 The Apache Software Foundation.  All rights
 5   
  * reserved.
 6   
  *
 7   
  * Redistribution and use in source and binary forms, with or without
 8   
  * modification, are permitted provided that the following conditions
 9   
  * are met:
 10   
  *
 11   
  * 1. Redistributions of source code must retain the above copyright
 12   
  *    notice, this list of conditions and the following disclaimer.
 13   
  *
 14   
  * 2. Redistributions in binary form must reproduce the above copyright
 15   
  *    notice, this list of conditions and the following disclaimer in
 16   
  *    the documentation and/or other materials provided with the
 17   
  *    distribution.
 18   
  *
 19   
  * 3. The end-user documentation included with the redistribution, if
 20   
  *    any, must include the following acknowlegement:
 21   
  *       "This product includes software developed by the
 22   
  *        Apache Software Foundation (http://www.apache.org/)."
 23   
  *    Alternately, this acknowlegement may appear in the software itself,
 24   
  *    if and wherever such third-party acknowlegements normally appear.
 25   
  *
 26   
  * 4. The names "Ant" and "Apache Software
 27   
  *    Foundation" must not be used to endorse or promote products derived
 28   
  *    from this software without prior written permission. For written
 29   
  *    permission, please contact apache@apache.org.
 30   
  *
 31   
  * 5. Products derived from this software may not be called "Apache"
 32   
  *    nor may "Apache" appear in their names without prior written
 33   
  *    permission of the Apache Group.
 34   
  *
 35   
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 36   
  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 37   
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 38   
  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 39   
  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 40   
  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 41   
  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 42   
  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 43   
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 44   
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 45   
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 46   
  * SUCH DAMAGE.
 47   
  * ====================================================================
 48   
  *
 49   
  * This software consists of voluntary contributions made by many
 50   
  * individuals on behalf of the Apache Software Foundation.  For more
 51   
  * information on the Apache Software Foundation, please see
 52   
  * <http://www.apache.org/>.
 53   
  */
 54   
 package org.apache.tools.ant.types;
 55   
 
 56   
 import java.util.Vector;
 57   
 import org.apache.tools.ant.BuildException;
 58   
 import org.apache.tools.ant.filters.ClassConstants;
 59   
 import org.apache.tools.ant.filters.EscapeUnicode;
 60   
 import org.apache.tools.ant.filters.ExpandProperties;
 61   
 import org.apache.tools.ant.filters.HeadFilter;
 62   
 import org.apache.tools.ant.filters.LineContains;
 63   
 import org.apache.tools.ant.filters.LineContainsRegExp;
 64   
 import org.apache.tools.ant.filters.PrefixLines;
 65   
 import org.apache.tools.ant.filters.ReplaceTokens;
 66   
 import org.apache.tools.ant.filters.StripJavaComments;
 67   
 import org.apache.tools.ant.filters.StripLineBreaks;
 68   
 import org.apache.tools.ant.filters.StripLineComments;
 69   
 import org.apache.tools.ant.filters.TabsToSpaces;
 70   
 import org.apache.tools.ant.filters.TailFilter;
 71   
 
 72   
 /**
 73   
  * FilterChain may contain a chained set of filter readers.
 74   
  *
 75   
  * @author Magesh Umasankar
 76   
  */
 77   
 public final class FilterChain extends DataType implements Cloneable {
 78   
 
 79   
     private Vector filterReaders = new Vector();
 80   
 
 81  3
     public final void addFilterReader(final AntFilterReader filterReader) {
 82  3
         filterReaders.addElement(filterReader);
 83   
     }
 84   
 
 85  16
     public final Vector getFilterReaders() {
 86  16
         return filterReaders;
 87   
     }
 88   
 
 89  0
     public final void addClassConstants(final ClassConstants classConstants) {
 90  0
         filterReaders.addElement(classConstants);
 91   
     }
 92   
 
 93  2
     public final void addExpandProperties(final ExpandProperties expandProperties) {
 94  2
         filterReaders.addElement(expandProperties);
 95   
     }
 96   
 
 97  1
     public final void addHeadFilter(final HeadFilter headFilter) {
 98  1
         filterReaders.addElement(headFilter);
 99   
     }
 100   
 
 101  1
     public final void addLineContains(final LineContains lineContains) {
 102  1
         filterReaders.addElement(lineContains);
 103   
     }
 104   
 
 105  0
     public final void addLineContainsRegExp(final LineContainsRegExp
 106   
                                                 lineContainsRegExp) {
 107  0
         filterReaders.addElement(lineContainsRegExp);
 108   
     }
 109   
 
 110  1
     public final void addPrefixLines(final PrefixLines prefixLines) {
 111  1
         filterReaders.addElement(prefixLines);
 112   
     }
 113   
 
 114  6
     public final void addReplaceTokens(final ReplaceTokens replaceTokens) {
 115  6
         filterReaders.addElement(replaceTokens);
 116   
     }
 117   
 
 118  1
     public final void addStripJavaComments(final StripJavaComments
 119   
                                                 stripJavaComments) {
 120  1
         filterReaders.addElement(stripJavaComments);
 121   
     }
 122   
 
 123  1
     public final void addStripLineBreaks(final StripLineBreaks
 124   
                                                 stripLineBreaks) {
 125  1
         filterReaders.addElement(stripLineBreaks);
 126   
     }
 127   
 
 128  2
     public final void addStripLineComments(final StripLineComments
 129   
                                                 stripLineComments) {
 130  2
         filterReaders.addElement(stripLineComments);
 131   
     }
 132   
 
 133  0
     public final void addTabsToSpaces(final TabsToSpaces tabsToSpaces) {
 134  0
         filterReaders.addElement(tabsToSpaces);
 135   
     }
 136   
 
 137  1
     public final void addTailFilter(final TailFilter tailFilter) {
 138  1
         filterReaders.addElement(tailFilter);
 139   
     }
 140   
 
 141   
     /**
 142   
      * @since Ant 1.6
 143   
      */
 144  1
     public final void addEscapeUnicode(final EscapeUnicode escapeUnicode) {
 145  1
         filterReaders.addElement(escapeUnicode);
 146   
     }
 147   
 
 148   
     /**
 149   
      * Makes this instance in effect a reference to another FilterChain 
 150   
      * instance.
 151   
      *
 152   
      * <p>You must not set another attribute or nest elements inside
 153   
      * this element if you make it a reference.</p>
 154   
      *
 155   
      * @param r the reference to which this instance is associated
 156   
      * @exception BuildException if this instance already has been configured.
 157   
      */
 158  1
     public void setRefid(Reference r) throws BuildException {
 159  1
         if (!filterReaders.isEmpty()) {
 160  0
             throw tooManyAttributes();
 161   
         }
 162   
         // change this to get the objects from the other reference
 163  1
         Object o = r.getReferencedObject(getProject());
 164  1
         if (o instanceof FilterChain) {
 165  1
             FilterChain fc = (FilterChain) o;
 166  1
             filterReaders = fc.getFilterReaders();
 167   
         } else {
 168  0
             String msg = r.getRefId() + " doesn\'t refer to a FilterChain";
 169  0
             throw new BuildException(msg);
 170   
         }
 171   
 
 172  1
         super.setRefid(r);
 173   
     }
 174   
 }
 175