Author: ggregory Date: Thu Oct 11 14:39:23 2012 New Revision: 1397087 URL: http://svn.apache.org/viewvc?rev=1397087&view=rev Log: Rename ivars that were in the past tense to use the imperative style.
Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFileParserTest.java commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1.java commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/perf/PerformanceTest.java Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java?rev=1397087&r1=1397086&r2=1397087&view=diff ============================================================================== --- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java (original) +++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java Thu Oct 11 14:39:23 2012 @@ -44,8 +44,8 @@ public class CSVFormat implements Serial private final char encapsulator; private final char commentStart; private final char escape; - private final boolean surroundingSpacesIgnored; // Should leading/trailing spaces be ignored around values? - private final boolean emptyLinesIgnored; + private final boolean ignoreSurroundingSpaces; // Should leading/trailing spaces be ignored around values? + private final boolean ignoreEmptyLines; private final String lineSeparator; // for outputs private final String[] header; @@ -78,7 +78,7 @@ public class CSVFormat implements Serial PRISTINE. withDelimiter(COMMA) .withEncapsulator(DOUBLE_QUOTE) - .withEmptyLinesIgnored(true) + .withIgnoreEmptyLines(true) .withLineSeparator(CRLF); /** @@ -117,8 +117,8 @@ public class CSVFormat implements Serial PRISTINE .withDelimiter(TAB) .withEncapsulator(DOUBLE_QUOTE) - .withSurroundingSpacesIgnored(true) - .withEmptyLinesIgnored(true) + .withIgnoreSurroundingSpaces(true) + .withIgnoreEmptyLines(true) .withLineSeparator(CRLF); /** @@ -146,9 +146,9 @@ public class CSVFormat implements Serial * the char used for comment identification * @param escape * the char used to escape special characters in values - * @param surroundingSpacesIgnored + * @param ignoreSurroundingSpaces * <tt>true</tt> when whitespaces enclosing values should be ignored - * @param emptyLinesIgnored + * @param ignoreEmptyLines * <tt>true</tt> when the parser should skip empty lines * @param lineSeparator * the line separator to use for output @@ -161,8 +161,8 @@ public class CSVFormat implements Serial this.encapsulator = encapsulator; this.commentStart = commentStart; this.escape = escape; - this.surroundingSpacesIgnored = surroundingSpacesIgnored; - this.emptyLinesIgnored = emptyLinesIgnored; + this.ignoreSurroundingSpaces = surroundingSpacesIgnored; + this.ignoreEmptyLines = emptyLinesIgnored; this.lineSeparator = lineSeparator; this.header = header; this.isEncapsulating = encapsulator != DISABLED; @@ -234,8 +234,8 @@ public class CSVFormat implements Serial if (isLineBreak(delimiter)) { throw new IllegalArgumentException("The delimiter cannot be a line break"); } - return new CSVFormat(delimiter, encapsulator, commentStart, escape, surroundingSpacesIgnored, - emptyLinesIgnored, lineSeparator, header); + return new CSVFormat(delimiter, encapsulator, commentStart, escape, ignoreSurroundingSpaces, + ignoreEmptyLines, lineSeparator, header); } /** @@ -260,8 +260,8 @@ public class CSVFormat implements Serial if (isLineBreak(encapsulator)) { throw new IllegalArgumentException("The encapsulator cannot be a line break"); } - return new CSVFormat(delimiter, encapsulator, commentStart, escape, surroundingSpacesIgnored, - emptyLinesIgnored, lineSeparator, header); + return new CSVFormat(delimiter, encapsulator, commentStart, escape, ignoreSurroundingSpaces, + ignoreEmptyLines, lineSeparator, header); } /** @@ -297,8 +297,8 @@ public class CSVFormat implements Serial if (isLineBreak(commentStart)) { throw new IllegalArgumentException("The comment start character cannot be a line break"); } - return new CSVFormat(delimiter, encapsulator, commentStart, escape, surroundingSpacesIgnored, - emptyLinesIgnored, lineSeparator, header); + return new CSVFormat(delimiter, encapsulator, commentStart, escape, ignoreSurroundingSpaces, + ignoreEmptyLines, lineSeparator, header); } /** @@ -334,8 +334,8 @@ public class CSVFormat implements Serial if (isLineBreak(escape)) { throw new IllegalArgumentException("The escape character cannot be a line break"); } - return new CSVFormat(delimiter, encapsulator, commentStart, escape, surroundingSpacesIgnored, - emptyLinesIgnored, lineSeparator, header); + return new CSVFormat(delimiter, encapsulator, commentStart, escape, ignoreSurroundingSpaces, + ignoreEmptyLines, lineSeparator, header); } /** @@ -353,21 +353,21 @@ public class CSVFormat implements Serial * @return <tt>true</tt> if spaces around values are ignored, <tt>false</tt> if they are treated as part of the * value. */ - public boolean isSurroundingSpacesIgnored() { - return surroundingSpacesIgnored; + public boolean getIgnoreSurroundingSpaces() { + return ignoreSurroundingSpaces; } /** * Returns a copy of this format with the specified trimming behavior. * - * @param surroundingSpacesIgnored + * @param ignoreSurroundingSpaces * the trimming behavior, <tt>true</tt> to remove the surrounding spaces, <tt>false</tt> to leave the * spaces as is. * @return A copy of this format with the specified trimming behavior. */ - public CSVFormat withSurroundingSpacesIgnored(boolean surroundingSpacesIgnored) { - return new CSVFormat(delimiter, encapsulator, commentStart, escape, surroundingSpacesIgnored, - emptyLinesIgnored, lineSeparator, header); + public CSVFormat withIgnoreSurroundingSpaces(boolean ignoreSurroundingSpaces) { + return new CSVFormat(delimiter, encapsulator, commentStart, escape, ignoreSurroundingSpaces, + ignoreEmptyLines, lineSeparator, header); } /** @@ -376,21 +376,21 @@ public class CSVFormat implements Serial * @return <tt>true</tt> if empty lines between records are ignored, <tt>false</tt> if they are turned into empty * records. */ - public boolean isEmptyLinesIgnored() { - return emptyLinesIgnored; + public boolean getIgnoreEmptyLines() { + return ignoreEmptyLines; } /** * Returns a copy of this format with the specified empty line skipping behavior. * - * @param emptyLinesIgnored + * @param ignoreEmptyLines * the empty line skipping behavior, <tt>true</tt> to ignore the empty lines between the records, * <tt>false</tt> to translate empty lines to empty records. * @return A copy of this format with the specified empty line skipping behavior. */ - public CSVFormat withEmptyLinesIgnored(boolean emptyLinesIgnored) { - return new CSVFormat(delimiter, encapsulator, commentStart, escape, surroundingSpacesIgnored, - emptyLinesIgnored, lineSeparator, header); + public CSVFormat withIgnoreEmptyLines(boolean ignoreEmptyLines) { + return new CSVFormat(delimiter, encapsulator, commentStart, escape, ignoreSurroundingSpaces, + ignoreEmptyLines, lineSeparator, header); } /** @@ -411,8 +411,8 @@ public class CSVFormat implements Serial * @return A copy of this format using the specified output line separator */ public CSVFormat withLineSeparator(String lineSeparator) { - return new CSVFormat(delimiter, encapsulator, commentStart, escape, surroundingSpacesIgnored, - emptyLinesIgnored, lineSeparator, header); + return new CSVFormat(delimiter, encapsulator, commentStart, escape, ignoreSurroundingSpaces, + ignoreEmptyLines, lineSeparator, header); } String[] getHeader() { @@ -439,8 +439,8 @@ public class CSVFormat implements Serial * @return A copy of this format using the specified header */ public CSVFormat withHeader(String... header) { - return new CSVFormat(delimiter, encapsulator, commentStart, escape, surroundingSpacesIgnored, - emptyLinesIgnored, lineSeparator, header); + return new CSVFormat(delimiter, encapsulator, commentStart, escape, ignoreSurroundingSpaces, + ignoreEmptyLines, lineSeparator, header); } /** @@ -486,10 +486,10 @@ public class CSVFormat implements Serial sb.append(' '); sb.append("CommentStart=<").append(commentStart).append('>'); } - if (isEmptyLinesIgnored()) { + if (getIgnoreEmptyLines()) { sb.append(" EmptyLines:ignored"); } - if (isSurroundingSpacesIgnored()) { + if (getIgnoreSurroundingSpaces()) { sb.append(" SurroundingSpaces:ignored"); } return sb.toString(); Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java?rev=1397087&r1=1397086&r2=1397087&view=diff ============================================================================== --- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java (original) +++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java Thu Oct 11 14:39:23 2012 @@ -51,8 +51,8 @@ abstract class Lexer { this.escape = format.getEscape(); this.encapsulator = format.getEncapsulator(); this.commmentStart = format.getCommentStart(); - this.surroundingSpacesIgnored = format.isSurroundingSpacesIgnored(); - this.emptyLinesIgnored = format.isEmptyLinesIgnored(); + this.surroundingSpacesIgnored = format.getIgnoreSurroundingSpaces(); + this.emptyLinesIgnored = format.getIgnoreEmptyLines(); } int getLineNumber() { Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFileParserTest.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFileParserTest.java?rev=1397087&r1=1397086&r2=1397087&view=diff ============================================================================== --- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFileParserTest.java (original) +++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFileParserTest.java Thu Oct 11 14:39:23 2012 @@ -94,9 +94,9 @@ public class CSVFileParserTest { final String option = split[i]; String[] option_parts = option.split("=",2); if ("IgnoreEmpty".equalsIgnoreCase(option_parts[0])){ - fmt = fmt.withEmptyLinesIgnored(Boolean.parseBoolean(option_parts[1])); + fmt = fmt.withIgnoreEmptyLines(Boolean.parseBoolean(option_parts[1])); } else if ("IgnoreSpaces".equalsIgnoreCase(option_parts[0])) { - fmt = fmt.withSurroundingSpacesIgnored(Boolean.parseBoolean(option_parts[1])); + fmt = fmt.withIgnoreSurroundingSpaces(Boolean.parseBoolean(option_parts[1])); } else if ("CommentStart".equalsIgnoreCase(option_parts[0])) { fmt = fmt.withCommentStart(option_parts[1].charAt(0)); } else if ("CheckComments".equalsIgnoreCase(option_parts[0])) { Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java?rev=1397087&r1=1397086&r2=1397087&view=diff ============================================================================== --- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java (original) +++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java Thu Oct 11 14:39:23 2012 @@ -41,8 +41,8 @@ public class CSVFormatTest { format.withCommentStart('?'); format.withLineSeparator("?"); format.withEscape('?'); - format.withSurroundingSpacesIgnored(false); - format.withEmptyLinesIgnored(false); + format.withIgnoreSurroundingSpaces(false); + format.withIgnoreEmptyLines(false); assertEquals('!', format.getDelimiter()); assertEquals('!', format.getEncapsulator()); @@ -50,8 +50,8 @@ public class CSVFormatTest { assertEquals('!', format.getEscape()); assertEquals(CSVFormat.CRLF, format.getLineSeparator()); - assertTrue(format.isSurroundingSpacesIgnored()); - assertTrue(format.isEmptyLinesIgnored()); + assertTrue(format.getIgnoreSurroundingSpaces()); + assertTrue(format.getIgnoreEmptyLines()); } @Test @@ -64,8 +64,8 @@ public class CSVFormatTest { assertEquals("?", format.withLineSeparator("?").getLineSeparator()); assertEquals('?', format.withEscape('?').getEscape()); - assertFalse(format.withSurroundingSpacesIgnored(false).isSurroundingSpacesIgnored()); - assertFalse(format.withEmptyLinesIgnored(false).isEmptyLinesIgnored()); + assertFalse(format.withIgnoreSurroundingSpaces(false).getIgnoreSurroundingSpaces()); + assertFalse(format.withIgnoreEmptyLines(false).getIgnoreEmptyLines()); } @Test @@ -169,7 +169,7 @@ public class CSVFormatTest { assertEquals("comment start", CSVFormat.DEFAULT.getCommentStart(), format.getCommentStart()); assertEquals("line separator", CSVFormat.DEFAULT.getLineSeparator(), format.getLineSeparator()); assertEquals("escape", CSVFormat.DEFAULT.getEscape(), format.getEscape()); - assertEquals("trim", CSVFormat.DEFAULT.isSurroundingSpacesIgnored(), format.isSurroundingSpacesIgnored()); - assertEquals("empty lines", CSVFormat.DEFAULT.isEmptyLinesIgnored(), format.isEmptyLinesIgnored()); + assertEquals("trim", CSVFormat.DEFAULT.getIgnoreSurroundingSpaces(), format.getIgnoreSurroundingSpaces()); + assertEquals("empty lines", CSVFormat.DEFAULT.getIgnoreEmptyLines(), format.getIgnoreEmptyLines()); } } Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1.java?rev=1397087&r1=1397086&r2=1397087&view=diff ============================================================================== --- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1.java (original) +++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1.java Thu Oct 11 14:39:23 2012 @@ -58,7 +58,7 @@ class CSVLexer1 extends Lexer { c = in.readAgain(); // empty line detection: eol AND (last char was EOL or beginning) - if (format.isEmptyLinesIgnored()) { + if (format.getIgnoreEmptyLines()) { while (eol && (lastChar == '\n' || lastChar == '\r' || lastChar == ExtendedBufferedReader.UNDEFINED) && !isEndOfFile(lastChar)) { @@ -84,7 +84,7 @@ class CSVLexer1 extends Lexer { // important: make sure a new char gets consumed in each iteration while (!tkn.isReady && tkn.type != EOF) { // ignore whitespaces at beginning of a token - if (format.isSurroundingSpacesIgnored()) { + if (format.getIgnoreSurroundingSpaces()) { while (isWhitespace(c) && !eol) { wsBuf.append((char) c); c = in.read(); @@ -117,7 +117,7 @@ class CSVLexer1 extends Lexer { } else { // next token must be a simple token // add removed blanks when not ignoring whitespace chars... - if (!format.isSurroundingSpacesIgnored()) { + if (!format.getIgnoreSurroundingSpaces()) { tkn.content.append(wsBuf); } simpleTokenLexer(tkn, c); @@ -169,7 +169,7 @@ class CSVLexer1 extends Lexer { c = in.read(); } - if (format.isSurroundingSpacesIgnored()) { + if (format.getIgnoreSurroundingSpaces()) { trimTrailingSpaces(tkn.content); } Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java?rev=1397087&r1=1397086&r2=1397087&view=diff ============================================================================== --- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java (original) +++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java Thu Oct 11 14:39:23 2012 @@ -46,7 +46,7 @@ public class CSVLexerTest { @Test public void testNextToken1() throws IOException { String code = "abc,def, hijk, lmnop, qrst,uv ,wxy ,z , ,"; - Lexer parser = getLexer(code, CSVFormat.DEFAULT.withSurroundingSpacesIgnored(true)); + Lexer parser = getLexer(code, CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(true)); assertTokenEquals(TOKEN, "abc", parser.nextToken(new Token())); assertTokenEquals(TOKEN, "def", parser.nextToken(new Token())); assertTokenEquals(TOKEN, "hijk", parser.nextToken(new Token())); @@ -79,7 +79,7 @@ public class CSVLexerTest { "\n"+ "# Final comment\n"; // 7 CSVFormat format = CSVFormat.DEFAULT.withCommentStart('#'); - assertTrue("Should ignore empty lines", format.isEmptyLinesIgnored()); + assertTrue("Should ignore empty lines", format.getIgnoreEmptyLines()); Lexer parser = getLexer(code, format); @@ -121,8 +121,8 @@ public class CSVLexerTest { "\n"+ // 6b "\n"+ // 6c "# Final comment\n"; // 7 - CSVFormat format = CSVFormat.DEFAULT.withCommentStart('#').withEmptyLinesIgnored(false); - assertFalse("Should not ignore empty lines", format.isEmptyLinesIgnored()); + CSVFormat format = CSVFormat.DEFAULT.withCommentStart('#').withIgnoreEmptyLines(false); + assertFalse("Should not ignore empty lines", format.getIgnoreEmptyLines()); Lexer parser = getLexer(code, format); @@ -182,7 +182,7 @@ public class CSVLexerTest { * \,, */ String code = "a,\\,,b\\\\\n\\,,\\\nc,d\\\r\ne"; - CSVFormat format = CSVFormat.DEFAULT.withEscape('\\').withEmptyLinesIgnored(false); + CSVFormat format = CSVFormat.DEFAULT.withEscape('\\').withIgnoreEmptyLines(false); assertTrue(format.isEscaping()); Lexer parser = getLexer(code, format); @@ -221,7 +221,7 @@ public class CSVLexerTest { * a, " foo " ,b */ String code = "a,\"foo\",b\na, \" foo\",b\na,\"foo \" ,b\na, \" foo \" ,b"; - Lexer parser = getLexer(code, CSVFormat.DEFAULT.withSurroundingSpacesIgnored(true)); + Lexer parser = getLexer(code, CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(true)); assertTokenEquals(TOKEN, "a", parser.nextToken(new Token())); assertTokenEquals(TOKEN, "foo", parser.nextToken(new Token())); assertTokenEquals(EORECORD, "b", parser.nextToken(new Token())); Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java?rev=1397087&r1=1397086&r2=1397087&view=diff ============================================================================== --- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java (original) +++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java Thu Oct 11 14:39:23 2012 @@ -65,7 +65,7 @@ public class CSVParserTest { @Test public void testGetLine() throws IOException { - CSVParser parser = new CSVParser(new StringReader(CSVINPUT), CSVFormat.DEFAULT.withSurroundingSpacesIgnored(true)); + CSVParser parser = new CSVParser(new StringReader(CSVINPUT), CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(true)); for (String[] re : RESULT) { assertArrayEquals(re, parser.getRecord().values()); } @@ -75,7 +75,7 @@ public class CSVParserTest { @Test public void testGetRecords() throws IOException { - CSVParser parser = new CSVParser(new StringReader(CSVINPUT), CSVFormat.DEFAULT.withSurroundingSpacesIgnored(true)); + CSVParser parser = new CSVParser(new StringReader(CSVINPUT), CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(true)); List<CSVRecord> records = parser.getRecords(); assertEquals(RESULT.length, records.size()); assertTrue(records.size() > 0); @@ -307,7 +307,7 @@ public class CSVParserTest { CSVFormat format = CSVFormat.PRISTINE.withDelimiter(',').withEncapsulator('\'').withEscape('/') - .withEmptyLinesIgnored(true).withLineSeparator(CSVFormat.CRLF); + .withIgnoreEmptyLines(true).withLineSeparator(CSVFormat.CRLF); CSVParser parser = new CSVParser(code, format); List<CSVRecord> records = parser.getRecords(); @@ -337,7 +337,7 @@ public class CSVParserTest { CSVFormat format = CSVFormat.PRISTINE.withDelimiter(',').withEscape('/') - .withEmptyLinesIgnored(true).withLineSeparator(CSVFormat.CRLF); + .withIgnoreEmptyLines(true).withLineSeparator(CSVFormat.CRLF); CSVParser parser = new CSVParser(code, format); List<CSVRecord> records = parser.getRecords(); Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/perf/PerformanceTest.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/perf/PerformanceTest.java?rev=1397087&r1=1397086&r2=1397087&view=diff ============================================================================== --- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/perf/PerformanceTest.java (original) +++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/perf/PerformanceTest.java Thu Oct 11 14:39:23 2012 @@ -40,7 +40,7 @@ public class PerformanceTest { } private long parse(Reader in) throws IOException { - CSVFormat format = CSVFormat.DEFAULT.withSurroundingSpacesIgnored(false); + CSVFormat format = CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(false); long count = 0; for (Object record : format.parse(in)) { count++;