Clover coverage report - DynamicJava Test Coverage (dynamicjava-20130622-r5436)
Coverage timestamp: Sat Jun 22 2013 03:01:29 CDT
file stats: LOC: 123   Methods: 8
NCLOC: 37   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
IfThenStatement.java 37.5% 66.7% 87.5% 64.7%
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 if-then statement nodes of the syntax tree
 35    *
 36    * @author Stephane Hillion
 37    * @version 1.0 - 1999/05/16
 38    */
 39   
 40    public class IfThenStatement extends Statement {
 41    /**
 42    * The condition
 43    */
 44    private Expression condition;
 45   
 46    /**
 47    * The then-statement of this statement
 48    */
 49    private Node thenStatement;
 50   
 51    /**
 52    * Creates a new while statement
 53    * @param cond the condition
 54    * @param tstmt the statement
 55    * @exception IllegalArgumentException if cond is null or tstmt is null
 56    */
 57  2 public IfThenStatement(Expression cond, Node tstmt) {
 58  2 this(cond, tstmt, SourceInfo.NONE);
 59    }
 60   
 61    /**
 62    * Creates a new while statement
 63    * @param cond the condition
 64    * @param tstmt the statement
 65    * @exception IllegalArgumentException if cond is null or tstmt is null
 66    */
 67  207 public IfThenStatement(Expression cond, Node tstmt,
 68    SourceInfo si) {
 69  207 super(si);
 70   
 71  0 if (cond == null) throw new IllegalArgumentException("cond == null");
 72  0 if (tstmt == null) throw new IllegalArgumentException("tstmt == null");
 73   
 74  207 condition = cond;
 75  207 thenStatement = tstmt;
 76    }
 77   
 78    /**
 79    * Gets the condition to evaluate at each loop
 80    */
 81  524 public Expression getCondition() {
 82  524 return condition;
 83    }
 84   
 85    /**
 86    * Sets the condition to evaluate
 87    * @exception IllegalArgumentException if e is null
 88    */
 89  195 public void setCondition(Expression e) {
 90  0 if (e == null) throw new IllegalArgumentException("e == null");
 91  195 condition = e;
 92    }
 93   
 94    /**
 95    * Returns the then statement of this statement
 96    */
 97  211 public Node getThenStatement() {
 98  211 return thenStatement;
 99    }
 100   
 101    /**
 102    * Sets the then statement of this statement
 103    * @exception IllegalArgumentException if node is null
 104    */
 105  0 public void setThenStatement(Node node) {
 106  0 if (node == null) throw new IllegalArgumentException("node == null");
 107  0 thenStatement = node;
 108    }
 109   
 110    /**
 111    * Allows a visitor to traverse the tree
 112    * @param visitor the visitor to accept
 113    */
 114  305 public <T> T acceptVisitor(Visitor<T> visitor) {
 115  305 return visitor.visit(this);
 116    }
 117    /**
 118    * Implementation of toString for use in unit testing
 119    */
 120  4 public String toString() {
 121  4 return "("+getClass().getName()+": "+getCondition()+" "+getThenStatement()+")";
 122    }
 123    }