|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment | Line # 26 | 92.3% |
0.9230769
|
8.03 | 18 | 8 | 8 | 0.44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ( 10 of 365) | |||
| Result | |||
|
0.65384614
|
com.puppycrawl.tools.checkstyle.checks.TrailingCommentCheckTest.testLegalComment
com.puppycrawl.tools.checkstyle.checks.TrailingCommentCheckTest.testLegalComment
|
1 PASS | |
|
0.53846157
|
com.puppycrawl.tools.checkstyle.checks.GenericIllegalRegexpCheckTest.testIgnoreCommentsCStyle
com.puppycrawl.tools.checkstyle.checks.GenericIllegalRegexpCheckTest.testIgnoreCommentsCStyle
|
1 PASS | |
|
0.53846157
|
com.puppycrawl.tools.checkstyle.checks.RegexpCheckTest.testIgnoreCommentsInlineMiddle
com.puppycrawl.tools.checkstyle.checks.RegexpCheckTest.testIgnoreCommentsInlineMiddle
|
1 PASS | |
|
0.53846157
|
com.puppycrawl.tools.checkstyle.checks.RegexpCheckTest.testIgnoreCommentsInlineEnd
com.puppycrawl.tools.checkstyle.checks.RegexpCheckTest.testIgnoreCommentsInlineEnd
|
1 PASS | |
|
0.53846157
|
com.puppycrawl.tools.checkstyle.checks.coding.FallThroughCheckTest.testDefault
com.puppycrawl.tools.checkstyle.checks.coding.FallThroughCheckTest.testDefault
|
1 PASS | |
|
0.53846157
|
com.puppycrawl.tools.checkstyle.checks.GenericIllegalRegexpCheckTest.testIgnoreCommentsMultipleCStyle
com.puppycrawl.tools.checkstyle.checks.GenericIllegalRegexpCheckTest.testIgnoreCommentsMultipleCStyle
|
1 PASS | |
|
0.53846157
|
com.puppycrawl.tools.checkstyle.checks.GenericIllegalRegexpCheckTest.testIgnoreCommentsInlineStart
com.puppycrawl.tools.checkstyle.checks.GenericIllegalRegexpCheckTest.testIgnoreCommentsInlineStart
|
1 PASS | |
|
0.53846157
|
com.puppycrawl.tools.checkstyle.checks.RegexpCheckTest.testIgnoreCommentsMultipleCStyle
com.puppycrawl.tools.checkstyle.checks.RegexpCheckTest.testIgnoreCommentsMultipleCStyle
|
1 PASS | |
|
0.53846157
|
com.puppycrawl.tools.checkstyle.checks.GenericIllegalRegexpCheckTest.testIgnoreCommentsInlineEnd
com.puppycrawl.tools.checkstyle.checks.GenericIllegalRegexpCheckTest.testIgnoreCommentsInlineEnd
|
1 PASS | |
|
0.53846157
|
com.puppycrawl.tools.checkstyle.checks.RegexpCheckTest.testIgnoreCommentsCppStyle
com.puppycrawl.tools.checkstyle.checks.RegexpCheckTest.testIgnoreCommentsCppStyle
|
1 PASS | |
| 355 tests are not displayed. This report was configured to show the top 10 tests that covered this file. | |||
| 1 | //////////////////////////////////////////////////////////////////////////////// | |
| 2 | // checkstyle: Checks Java source code for adherence to a set of rules. | |
| 3 | // Copyright (C) 2001-2005 Oliver Burn | |
| 4 | // | |
| 5 | // This library is free software; you can redistribute it and/or | |
| 6 | // modify it under the terms of the GNU Lesser General Public | |
| 7 | // License as published by the Free Software Foundation; either | |
| 8 | // version 2.1 of the License, or (at your option) any later version. | |
| 9 | // | |
| 10 | // This library is distributed in the hope that it will be useful, | |
| 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | // Lesser General Public License for more details. | |
| 14 | // | |
| 15 | // You should have received a copy of the GNU Lesser General Public | |
| 16 | // License along with this library; if not, write to the Free Software | |
| 17 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 18 | //////////////////////////////////////////////////////////////////////////////// | |
| 19 | package com.puppycrawl.tools.checkstyle.api; | |
| 20 | ||
| 21 | /** | |
| 22 | * Representation of the comment block. | |
| 23 | * | |
| 24 | * @author o_sukhodolsky | |
| 25 | */ | |
| 26 | class Comment implements TextBlock | |
| 27 | { | |
| 28 | /** text of the comment. */ | |
| 29 | private final String[] mText; | |
| 30 | ||
| 31 | /** number of first line of the comment. */ | |
| 32 | private final int mFirstLine; | |
| 33 | ||
| 34 | /** number of last line of the comment. */ | |
| 35 | private final int mLastLine; | |
| 36 | ||
| 37 | /** number of first column of the comment. */ | |
| 38 | private final int mFirstCol; | |
| 39 | ||
| 40 | /** number of last column of the comment. */ | |
| 41 | private final int mLastCol; | |
| 42 | ||
| 43 | /** | |
| 44 | * Creates new instance. | |
| 45 | * @param aText the lines that make up the comment. | |
| 46 | * @param aFirstCol number of the first column of the comment. | |
| 47 | * @param aLastLine number of the last line of the comment. | |
| 48 | * @param aLastCol number of the last column of the comment. | |
| 49 | */ | |
| 50 | 9076 |
public Comment(final String[] aText, final int aFirstCol, |
| 51 | final int aLastLine, final int aLastCol) | |
| 52 | { | |
| 53 | 9076 | mText = new String[aText.length]; |
| 54 | 9076 | System.arraycopy(aText, 0, mText, 0, mText.length); |
| 55 | 9076 | mFirstLine = aLastLine - mText.length + 1; |
| 56 | 9076 | mLastLine = aLastLine; |
| 57 | 9076 | mFirstCol = aFirstCol; |
| 58 | 9076 | mLastCol = aLastCol; |
| 59 | } | |
| 60 | ||
| 61 | /** {@inheritDoc} */ | |
| 62 | 808 |
public final String[] getText() |
| 63 | { | |
| 64 | 808 | return (String[]) mText.clone(); |
| 65 | } | |
| 66 | ||
| 67 | /** {@inheritDoc} */ | |
| 68 | 559 |
public final int getStartLineNo() |
| 69 | { | |
| 70 | 559 | return mFirstLine; |
| 71 | } | |
| 72 | ||
| 73 | /** {@inheritDoc} */ | |
| 74 | 6 |
public final int getEndLineNo() |
| 75 | { | |
| 76 | 6 | return mLastLine; |
| 77 | } | |
| 78 | ||
| 79 | /** {@inheritDoc} */ | |
| 80 | 205 |
public int getStartColNo() |
| 81 | { | |
| 82 | 205 | return mFirstCol; |
| 83 | } | |
| 84 | ||
| 85 | /** {@inheritDoc} */ | |
| 86 | 14 |
public int getEndColNo() |
| 87 | { | |
| 88 | 14 | return mLastCol; |
| 89 | } | |
| 90 | ||
| 91 | /** {@inheritDoc} */ | |
| 92 | 1185 |
public boolean intersects(int aStartLineNo, int aStartColNo, |
| 93 | int aEndLineNo, int aEndColNo) | |
| 94 | { | |
| 95 | // compute a single number for start and end | |
| 96 | // to simpify conditional logic | |
| 97 | 1185 | final long multiplier = Integer.MAX_VALUE; |
| 98 | 1185 | final long thisStart = mFirstLine * multiplier + mFirstCol; |
| 99 | 1185 | final long thisEnd = mLastLine * multiplier + mLastCol; |
| 100 | 1185 | final long inStart = aStartLineNo * multiplier + aStartColNo; |
| 101 | 1185 | final long inEnd = aEndLineNo * multiplier + aEndColNo; |
| 102 | ||
| 103 | 1185 | return !((thisEnd < inStart) || (inEnd < thisStart)); |
| 104 | } | |
| 105 | ||
| 106 | /** {@inheritDoc} */ | |
| 107 | 0 |
public String toString() |
| 108 | { | |
| 109 | 0 | return "Comment[" + mFirstLine + ":" + mFirstCol + "-" |
| 110 | + mLastLine + ":" + mLastCol + "]"; | |
| 111 | } | |
| 112 | } | |
|
|||||||||||||