Clover coverage report - DynamicJava Test Coverage (dynamicjava-20120303-r5436)
Coverage timestamp: Sat Mar 3 2012 03:02:19 CST
file stats: LOC: 114   Methods: 8
NCLOC: 34   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
SwitchBlock.java - 70% 62.5% 66.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 java.util.*;
 32   
 33    import koala.dynamicjava.tree.visitor.*;
 34   
 35    /**
 36    * This class represents the switch expression-statement bindings
 37    *
 38    * @author Stephane Hillion
 39    * @version 1.0 - 1999/06/30
 40    */
 41   
 42    public class SwitchBlock extends Node implements ExpressionContainer {
 43    /**
 44    * The expression; null for a {@code default} block
 45    */
 46    private Expression expression;
 47   
 48    /**
 49    * The statements
 50    */
 51    private List<Node> statements;
 52   
 53    /**
 54    * Creates a new binding
 55    */
 56  3 public SwitchBlock(Expression exp, List<Node> stmts) {
 57  3 this(exp, stmts, SourceInfo.NONE);
 58    }
 59   
 60    /**
 61    * Creates a new binding
 62    * @param exp the case expression, or {@code null} for a {@code default} block
 63    * @param stmts the body
 64    */
 65  6 public SwitchBlock(Expression exp, List<Node> stmts,
 66    SourceInfo si) {
 67  6 super(si);
 68   
 69  6 expression = exp;
 70  6 statements = stmts;
 71    }
 72   
 73    /**
 74    * Returns the 'case' expression
 75    */
 76  6 public Expression getExpression() {
 77  6 return expression;
 78    }
 79   
 80    /**
 81    * Sets the 'case' expression
 82    */
 83  0 public void setExpression(Expression e) {
 84  0 expression = e;
 85    }
 86   
 87    /**
 88    * Returns the statements
 89    */
 90  6 public List<Node> getStatements() {
 91  6 return statements;
 92    }
 93   
 94    /**
 95    * Sets the statements
 96    */
 97  0 public void setStatements(List<Node> l) {
 98  0 statements = l;
 99    }
 100   
 101    /**
 102    * Allows a visitor to traverse the tree
 103    * @param visitor the visitor to accept
 104    */
 105  0 public <T> T acceptVisitor(Visitor<T> visitor) {
 106  0 return visitor.visit(this);
 107    }
 108    /**
 109    * Implementation of toString for use in unit testing
 110    */
 111  6 public String toString() {
 112  6 return "("+getClass().getName()+": "+getExpression()+" "+getStatements()+")";
 113    }
 114    }