Clover coverage report - DynamicJava Test Coverage (dynamicjava-20110903-r5436)
Coverage timestamp: Sat Sep 3 2011 03:02:20 CDT
file stats: LOC: 128   Methods: 8
NCLOC: 36   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
AnonymousAllocation.java 25% 46.2% 50% 44%
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.visitor.*;
 36   
 37    /**
 38    * This class represents the anonymous class allocation nodes of the syntax tree.
 39    * Nodes are derived from syntax like "new Foo(x, y+3, z.method()) { void bar() {} }"
 40    *
 41    * @author Stephane Hillion
 42    * @version 1.0 - 1999/04/25
 43    */
 44   
 45    public class AnonymousAllocation extends SimpleAllocation implements StatementExpression {
 46    /**
 47    * The members of the anonymous class
 48    */
 49    private List<Node> members;
 50   
 51    /**
 52    * Initializes the expression
 53    * @param tp the type prefix
 54    * @param args the arguments of the constructor. Can be null.
 55    * @param memb the members of the class
 56    * @exception IllegalArgumentException if tp is null or memb is null
 57    */
 58  1 public AnonymousAllocation(ReferenceTypeName tp, List<? extends Expression> args, List<Node> memb) {
 59  1 this(Option.<List<TypeName>>none(), tp, args, memb, SourceInfo.NONE);
 60    }
 61   
 62    /**
 63    * Initializes the expression
 64    * @param tp the type prefix
 65    * @param args the arguments of the constructor. Can be null.
 66    * @param memb the members of the class
 67    * @exception IllegalArgumentException if tp is null or memb is null
 68    */
 69  0 public AnonymousAllocation(Option<List<TypeName>> targs, ReferenceTypeName tp, List<? extends Expression> args,
 70    List<Node> memb) {
 71  0 this(targs, tp, args, memb, SourceInfo.NONE);
 72    }
 73   
 74    /**
 75    * Initializes the expression
 76    * @param tp the type prefix
 77    * @param args the arguments of the constructor. null if no arguments.
 78    * @param memb the members of the class
 79    * @exception IllegalArgumentException if tp is null or memb is null
 80    */
 81  0 public AnonymousAllocation(ReferenceTypeName tp, List<? extends Expression> args, List<Node> memb, SourceInfo si) {
 82  0 this(Option.<List<TypeName>>none(), tp, args, memb, si);
 83    }
 84   
 85    /**
 86    * Initializes the expression
 87    * @param tp the type prefix
 88    * @param args the arguments of the constructor. null if no arguments.
 89    * @param memb the members of the class
 90    * @exception IllegalArgumentException if tp is null or memb is null
 91    */
 92  2 public AnonymousAllocation(Option<List<TypeName>> targs, ReferenceTypeName tp, List<? extends Expression> args,
 93    List<Node> memb, SourceInfo si) {
 94  2 super(targs, tp, args, si);
 95  0 if (memb == null) throw new IllegalArgumentException("memb == null");
 96  2 members = memb;
 97    }
 98   
 99    /**
 100    * Returns the members of the anonymous class
 101    */
 102  2 public List<Node> getMembers() {
 103  2 return members;
 104    }
 105   
 106    /**
 107    * Sets the members of the anonymous class
 108    * @exception IllegalArgumentException if t is null
 109    */
 110  0 public void setMembers(List<Node> l) {
 111  0 if (l == null) throw new IllegalArgumentException("l == null");
 112  0 members = l;
 113    }
 114   
 115    /**
 116    * Allows a visitor to traverse the tree
 117    * @param visitor the visitor to accept
 118    */
 119  0 public <T> T acceptVisitor(Visitor<T> visitor) {
 120  0 return visitor.visit(this);
 121    }
 122    /**
 123    * Implementation of toString for use in unit testing
 124    */
 125  2 public String toString() {
 126  2 return "("+getTypeArgs()+" "+getClass().getName()+": "+getCreationType()+" "+getArguments()+" "+getMembers()+")";
 127    }
 128    }