Clover coverage report - DynamicJava Test Coverage (dynamicjava-20120303-r5436)
Coverage timestamp: Sat Mar 3 2012 03:02:19 CST
file stats: LOC: 144   Methods: 10
NCLOC: 46   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
InterfaceDeclaration.java 25% 40% 50% 41.4%
coverage coverage
 1    /*
 2    * DynamicJava - Copyright (C) 1999-2001
 3    *
 4    * Permission is hereby granted, free of charge, to any person obtaining a
 5    * copy of this software and associated documentation files
 6    * (the "Software"), to deal in the Software without restriction, including
 7    * without limitation the rights to use, copy, modify, merge, publish,
 8    * distribute, sublicense, and/or sell copies of the Software, and to permit
 9    * persons to whom the Software is furnished to do so, subject to the
 10    * following conditions:
 11    * The above copyright notice and this permission notice shall be included
 12    * in all copies or substantial portions of the Software.
 13    *
 14    * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 15    * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 16    * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 17    * IN NO EVENT SHALL DYADE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 18    * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 19    * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 20    * DEALINGS IN THE SOFTWARE.
 21    *
 22    * Except as contained in this notice, the name of Dyade shall not be
 23    * used in advertising or otherwise to promote the sale, use or other
 24    * dealings in this Software without prior written authorization from
 25    * Dyade.
 26    *
 27    */
 28   
 29    package koala.dynamicjava.tree;
 30   
 31    import java.util.*;
 32   
 33    import edu.rice.cs.plt.tuple.Option;
 34   
 35    import koala.dynamicjava.tree.tiger.TypeParameter;
 36    import koala.dynamicjava.tree.visitor.*;
 37   
 38    /**
 39    * This class represents an interface declaration
 40    *
 41    * @author Stephane Hillion
 42    * @version 1.0 - 1999/05/27
 43    */
 44   
 45    public class InterfaceDeclaration extends TypeDeclaration {
 46   
 47    private boolean annotation;
 48   
 49    /**
 50    * Creates a new interface declaration
 51    * @param mods the modifiers
 52    * @param ann whether this is an annotation
 53    * @param name the name of the interface to declare
 54    * @param tparams type parameters
 55    * @param impl the list of implemented interfaces. Can be null.
 56    * @param body the list of fields declarations
 57    */
 58  0 public InterfaceDeclaration(ModifierSet mods, boolean ann, String name, Option<List<TypeParameter>> tparams,
 59    List<? extends ReferenceTypeName> impl, List<Node> body) {
 60  0 this(mods, ann, name, tparams, impl, body, SourceInfo.NONE);
 61    }
 62   
 63    /**
 64    * Creates a new interface declaration
 65    * @param mods the modifiers
 66    * @param ann whether this is an annotation
 67    * @param name the name of the interface to declare
 68    * @param impl the list of implemented interfaces. Can be null.
 69    * @param body the list of fields declarations
 70    */
 71  0 public InterfaceDeclaration(ModifierSet mods, boolean ann, String name,
 72    List<? extends ReferenceTypeName> impl, List<Node> body) {
 73  0 this(mods, ann, name, Option.<List<TypeParameter>>none(), impl, body, SourceInfo.NONE);
 74    }
 75   
 76    /**
 77    * Creates a new interface declaration
 78    * @param mods the modifiers
 79    * @param ann whether this is an annotation
 80    * @param name the name of the interface to declare
 81    * @param tparams type parameters
 82    * @param impl the list of implemented interfaces. Can be null.
 83    * @param body the list of fields declarations
 84    */
 85  2 public InterfaceDeclaration(ModifierSet mods, boolean ann, String name, Option<List<TypeParameter>> tparams,
 86    List<? extends ReferenceTypeName> impl, List<Node> body, SourceInfo si) {
 87  2 super(mods, name, tparams, ann ? addAnnotationType(impl, si) : impl, body, si);
 88  2 annotation = ann;
 89    }
 90   
 91  0 private static List<ReferenceTypeName> addAnnotationType(List<? extends ReferenceTypeName> impl, SourceInfo si) {
 92  0 List<ReferenceTypeName> result = new ArrayList<ReferenceTypeName>();
 93  0 result.add(new ReferenceTypeName(new String[]{ "java", "lang", "annotation", "Annotation" }, si));
 94  0 if (impl != null) { result.addAll(impl); }
 95  0 return result;
 96    }
 97   
 98    /**
 99    * Creates a new interface declaration
 100    * @param mods the modifiers
 101    * @param ann whether this is an annotation
 102    * @param name the name of the interface to declare
 103    * @param impl the list of implemented interfaces. Can be null.
 104    * @param body the list of fields declarations
 105    */
 106  1 public InterfaceDeclaration(ModifierSet mods, boolean ann, String name,
 107    List<? extends ReferenceTypeName> impl, List<Node> body, SourceInfo si) {
 108  1 this(mods, ann, name, Option.<List<TypeParameter>>none(), impl, body, si);
 109    }
 110   
 111    /**
 112    * Whether this is an annotation declaration.
 113    */
 114  2 public boolean isAnnotation() {
 115  2 return annotation;
 116    }
 117   
 118    /**
 119    * Sets whether this is an annotation declaration.
 120    * @exception IllegalArgumentException if s is null
 121    */
 122  0 public void setIsAnnotation(boolean ann) {
 123  0 annotation = ann;
 124    }
 125   
 126   
 127    /**
 128    * Allows a visitor to traverse the tree
 129    * @param visitor the visitor to accept
 130    */
 131  0 public <T> T acceptVisitor(Visitor<T> visitor) {
 132  0 return visitor.visit(this);
 133    }
 134    /**
 135    * Implementation of toString for use in unit testing
 136    */
 137  2 public String toString() {
 138  2 return "("+getClass().getName()+": "+toStringHelper()+")";
 139    }
 140   
 141  2 protected String toStringHelper() {
 142  2 return getModifiers()+" "+isAnnotation()+" "+getName()+" "+getTypeParams()+" "+getInterfaces()+" "+getMembers();
 143    }
 144    }