Clover coverage report - DrJava Test Coverage (drjava-20120304-r5456)
Coverage timestamp: Sun Mar 4 2012 03:13:23 CST
file stats: LOC: 253   Methods: 38
NCLOC: 169   Classes: 23
 
 Source file Conditionals Statements Methods TOTAL
Query.java 35% 70.3% 78.9% 67.4%
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;
 38   
 39    import java.util.Arrays;
 40   
 41    import static edu.rice.cs.plt.object.ObjectUtil.hash;
 42   
 43    public interface Query {
 44   
 45    abstract static class Pos implements Query {
 46    private final int _pos;
 47   
 48  45775 Pos(final int pos) { _pos = pos; }
 49   
 50  3655 public boolean equals(Object other) {
 51  0 if (other == null || other.getClass() != this.getClass()) return false;
 52  3655 Pos o = (Pos) other;
 53  3655 return o._pos == _pos;
 54    }
 55   
 56  6605 public int hashCode() { return hash(getClass().hashCode(), _pos); }
 57    }
 58   
 59    public static class IndentInformation extends Pos {
 60  0 public IndentInformation(int pos) { super(pos); }
 61    }
 62   
 63    abstract static class AbstractEnclosingBrace implements Query {
 64    private final int _pos;
 65    private final char _opening;
 66    private final char _closing;
 67   
 68  16168 public AbstractEnclosingBrace(final int pos, final char opening, final char closing) {
 69  16168 _pos = pos;
 70  16168 _opening = opening;
 71  16168 _closing = closing;
 72    }
 73   
 74  0 public boolean equals(Object other) {
 75  0 if (other == null || other.getClass() != getClass()) return false;
 76  0 AbstractEnclosingBrace o = (AbstractEnclosingBrace) other;
 77  0 return o._pos == _pos && o._opening == _opening && o._closing == _closing;
 78    }
 79   
 80  0 public int hashCode() { return hash(getClass().hashCode(), _pos, _opening, _closing); }
 81    }
 82   
 83    public static class PrevEnclosingBrace extends AbstractEnclosingBrace {
 84  12210 public PrevEnclosingBrace(int pos, char opening, char closing) { super(pos, opening, closing); }
 85    }
 86   
 87    public static class NextEnclosingBrace extends AbstractEnclosingBrace {
 88  3958 public NextEnclosingBrace(int pos, char opening, char closing) { super(pos, opening, closing); }
 89    }
 90   
 91    abstract static class CharArrayAndFlag implements Query {
 92    private final int _pos;
 93    private final char[] _chars;
 94    private final boolean _flag;
 95   
 96  37261 public CharArrayAndFlag(int pos, char[] chars, boolean flag) {
 97  37261 _pos = pos;
 98  37261 _chars = chars;
 99  37261 _flag = flag;
 100    }
 101   
 102  240 public boolean equals(Object other) {
 103  0 if (other == null || other.getClass() != getClass()) return false;
 104  240 CharArrayAndFlag o = (CharArrayAndFlag) other;
 105  240 return o._pos == _pos && Arrays.equals(o._chars, _chars) && o._flag == _flag;
 106    }
 107   
 108  2003 public int hashCode() {
 109  2003 int[] intArray = new int[] { getClass().hashCode(), _pos, (int)_chars[0], (int)_chars[_chars.length-1], (_flag ? 1 : 0) };
 110  2003 return hash(intArray);
 111    }
 112    }
 113   
 114    public static class PrevDelimiter extends CharArrayAndFlag {
 115  13299 public PrevDelimiter(int pos, char[] delims, boolean skipParenPhrases) { super(pos, delims, skipParenPhrases); }
 116    }
 117   
 118    public static class PrevCharPos implements Query {
 119    private final int _pos;
 120    private final char[] _whitespace;
 121   
 122  6353 public PrevCharPos(int pos, final char[] whitespace) {
 123  6353 _pos = pos;
 124  6353 _whitespace = whitespace;
 125    }
 126   
 127  37 public boolean equals(Object other) {
 128  0 if (other == null || other.getClass() != getClass()) return false;
 129  37 PrevCharPos o = (PrevCharPos) other;
 130  37 return o._pos == _pos && Arrays.equals(o._whitespace, _whitespace);
 131    }
 132   
 133  135 public int hashCode() {
 134  135 return hash(getClass().hashCode(), _pos, _whitespace[0], _whitespace[_whitespace.length-1]);
 135    }
 136    }
 137   
 138    public static class IndentOfCurrStmt implements Query {
 139    private final int _pos;
 140    private final char[] _delims;
 141    private final char[] _whitespace;
 142   
 143  197 public IndentOfCurrStmt(int pos, char[] delims, char[] whitespace) {
 144  197 _pos = pos;
 145  197 _delims = delims;
 146  197 _whitespace = whitespace;
 147    }
 148   
 149  47 public boolean equals(Object other) {
 150  0 if (other == null || other.getClass() != getClass()) return false;
 151  47 IndentOfCurrStmt o = (IndentOfCurrStmt) other;
 152  47 return o._pos == _pos && Arrays.equals(o._delims, _delims) && Arrays.equals(o._whitespace, _whitespace);
 153    }
 154   
 155  217 public int hashCode() {
 156  217 int[] intArray = new int[] { getClass().hashCode(), _pos ^_delims[0], _delims[_delims.length-1], _whitespace[0],
 157    _whitespace[_whitespace.length-1] };
 158  217 return hash(intArray);
 159    }
 160    }
 161   
 162    public static class CharOnLine implements Query {
 163    private final int _pos;
 164    private final char _findChar;
 165   
 166  129 public CharOnLine(int pos, char findChar) {
 167  129 _pos = pos;
 168  129 _findChar = findChar;
 169    }
 170   
 171  5 public boolean equals(Object other) {
 172  0 if (other == null || other.getClass() != getClass()) return false;
 173  5 CharOnLine o = (CharOnLine) other;
 174  5 return o._pos == _pos && o._findChar == _findChar;
 175    }
 176   
 177  172 public int hashCode() { return hash(getClass().hashCode(), _pos, _findChar); }
 178    }
 179   
 180    public static class LineStartPos extends Pos {
 181  17527 public LineStartPos(int pos) { super(pos); }
 182    }
 183   
 184    public static class LineEndPos extends Pos {
 185  25165 public LineEndPos(int pos) { super(pos); }
 186    }
 187   
 188    public static class LineFirstCharPos extends Pos {
 189  930 public LineFirstCharPos(int pos) { super(pos); }
 190    }
 191   
 192    public static class FirstNonWSCharPos extends CharArrayAndFlag {
 193  23962 FirstNonWSCharPos(int pos, char[] whitespace, boolean acceptComments) { super(pos, whitespace, acceptComments); }
 194    }
 195   
 196    public static class PosInParenPhrase extends Pos {
 197  2 public PosInParenPhrase(int pos) { super(pos); }
 198    }
 199   
 200    public static class LineEnclosingBrace extends Pos {
 201  1210 public LineEnclosingBrace(int pos) { super(pos); }
 202    }
 203   
 204    public static class EnclosingBrace extends Pos {
 205  28 public EnclosingBrace(int pos) { super(pos); }
 206    }
 207   
 208    public static class PosNotInBlock extends Pos {
 209  324 public PosNotInBlock(int pos) { super(pos); }
 210    }
 211   
 212    public static class PosInBlockComment extends Pos {
 213  0 public PosInBlockComment(int pos) { super(pos); }
 214    }
 215   
 216    public static class AnonymousInnerClass implements Query {
 217    private final int _pos;
 218    private final int _openCurlyPos;
 219   
 220  4783 public AnonymousInnerClass(int pos, int openCurlyPos) {
 221  4783 _pos = pos;
 222  4783 _openCurlyPos = openCurlyPos;
 223    }
 224   
 225  0 public boolean equals(Object other) {
 226  0 if (other == null || other.getClass() != getClass()) return false;
 227  0 AnonymousInnerClass o = (AnonymousInnerClass) other;
 228  0 return o._pos == _pos && o._openCurlyPos == _openCurlyPos;
 229    }
 230   
 231  0 public int hashCode() { return hash(getClass().hashCode(), _pos, _openCurlyPos); }
 232    }
 233   
 234    public static class AnonymousInnerClassIndex extends Pos {
 235  589 public AnonymousInnerClassIndex(int pos) { super(pos); }
 236    }
 237   
 238    public static class EnclosingClassName implements Query {
 239    private int _pos;
 240    private boolean _qual;
 241  2171 public EnclosingClassName(int pos, boolean qual) {
 242  2171 _pos = pos;
 243  2171 _qual = qual;
 244    }
 245  0 public boolean equals(Object other) {
 246  0 if (other == null || other.getClass() != getClass()) return false;
 247  0 EnclosingClassName o = (EnclosingClassName) other;
 248  0 return o._pos == _pos && o._qual == _qual;
 249    }
 250   
 251  0 public int hashCode() { return hash(getClass().hashCode(), _pos, (_qual ? 1 : 0)); }
 252    }
 253    }