commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1305700 - /commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java
Date Tue, 27 Mar 2012 01:07:30 GMT
Author: sebb
Date: Tue Mar 27 01:07:30 2012
New Revision: 1305700

URL: http://svn.apache.org/viewvc?rev=1305700&view=rev
Log:
Calculate the booleans once; prepares for CSV-78

Modified:
    commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.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=1305700&r1=1305699&r2=1305700&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 Tue Mar 27
01:07:30 2012
@@ -41,6 +41,9 @@ public class CSVFormat implements Serial
     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 Serial
         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 Serial
     }
 
     boolean isEncapsulating() {
-        return this.encapsulator != DISABLED;
+        return isEncapsulating;
     }
 
     /**
@@ -276,7 +282,7 @@ public class CSVFormat implements Serial
      * @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 Serial
     }
 
     boolean isEscaping() {
-        return this.escape != DISABLED;
+        return isEscaping;
     }
 
     /**



Mime
View raw message