Clover coverage report - DynamicJava Test Coverage (dynamicjava-20120303-r5436)
Coverage timestamp: Sat Mar 3 2012 03:02:19 CST
file stats: LOC: 145   Methods: 13
NCLOC: 51   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
SimpleAllocation.java 40% 54.5% 61.5% 53.3%
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 regular allocation nodes of the syntax tree.
 39    * Nodes are derived from syntax like "new Foo(x, y+3, z.method())"
 40    *
 41    * @author Stephane Hillion
 42    * @version 1.0 - 1999/04/25
 43    */
 44   
 45    public class SimpleAllocation extends PrimaryExpression implements StatementExpression {
 46    private Option<List<TypeName>> typeArgs;
 47    private ReferenceTypeName creationType;
 48    private List<Expression> arguments;
 49   
 50    /**
 51    * Initializes the expression
 52    * @param tp the type prefix
 53    * @param args the arguments of the constructor
 54    * @exception IllegalArgumentException if tp is null
 55    */
 56  0 public SimpleAllocation(Option<List<TypeName>> targs, ReferenceTypeName tp, List<? extends Expression> args) {
 57  0 this(targs, tp, args, SourceInfo.NONE);
 58    }
 59   
 60    /**
 61    * Initializes the expression
 62    * @param tp the type prefix
 63    * @param args the arguments of the constructor
 64    * @exception IllegalArgumentException if tp is null
 65    */
 66  10 public SimpleAllocation(ReferenceTypeName tp, List<? extends Expression> args) {
 67  10 this(Option.<List<TypeName>>none(), tp, args, SourceInfo.NONE);
 68    }
 69   
 70    /**
 71    * Initializes the expression
 72    * @param tp the type prefix
 73    * @param args the arguments of the constructor
 74    * @exception IllegalArgumentException if tp is null
 75    */
 76  0 public SimpleAllocation(ReferenceTypeName tp, List<? extends Expression> args, SourceInfo si) {
 77  0 this(Option.<List<TypeName>>none(), tp, args, si);
 78    }
 79   
 80    /**
 81    * Initializes the expression
 82    * @param tp the type prefix
 83    * @param args the arguments of the constructor
 84    * @exception IllegalArgumentException if tp is null
 85    */
 86  506 public SimpleAllocation(Option<List<TypeName>> targs, ReferenceTypeName tp, List<? extends Expression> args,
 87    SourceInfo si) {
 88  506 super(si);
 89  0 if (tp == null || targs == null) throw new IllegalArgumentException();
 90  506 typeArgs = targs;
 91  506 creationType = tp;
 92  506 arguments = (args == null) ? new ArrayList<Expression>(0) : new ArrayList<Expression>(args);
 93    }
 94   
 95  505 public Option<List<TypeName>> getTypeArgs() { return typeArgs; }
 96  0 public void setTypeArgs(List<TypeName> targs) { typeArgs = Option.wrap(targs); }
 97  0 public void setTypeArgs(Option<List<TypeName>> targs) {
 98  0 if (targs == null) throw new IllegalArgumentException();
 99  0 typeArgs = targs;
 100    }
 101   
 102    /**
 103    * Returns the creation type
 104    */
 105  506 public ReferenceTypeName getCreationType() {
 106  506 return creationType;
 107    }
 108   
 109    /**
 110    * Sets the creation type
 111    * @exception IllegalArgumentException if t is null
 112    */
 113  0 public void setCreationType(ReferenceTypeName t) {
 114  0 if (t == null) throw new IllegalArgumentException("t == null");
 115  0 creationType = t;
 116    }
 117   
 118    /**
 119    * Returns the constructor arguments
 120    */
 121  646 public List<Expression> getArguments() {
 122  646 return arguments;
 123    }
 124   
 125    /**
 126    * Sets the constructor arguments.
 127    */
 128  482 public void setArguments(List<? extends Expression> l) {
 129  482 arguments = (l == null) ? new ArrayList<Expression>(0) : new ArrayList<Expression>(l);
 130    }
 131   
 132    /**
 133    * Allows a visitor to traverse the tree
 134    * @param visitor the visitor to accept
 135    */
 136  625 public <T> T acceptVisitor(Visitor<T> visitor) {
 137  625 return visitor.visit(this);
 138    }
 139    /**
 140    * Implementation of toString for use in unit testing
 141    */
 142  20 public String toString() {
 143  20 return "("+getTypeArgs()+" "+getClass().getName()+": "+getCreationType()+" "+getArguments()+")";
 144    }
 145    }