Use is prefix for getters that return booleans

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1610490 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benedikt Ritter 2014-07-14 19:25:03 +00:00
parent 6eac37b28d
commit f51f89828d
5 changed files with 20 additions and 20 deletions

View File

@ -497,7 +497,7 @@ public final class CSVFormat implements Serializable {
* @return <tt>true</tt> if headers are ignored when parsing the header line, <tt>false</tt> to throw an
* {@link IllegalArgumentException}.
*/
public boolean getIgnoreEmptyHeaders() {
public boolean isIgnoringEmptyHeaders() {
return ignoreEmptyHeaders;
}
@ -507,7 +507,7 @@ public final class CSVFormat implements Serializable {
* @return <tt>true</tt> if empty lines between records are ignored, <tt>false</tt> if they are turned into empty
* records.
*/
public boolean getIgnoreEmptyLines() {
public boolean isIgnoringEmptyLines() {
return ignoreEmptyLines;
}
@ -517,7 +517,7 @@ public final class CSVFormat implements Serializable {
* @return <tt>true</tt> if spaces around values are ignored, <tt>false</tt> if they are treated as part of the
* value.
*/
public boolean getIgnoreSurroundingSpaces() {
public boolean isIgnoringSurroundingSpaces() {
return ignoreSurroundingSpaces;
}
@ -570,7 +570,7 @@ public final class CSVFormat implements Serializable {
*
* @return whether to skip the header record.
*/
public boolean getSkipHeaderRecord() {
public boolean isSkippingHeaderRecord() {
return skipHeaderRecord;
}
@ -619,7 +619,7 @@ public final class CSVFormat implements Serializable {
*
* @return {@code true} if a nullString is defined
*/
public boolean isNullHandling() {
public boolean isHandlingNull() {
return nullString != null;
}
@ -682,7 +682,7 @@ public final class CSVFormat implements Serializable {
sb.append(' ');
sb.append("CommentStart=<").append(commentStart).append('>');
}
if (isNullHandling()) {
if (isHandlingNull()) {
sb.append(' ');
sb.append("NullString=<").append(nullString).append('>');
}
@ -690,10 +690,10 @@ public final class CSVFormat implements Serializable {
sb.append(' ');
sb.append("RecordSeparator=<").append(recordSeparator).append('>');
}
if (getIgnoreEmptyLines()) {
if (isIgnoringEmptyLines()) {
sb.append(" EmptyLines:ignored");
}
if (getIgnoreSurroundingSpaces()) {
if (isIgnoringSurroundingSpaces()) {
sb.append(" SurroundingSpaces:ignored");
}
sb.append(" SkipHeaderRecord:").append(skipHeaderRecord);

View File

@ -370,7 +370,7 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable {
headerRecord = nextRecord.values();
}
} else {
if (this.format.getSkipHeaderRecord()) {
if (this.format.isSkippingHeaderRecord()) {
this.nextRecord();
}
headerRecord = formatHeader;
@ -382,7 +382,7 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable {
final String header = headerRecord[i];
final boolean containsHeader = hdrMap.containsKey(header);
final boolean emptyHeader = header == null || header.trim().isEmpty();
if (containsHeader && (!emptyHeader || (emptyHeader && !this.format.getIgnoreEmptyHeaders()))) {
if (containsHeader && (!emptyHeader || (emptyHeader && !this.format.isIgnoringEmptyHeaders()))) {
throw new IllegalArgumentException("The header contains a duplicate name: \"" + header +
"\" in " + Arrays.toString(headerRecord));
}

View File

@ -65,8 +65,8 @@ final class Lexer implements Closeable {
this.escape = mapNullToDisabled(format.getEscape());
this.quoteChar = mapNullToDisabled(format.getQuoteChar());
this.commentStart = mapNullToDisabled(format.getCommentStart());
this.ignoreSurroundingSpaces = format.getIgnoreSurroundingSpaces();
this.ignoreEmptyLines = format.getIgnoreEmptyLines();
this.ignoreSurroundingSpaces = format.isIgnoringSurroundingSpaces();
this.ignoreEmptyLines = format.isIgnoringEmptyLines();
}
/**

View File

@ -299,7 +299,7 @@ public class CSVFormatTest {
assertEquals(null, RFC4180.getCommentStart());
assertEquals(',', RFC4180.getDelimiter());
assertEquals(null, RFC4180.getEscape());
assertFalse(RFC4180.getIgnoreEmptyLines());
assertFalse(RFC4180.isIgnoringEmptyLines());
assertEquals(Character.valueOf('"'), RFC4180.getQuoteChar());
assertEquals(null, RFC4180.getQuotePolicy());
assertEquals("\r\n", RFC4180.getRecordSeparator());
@ -324,8 +324,8 @@ public class CSVFormatTest {
assertEquals("comment start", CSVFormat.DEFAULT.getCommentStart(), format.getCommentStart());
assertEquals("record separator", CSVFormat.DEFAULT.getRecordSeparator(), format.getRecordSeparator());
assertEquals("escape", CSVFormat.DEFAULT.getEscape(), format.getEscape());
assertEquals("trim", CSVFormat.DEFAULT.getIgnoreSurroundingSpaces(), format.getIgnoreSurroundingSpaces());
assertEquals("empty lines", CSVFormat.DEFAULT.getIgnoreEmptyLines(), format.getIgnoreEmptyLines());
assertEquals("trim", CSVFormat.DEFAULT.isIgnoringSurroundingSpaces(), format.isIgnoringSurroundingSpaces());
assertEquals("empty lines", CSVFormat.DEFAULT.isIgnoringEmptyLines(), format.isIgnoringEmptyLines());
}
@Test
@ -376,14 +376,14 @@ public class CSVFormatTest {
@Test
public void testWithIgnoreEmptyLines() throws Exception {
assertFalse(CSVFormat.DEFAULT.withIgnoreEmptyLines(false).getIgnoreEmptyLines());
assertTrue(CSVFormat.DEFAULT.withIgnoreEmptyLines(true).getIgnoreEmptyLines());
assertFalse(CSVFormat.DEFAULT.withIgnoreEmptyLines(false).isIgnoringEmptyLines());
assertTrue(CSVFormat.DEFAULT.withIgnoreEmptyLines(true).isIgnoringEmptyLines());
}
@Test
public void testWithIgnoreSurround() throws Exception {
assertFalse(CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(false).getIgnoreSurroundingSpaces());
assertTrue(CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(true).getIgnoreSurroundingSpaces());
assertFalse(CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(false).isIgnoringSurroundingSpaces());
assertTrue(CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(true).isIgnoringSurroundingSpaces());
}
@Test

View File

@ -159,7 +159,7 @@ public class LexerTest {
"\n"+ // 6c
"# Final comment\n"; // 7
final CSVFormat format = CSVFormat.DEFAULT.withCommentStart('#').withIgnoreEmptyLines(false);
assertFalse("Should not ignore empty lines", format.getIgnoreEmptyLines());
assertFalse("Should not ignore empty lines", format.isIgnoringEmptyLines());
final Lexer parser = getLexer(code, format);