Clover coverage report - DynamicJava Test Coverage (dynamicjava-20120303-r5436)
Coverage timestamp: Sat Mar 3 2012 03:02:19 CST
file stats: LOC: 123   Methods: 8
NCLOC: 37   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
InstanceOfExpression.java 25% 50% 62.5% 47.1%
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 instanceof expression nodes of the syntax tree
 35    *
 36    * @author Stephane Hillion
 37    * @version 1.0 - 1999/04/24
 38    */
 39   
 40    public class InstanceOfExpression extends Expression implements ExpressionContainer {
 41    /**
 42    * The expression to check
 43    */
 44    private Expression expression;
 45   
 46    /**
 47    * The type to check
 48    */
 49    private TypeName referenceType;
 50   
 51    /**
 52    * Initializes the expression
 53    * @param exp the expression to test
 54    * @param t the type to check
 55    * @exception IllegalArgumentException if exp is null or t is null
 56    */
 57  1 public InstanceOfExpression(Expression exp, TypeName t) {
 58  1 this(exp, t, SourceInfo.NONE);
 59    }
 60   
 61    /**
 62    * Initializes the expression
 63    * @param exp the expression to test
 64    * @param t the type to check
 65    * @exception IllegalArgumentException if exp is null or t is null
 66    */
 67  2 public InstanceOfExpression(Expression exp, TypeName t,
 68    SourceInfo si) {
 69  2 super(si);
 70   
 71  0 if (exp == null) throw new IllegalArgumentException("exp == null");
 72  0 if (t == null) throw new IllegalArgumentException("t == null");
 73   
 74  2 expression = exp;
 75  2 referenceType = t;
 76    }
 77   
 78    /**
 79    * Returns the expression to check
 80    */
 81  2 public Expression getExpression() {
 82  2 return expression;
 83    }
 84   
 85    /**
 86    * Sets the expression to check
 87    * @exception IllegalArgumentException if e is null
 88    */
 89  0 public void setExpression(Expression e) {
 90  0 if (e == null) throw new IllegalArgumentException("e == null");
 91  0 expression = e;
 92    }
 93   
 94    /**
 95    * Returns the type to check
 96    */
 97  2 public TypeName getReferenceType() {
 98  2 return referenceType;
 99    }
 100   
 101    /**
 102    * Sets the type to check
 103    * @exception IllegalArgumentException if t is null
 104    */
 105  0 public void setReferenceType(TypeName t) {
 106  0 if (t == null) throw new IllegalArgumentException("t == null");
 107  0 referenceType = t;
 108    }
 109   
 110    /**
 111    * Allows a visitor to traverse the tree
 112    * @param visitor the visitor to accept
 113    */
 114  0 public <T> T acceptVisitor(Visitor<T> visitor) {
 115  0 return visitor.visit(this);
 116    }
 117    /**
 118    * Implementation of toString for use in unit testing
 119    */
 120  2 public String toString() {
 121  2 return "("+getClass().getName()+": "+getExpression()+" "+getReferenceType()+")";
 122    }
 123    }