correct comments.

more consistent code.
This commit is contained in:
Rick Giles 2003-07-15 23:39:10 +00:00
parent beb09b076d
commit e9d1dff32e
4 changed files with 26 additions and 18 deletions

View File

@ -21,8 +21,7 @@ package com.puppycrawl.tools.checkstyle.filters;
import com.puppycrawl.tools.checkstyle.api.Filter;
/**
* This filter accepts a matching Integer and is neutral
* on other Objects.
* This filter accepts a matching Integer.
* @author Rick Giles
*/
public class IntMatchFilter

View File

@ -21,8 +21,7 @@ package com.puppycrawl.tools.checkstyle.filters;
import com.puppycrawl.tools.checkstyle.api.Filter;
/**
* This filter accepts an Integer in a range and is neutral
* on other Objects.
* This filter accepts an Integer in a range.
* @author Rick Giles
*/
public class IntRangeFilter

View File

@ -27,8 +27,12 @@ import com.puppycrawl.tools.checkstyle.api.Utils;
/**
* <p>
* This filter denies AuditEvents according to file, check, line, and
* column. It is neutral on Objects that are not AuditEvents.
* This filter accepts AuditEvents according to file, check, line, and
* column conditions. It rejects an AuditEvent if the event's file
* name and check name match the filter's file name and check name
* patterns, and the event's line is in the filter's line CSV or the
* check's columns is in the filter's column CSV.
* It rejects Objects that are not AuditEvents.
* </p>
* @author Rick Giles
*/
@ -114,7 +118,7 @@ public class SuppressElement
public boolean accept(Object aObject)
{
if (!(aObject instanceof AuditEvent)) {
return true;
return false;
}
final AuditEvent event = (AuditEvent) aObject;
@ -133,7 +137,7 @@ public class SuppressElement
return false;
}
// reject line if it is accepted by the line CSV filter
// reject if line matches a line CSV value.
if (mLineFilter != null) {
final Integer line = new Integer(event.getLine());
if (mLineFilter.accept(line)) {
@ -141,7 +145,7 @@ public class SuppressElement
}
}
// reject if column accepted by the column CSV filter
// reject if column matches a column CSV value.
if (mColumnFilter != null) {
final Integer column = new Integer(event.getColumn());
if (mColumnFilter.accept(column)) {

View File

@ -19,6 +19,7 @@
package com.puppycrawl.tools.checkstyle.filters;
import com.puppycrawl.tools.checkstyle.SuppressionsLoader;
import com.puppycrawl.tools.checkstyle.api.AuditEvent;
import com.puppycrawl.tools.checkstyle.api.AutomaticBean;
import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
import com.puppycrawl.tools.checkstyle.api.Filter;
@ -26,9 +27,9 @@ import com.puppycrawl.tools.checkstyle.api.FilterSet;
/**
* <p>
* This filter suppresses AuditEvents according to file, check, line, and
* This filter accepts AuditEvents according to file, check, line, and
* column, as specified in a suppression file.
* It is neutral on Objects that are not AuditEvents.
* It rejects Objects that are not AuditEvents.
* </p>
* @author Rick Giles
*/
@ -36,8 +37,8 @@ public class SuppressionFilter
extends AutomaticBean
implements Filter
{
/** chain of individual suppresses */
private FilterSet mFilterChain = new FilterSet();
/** set of individual suppresses */
private FilterSet mFilters = new FilterSet();
/**
* Loads the suppressions for a file.
@ -47,25 +48,30 @@ public class SuppressionFilter
public void setFile(String aFileName)
throws CheckstyleException
{
mFilterChain = SuppressionsLoader.loadSuppressions(aFileName);
mFilters = SuppressionsLoader.loadSuppressions(aFileName);
}
/** @see com.puppycrawl.tools.checkstyle.api.Filter */
public boolean accept(Object aObject)
{
return mFilterChain.accept(aObject);
if (!(aObject instanceof AuditEvent)) {
return false;
}
else {
return mFilters.accept(aObject);
}
}
/** @see java.lang.Object#toString() */
public String toString()
{
return mFilterChain.toString();
return mFilters.toString();
}
/** @see java.lang.Object#hashCode() */
public int hashCode()
{
return mFilterChain.hashCode();
return mFilters.hashCode();
}
/** @see java.lang.Object#equals(java.lang.Object) */
@ -73,7 +79,7 @@ public class SuppressionFilter
{
if (aObject instanceof SuppressionFilter) {
final SuppressionFilter other = (SuppressionFilter) aObject;
return this.mFilterChain.equals(other.mFilterChain);
return this.mFilters.equals(other.mFilters);
}
else {
return false;