Clover coverage report - DynamicJava Test Coverage (dynamicjava-20110903-r5436)
Coverage timestamp: Sat Sep 3 2011 03:02:20 CDT
file stats: LOC: 102   Methods: 6
NCLOC: 26   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
CastExpression.java - 85.7% 83.3% 84.6%
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 koala.dynamicjava.tree.visitor.*;
 32   
 33    /**
 34    * This class represents the cast expression nodes of the syntax tree
 35    *
 36    * @author Stephane Hillion
 37    * @version 1.0 - 1999/04/25
 38    */
 39   
 40    public class CastExpression extends UnaryExpression {
 41    public final static String TARGET_TYPE = "targetType";
 42   
 43    /**
 44    * The target type
 45    */
 46    private TypeName targetType;
 47   
 48    /**
 49    * Initializes the expression
 50    * @param tt the target type
 51    * @param exp the casted expression
 52    * @exception IllegalArgumentException if tt is null or exp is null
 53    */
 54  2 public CastExpression(TypeName tt, Expression exp) {
 55  2 this(tt, exp, SourceInfo.NONE);
 56    }
 57   
 58    /**
 59    * Initializes the expression
 60    * @param tt the target type
 61    * @param exp the casted expression
 62    * @exception IllegalArgumentException if tt is null or exp is null
 63    */
 64  222 public CastExpression(TypeName tt, Expression exp,
 65    SourceInfo si) {
 66  222 super(exp, si);
 67   
 68    //if (tt == null) throw new IllegalArgumentException("tt == null");
 69    // tt can be null in a generated cast
 70  222 targetType = tt;
 71    }
 72   
 73    /**
 74    * Returns the target type
 75    */
 76  18 public TypeName getTargetType() {
 77  18 return targetType;
 78    }
 79   
 80    /**
 81    * Sets the target type
 82    * @exception IllegalArgumentException if t is null
 83    */
 84  0 public void setTargetType(TypeName t) {
 85    //if (t == null) throw new IllegalArgumentException("t == null");
 86  0 targetType = t;
 87    }
 88   
 89    /**
 90    * Allows a visitor to traverse the tree
 91    * @param visitor the visitor to accept
 92    */
 93  76 public <T> T acceptVisitor(Visitor<T> visitor) {
 94  76 return visitor.visit(this);
 95    }
 96    /**
 97    * Implementation of toString for use in unit testing
 98    */
 99  4 public String toString() {
 100  4 return "("+getClass().getName()+": "+getExpression()+" "+getTargetType()+")";
 101    }
 102    }