Clover coverage report - DrJava Test Coverage (drjava-20120304-r5456)
Coverage timestamp: Sun Mar 4 2012 03:13:23 CST
file stats: LOC: 188   Methods: 28
NCLOC: 37   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
Gap.java 100% 54.8% 50% 55.6%
coverage coverage
 1    /*BEGIN_COPYRIGHT_BLOCK
 2    *
 3    * Copyright (c) 2001-2010, JavaPLT group at Rice University (drjava@rice.edu)
 4    * All rights reserved.
 5    *
 6    * Redistribution and use in source and binary forms, with or without
 7    * modification, are permitted provided that the following conditions are met:
 8    * * Redistributions of source code must retain the above copyright
 9    * notice, this list of conditions and the following disclaimer.
 10    * * Redistributions in binary form must reproduce the above copyright
 11    * notice, this list of conditions and the following disclaimer in the
 12    * documentation and/or other materials provided with the distribution.
 13    * * Neither the names of DrJava, the JavaPLT group, Rice University, nor the
 14    * names of its contributors may be used to endorse or promote products
 15    * derived from this software without specific prior written permission.
 16    *
 17    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 18    * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 19    * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 20    * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 21    * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 22    * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 23    * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 24    * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 25    * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 26    * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 27    * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 28    *
 29    * This software is Open Source Initiative approved Open Source Software.
 30    * Open Source Initative Approved is a trademark of the Open Source Initiative.
 31    *
 32    * This file is part of DrJava. Download the current version of this project
 33    * from http://www.drjava.org/ or http://sourceforge.net/projects/drjava/
 34    *
 35    * END_COPYRIGHT_BLOCK*/
 36   
 37    package edu.rice.cs.drjava.model.definitions.reducedmodel;
 38   
 39    /** A subclass of ReducedToken that represents sequences of non-special characters.
 40    * @version $Id: Gap.java 5175 2010-01-20 08:46:32Z mgricken $
 41    */
 42    class Gap extends ReducedToken {
 43    private volatile int _size;
 44   
 45    /** Creates a new Gap.
 46    * @param size the size of the gap
 47    * @param state the state of the reduced model
 48    */
 49  7153 Gap(int size, ReducedModelState state) {
 50  7153 super(state);
 51  7153 _size = size;
 52    }
 53   
 54    /** Gets the size of this gap.
 55    * @return _size
 56    */
 57  11033637 public int getSize() { return _size; }
 58   
 59    /** Gets the token type.
 60    * @return the empty string
 61    */
 62  55825 public String getType() { return ""; }
 63   
 64    /** Blows up. The type of a Gap cannot be set.
 65    * @param type the type to set to
 66    * @throws RuntimeException always
 67    */
 68  0 public void setType(String type) { throw new RuntimeException("Can't set type on Gap!"); }
 69   
 70    /** Blows up. A Gap cannot be flipped.
 71    * @throws RuntimeException always
 72    */
 73  0 public void flip() { throw new RuntimeException("Can't flip a Gap!"); }
 74   
 75    /** Increases the size of the gap.
 76    * @param delta the amount by which the gap is augmented.
 77    */
 78  110106 public void grow(int delta) { if (delta >= 0) _size += delta; }
 79   
 80    /** Decreases the size of the gap.
 81    * @param delta the amount by which the gap is diminished.
 82    */
 83  329 public void shrink(int delta) { if (delta <= _size && delta >= 0) _size -= delta; }
 84   
 85    /** Converts a Brace to a String. Used for debugging.
 86    * @return the String representation of the Gap
 87    */
 88  0 public String toString() {
 89    // final StringBuilder val = new StringBuilder();
 90    // int i;
 91    // for (i = 0; i < _size; i++) val.append(" _");
 92    // return val.toString();
 93  0 return "Gap<" + _size + ">";
 94    }
 95   
 96    /** Determines that this is not a multi-char brace.
 97    * @return <code>false</code>
 98    */
 99  3415 public boolean isMultipleCharBrace() { return false; }
 100   
 101    /** Determines that this is a gap.
 102    * @return <code>true</code>
 103    */
 104  113045 public boolean isGap() { return true; }
 105   
 106    /** Determines that this is not a line comment.
 107    * @return <code>false</code>
 108    */
 109  13421 public boolean isLineComment() { return false; }
 110   
 111    /** Determines that this is not the start of a block comment.
 112    * @return <code>false</code>
 113    */
 114  13276 public boolean isBlockCommentStart() { return false; }
 115   
 116    /** Determines that this is not the end of a block comment.
 117    * @return <code>false</code>
 118    */
 119  0 public boolean isBlockCommentEnd() { return false; }
 120   
 121    /** Determines that this is not a newline.
 122    * @return <code>false</code>
 123    */
 124  6914 public boolean isNewline() { return false; }
 125   
 126    /** Determines that this is not a /.
 127    * @return <code>false</code>
 128    */
 129  0 public boolean isSlash() { return false; }
 130   
 131    /** Determines that this is not a *.
 132    * @return <code>false</code>
 133    */
 134  0 public boolean isStar() { return false; }
 135   
 136    /** Determines that this is not a ".
 137    * @return <code>false</code>
 138    */
 139  8652 public boolean isDoubleQuote() { return false; }
 140   
 141    /** Determines that this is not a '.
 142    * @return <code>false</code>
 143    */
 144  8286 public boolean isSingleQuote() { return false; }
 145   
 146    /** Determines that this is not a double escape sequence.
 147    * @return <code>false</code>
 148    */
 149  0 public boolean isDoubleEscapeSequence() { return false; }
 150   
 151    /** Determines that this is not a double escape.
 152    * @return <code>false</code>
 153    */
 154  0 public boolean isDoubleEscape() { return false; }
 155   
 156    /** Determines that this is not a \'.
 157    * @return <code>false</code>
 158    */
 159  0 public boolean isEscapedSingleQuote() { return false; }
 160   
 161    /** Determines that this is not a \".
 162    * @return <code>false</code>
 163    */
 164  0 public boolean isEscapedDoubleQuote() { return false; }
 165   
 166    /** Determines that this is not open.
 167    * @return <code>false</code>
 168    */
 169  3 public boolean isOpen() { return false; }
 170   
 171    /** Determines that this is not closed. */
 172  2 public boolean isClosed() { return false; }
 173   
 174    /** Determines that this is not a match.
 175    * @param other the token to compare to
 176    * @return <code>false</code>
 177    */
 178  0 public boolean isMatch(Brace other) { return false; }
 179   
 180    /** Determines that this ReducedToken is not matchable (one of "{", "}", "(", ")", "[", "]") */
 181  0 public boolean isMatchable() { return false; }
 182   
 183    /** Determines that this is not an open brace. */
 184  0 public boolean isOpenBrace() { return false; }
 185   
 186    /** Determines that this is not a closed brace. */
 187  0 public boolean isClosedBrace() { return false; }
 188    }