Clover coverage report - DynamicJava Test Coverage (dynamicjava-20120303-r5436)
Coverage timestamp: Sat Mar 3 2012 03:02:19 CST
file stats: LOC: 186   Methods: 18
NCLOC: 72   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
InnerAllocation.java 14.3% 42.4% 44.4% 36.9%
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 *inner class* allocation nodes of the syntax tree
 39    *
 40    * @author Stephane Hillion
 41    * @version 1.0 - 1999/04/25
 42    */
 43   
 44    public class InnerAllocation extends PrimaryExpression implements StatementExpression, ExpressionContainer {
 45    private Expression expression;
 46    private Option<List<TypeName>> typeArgs;
 47    private String className;
 48    private Option<List<TypeName>> classTypeArgs;
 49    private List<Expression> arguments;
 50   
 51    /**
 52    * Initializes the expression
 53    * @param exp the outer object
 54    * @param targs the constructor's type arguments
 55    * @param cn the inner class name
 56    * @param ctargs the inner class's type arguments
 57    * @param args the arguments of the constructor. null if no arguments.
 58    * @exception IllegalArgumentException if exp is null or tp is null
 59    */
 60  0 public InnerAllocation(Expression exp, Option<List<TypeName>> targs, String cn,
 61    Option<List<TypeName>> ctargs, List<? extends Expression> args) {
 62  0 this(exp, targs, cn, ctargs, args, SourceInfo.NONE);
 63    }
 64   
 65    /**
 66    * Initializes the expression
 67    * @param exp the outer object
 68    * @param cn the inner class name
 69    * @param ctargs the inner class's type arguments
 70    * @param args the arguments of the constructor. null if no arguments.
 71    * @exception IllegalArgumentException if exp is null or tp is null
 72    */
 73  1 public InnerAllocation(Expression exp, String cn, Option<List<TypeName>> ctargs, List<? extends Expression> args) {
 74  1 this(exp, Option.<List<TypeName>>none(), cn, ctargs, args, SourceInfo.NONE);
 75    }
 76   
 77    /**
 78    * Initializes the expression
 79    * @param exp the outer object
 80    * @param cn the inner class name
 81    * @param ctargs the inner class's type arguments
 82    * @param args the arguments of the constructor. null if no arguments.
 83    * @exception IllegalArgumentException if exp is null or cn is null
 84    */
 85  0 public InnerAllocation(Expression exp, String cn, Option<List<TypeName>> ctargs, List<? extends Expression> args,
 86    SourceInfo si) {
 87  0 this(exp, Option.<List<TypeName>>none(), cn, ctargs, args, si);
 88    }
 89   
 90    /**
 91    * Initializes the expression
 92    * @param exp the outer object
 93    * @param targs the constructor type arguments
 94    * @param cn the inner class name
 95    * @param ctargs the inner class's type arguments
 96    * @param args the arguments of the constructor. null if no arguments.
 97    * @exception IllegalArgumentException if exp is null or cn is null
 98    */
 99  2 public InnerAllocation(Expression exp, Option<List<TypeName>> targs, String cn,
 100    Option<List<TypeName>> ctargs, List<? extends Expression> args,
 101    SourceInfo si) {
 102  2 super(si);
 103  0 if (targs == null || cn == null || ctargs == null || exp == null) throw new IllegalArgumentException();
 104  2 expression = exp;
 105  2 typeArgs = targs;
 106  2 className = cn;
 107  2 classTypeArgs = ctargs;
 108  2 arguments = (args == null) ? new ArrayList<Expression>(0) : new ArrayList<Expression>(args);
 109    }
 110   
 111    /**
 112    * Returns the outer class instance expression
 113    */
 114  2 public Expression getExpression() {
 115  2 return expression;
 116    }
 117   
 118    /**
 119    * Sets the outer class instance expression
 120    * @exception IllegalArgumentException if e is null
 121    */
 122  0 public void setExpression(Expression e) {
 123  0 if (e == null) throw new IllegalArgumentException("e == null");
 124  0 expression = e;
 125    }
 126   
 127  2 public Option<List<TypeName>> getTypeArgs() { return typeArgs; }
 128  0 public void setTypeArgs(List<TypeName> targs) { typeArgs = Option.wrap(targs); }
 129  0 public void setTypeArgs(Option<List<TypeName>> targs) {
 130  0 if (targs == null) throw new IllegalArgumentException();
 131  0 typeArgs = targs;
 132    }
 133   
 134    /**
 135    * Returns the inner class name
 136    */
 137  2 public String getClassName() {
 138  2 return className;
 139    }
 140   
 141    /**
 142    * Sets the inner class name
 143    * @exception IllegalArgumentException if cn is null
 144    */
 145  0 public void setClassName(String cn) {
 146  0 if (cn == null) throw new IllegalArgumentException("cn == null");
 147  0 className = cn;
 148    }
 149   
 150  2 public Option<List<TypeName>> getClassTypeArgs() { return classTypeArgs; }
 151  0 public void setClassTypeArgs(List<TypeName> ctargs) { classTypeArgs = Option.wrap(ctargs); }
 152  0 public void setClassTypeArgs(Option<List<TypeName>> ctargs) {
 153  0 if (ctargs == null) throw new IllegalArgumentException();
 154  0 classTypeArgs = ctargs;
 155    }
 156   
 157    /**
 158    * Returns the constructor arguments.
 159    * @return null if there is no argument.
 160    */
 161  2 public List<Expression> getArguments() {
 162  2 return arguments;
 163    }
 164   
 165    /**
 166    * Sets the constructor arguments.
 167    */
 168  0 public void setArguments(List<? extends Expression> l) {
 169  0 arguments = (l == null) ? new ArrayList<Expression>(0) : new ArrayList<Expression>(l);
 170    }
 171   
 172    /**
 173    * Allows a visitor to traverse the tree
 174    * @param visitor the visitor to accept
 175    */
 176  0 public <T> T acceptVisitor(Visitor<T> visitor) {
 177  0 return visitor.visit(this);
 178    }
 179    /**
 180    * Implementation of toString for use in unit testing
 181    */
 182  2 public String toString() {
 183  2 return "("+getClass().getName()+": "+getTypeArgs()+" "+getClassName()+" "+getClassTypeArgs()+" "+
 184    getExpression()+" "+getArguments()+")";
 185    }
 186    }