Calculate the booleans once; prepares for CSV-78

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1305700 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2012-03-27 01:07:30 +00:00
parent 8a683f009d
commit aeef773ed6
1 changed files with 9 additions and 3 deletions

View File

@ -41,6 +41,9 @@ public class CSVFormat implements Serializable {
private final String lineSeparator; // for outputs
private final String[] header;
private final boolean isEscaping;
private final boolean isCommentingEnabled;
private final boolean isEncapsulating;
/**
* Constant char to be used for disabling comments, escapes and encapsulation.
@ -156,6 +159,9 @@ public class CSVFormat implements Serializable {
this.emptyLinesIgnored = emptyLinesIgnored;
this.lineSeparator = lineSeparator;
this.header = header;
this.isEncapsulating = encapsulator != DISABLED;
this.isCommentingEnabled = commentStart != DISABLED;
this.isEscaping = escape != DISABLED;
}
/**
@ -243,7 +249,7 @@ public class CSVFormat implements Serializable {
}
boolean isEncapsulating() {
return this.encapsulator != DISABLED;
return isEncapsulating;
}
/**
@ -276,7 +282,7 @@ public class CSVFormat implements Serializable {
* @return <tt>true</tt> is comments are supported, <tt>false</tt> otherwise
*/
public boolean isCommentingEnabled() {
return this.commentStart != DISABLED;
return isCommentingEnabled;
}
/**
@ -304,7 +310,7 @@ public class CSVFormat implements Serializable {
}
boolean isEscaping() {
return this.escape != DISABLED;
return isEscaping;
}
/**