sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1403763 - in /sis/branches/JDK7/sis-utility/src: main/java/org/apache/sis/internal/simple/ main/java/org/apache/sis/internal/util/ main/java/org/apache/sis/io/ main/java/org/apache/sis/util/ test/java/org/apache/sis/internal/util/ test/jav...
Date Tue, 30 Oct 2012 16:16:47 GMT
Author: desruisseaux
Date: Tue Oct 30 16:16:46 2012
New Revision: 1403763

URL: http://svn.apache.org/viewvc?rev=1403763&view=rev
Log:
Removed X364 from public API (moved to internal package) because:
 - This is a very incomplete implementation of X3.64 standard;
 - Detection of whether X3.64 is supported or not is not very reliable;
 - X3.64 is a very old standard (back from VT100 days) and is kind deprecated today, despite
being widely used.
 - There is other libraries dedicated to this standard, this is not Apache SIS job.

Added:
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/util/X364.java
      - copied, changed from r1403605, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/X364.java
    sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/internal/util/X364Test.java
      - copied, changed from r1403745, sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/X364Test.java
Removed:
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/X364.java
    sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/X364Test.java
Modified:
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/simple/package-info.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/LineFormatter.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TableFormatter.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java
    sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/LineFormatterTest.java
    sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/TableFormatterTest.java
    sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/simple/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/simple/package-info.java?rev=1403763&r1=1403762&r2=1403763&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/simple/package-info.java
(original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/simple/package-info.java
Tue Oct 30 16:16:46 2012
@@ -16,7 +16,7 @@
  */
 
 /**
- * Simple implementations of some ISO interfaces.
+ * Simple implementations of some ISO or Java interfaces.
  *
  * <STRONG>Do not use!</STRONG>
  *

Copied: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/util/X364.java
(from r1403605, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/X364.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/util/X364.java?p2=sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/util/X364.java&p1=sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/X364.java&r1=1403605&r2=1403763&rev=1403763&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/X364.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/util/X364.java Tue
Oct 30 16:16:46 2012
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sis.io;
+package org.apache.sis.internal.util;
 
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.StringBuilders;
@@ -56,16 +56,16 @@ public enum X364 {
     /**
      * The first character of the {@link #START} escape string.
      */
-    static final char ESCAPE = '\u001B';
+    public static final char ESCAPE = '\u001B';
 
     /**
      * The second character of the {@link #START} escape string.
      */
-    static final char AFTER_ESCAPE = '[';
+    public static final char BRACKET = '[';
 
     /**
      * The Control Sequence Introducer (CSI).
-     * Must be the concatenation of {@link #ESCAPE} with {@link #AFTER_ESCAPE}.
+     * Must be the concatenation of {@link #ESCAPE} with {@link #BRACKET}.
      */
     private static final String START = "\u001B[";
 
@@ -78,17 +78,17 @@ public enum X364 {
     /**
      * The X3.64 code.
      */
-    private final byte code;
+    private final transient byte code;
 
     /**
-     * The X3.64 escape sequence. Created only when first needed.
+     * The X3.64 escape sequence, built when first needed.
      */
-    private transient String sequence;
+    private transient volatile String sequence;
 
     /**
      * Foreground or background flavors of this enum.
      */
-    private X364 foreground, background;
+    private transient X364 foreground, background;
 
     /**
      * Creates a new code.
@@ -136,10 +136,11 @@ public enum X364 {
      * @return The X3.64 escape sequence.
      */
     public String sequence() {
-        if (sequence == null) {
-            sequence = START + code + END;
+        String s = sequence;
+        if (s == null) {
+            sequence = s = START + code + END;
         }
-        return sequence;
+        return s;
     }
 
     /**

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/LineFormatter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/LineFormatter.java?rev=1403763&r1=1403762&r2=1403763&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/LineFormatter.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/LineFormatter.java Tue Oct
30 16:16:46 2012
@@ -22,6 +22,7 @@ import org.apache.sis.util.Decorator;
 import org.apache.sis.util.Characters;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.ArgumentChecks;
+import org.apache.sis.internal.util.X364;
 
 
 /**
@@ -53,10 +54,6 @@ import org.apache.sis.util.ArgumentCheck
  * length calculation; it does not replace tabulations by spaces. For tabulation expansion,
see
  * {@link #setTabulationExpanded(boolean)}.</p>
  *
- * <p>The characters given to this filter can contain {@linkplain X364 X.364} escape
sequences,
- * as this class will not count the space used by those escape sequences in the calculation
of
- * line length.</p>
- *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-3.00)
  * @version 0.3
@@ -129,7 +126,7 @@ public class LineFormatter extends Filte
 
     /**
      * {@code true} if an escape sequence is in progress. The escape sequence will stop
-     * after the first non-digit character other than {@link X364#AFTER_ESCAPE}.
+     * after the first non-digit character other than {@link X364#BRACKET}.
      */
     private boolean isEscapeSequence;
 
@@ -419,7 +416,7 @@ public class LineFormatter extends Filte
             if (previous != X364.ESCAPE) {
                 isEscapeSequence = (c >= '0' && c <= '9');
                 return; // The letter after the digits will be the last character to skip.
-            } else if (c == X364.AFTER_ESCAPE) {
+            } else if (c == X364.BRACKET) {
                 return; // Found the second part of the Control Sequence Introducer (CSI).
             }
             // [ESC] was not followed by '['. Proceed as a normal character.

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TableFormatter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TableFormatter.java?rev=1403763&r1=1403762&r2=1403763&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TableFormatter.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TableFormatter.java Tue
Oct 30 16:16:46 2012
@@ -25,6 +25,7 @@ import java.io.IOException;
 import org.apache.sis.util.Decorator;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Errors;
+import org.apache.sis.internal.util.X364;
 
 import static org.apache.sis.util.Arrays.EMPTY_INT;
 import static org.apache.sis.util.Characters.isLineOrParagraphSeparator;

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java?rev=1403763&r1=1403762&r2=1403763&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java Tue
Oct 30 16:16:46 2012
@@ -763,9 +763,9 @@ search:     for (; fromIndex <= stopAt; 
      *
      * <p>This method is similar in purpose to {@link String#trim()}, except that the
later considers
      * every ASCII control codes below 32 to be a whitespace. This have the side effect of
removing
-     * {@linkplain org.apache.sis.io.X364 X3.64} escape sequences as well. Users should invoke
this
-     * {@code CharSequences.trimWhitespaces} method instead if they need to preserve X3.64
escape
-     * sequences.</p>
+     * ANSI escape sequences (a.k.a. X3.64) as well. Users should invoke this
+     * {@code CharSequences.trimWhitespaces} method instead if they need to preserve
+     * those ANSI escape sequences.</p>
      *
      * @param  text The text from which to remove leading and trailing white spaces, or {@code
null}.
      * @return A characters sequence with leading and trailing white spaces removed,

Copied: sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/internal/util/X364Test.java
(from r1403745, sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/X364Test.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/internal/util/X364Test.java?p2=sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/internal/util/X364Test.java&p1=sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/X364Test.java&r1=1403745&r2=1403763&rev=1403763&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/X364Test.java (original)
+++ sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/internal/util/X364Test.java
Tue Oct 30 16:16:46 2012
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sis.io;
+package org.apache.sis.internal.util;
 
 import org.junit.Test;
 import org.apache.sis.test.TestCase;
 
 import static org.junit.Assert.*;
-import static org.apache.sis.io.X364.*;
+import static org.apache.sis.internal.util.X364.*;
 
 
 /**

Modified: sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/LineFormatterTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/LineFormatterTest.java?rev=1403763&r1=1403762&r2=1403763&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/LineFormatterTest.java (original)
+++ sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/LineFormatterTest.java Tue
Oct 30 16:16:46 2012
@@ -20,7 +20,7 @@ import java.util.List;
 import java.util.Arrays;
 import java.io.IOException;
 import org.apache.sis.test.DependsOn;
-import org.apache.sis.util.CharSequencesTest;
+import org.apache.sis.internal.util.X364;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 
@@ -39,7 +39,10 @@ import static org.apache.sis.util.Charac
  * @module
  */
 @RunWith(Parameterized.class)
-@DependsOn({CharSequencesTest.class, X364Test.class})
+@DependsOn({
+  org.apache.sis.util.CharSequencesTest.class,
+  org.apache.sis.internal.util.X364Test.class
+})
 public final strictfp class LineFormatterTest extends FormatterTestCase {
     /**
      * Returns all {@link LineFormatter} aspects to test. Each element of the returned list
is

Modified: sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/TableFormatterTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/TableFormatterTest.java?rev=1403763&r1=1403762&r2=1403763&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/TableFormatterTest.java
(original)
+++ sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/io/TableFormatterTest.java
Tue Oct 30 16:16:46 2012
@@ -18,7 +18,6 @@ package org.apache.sis.io;
 
 import java.io.IOException;
 import org.apache.sis.test.DependsOn;
-import org.apache.sis.util.CharSequencesTest;
 import org.junit.Test;
 
 import static org.junit.Assert.*;
@@ -32,7 +31,10 @@ import static org.junit.Assert.*;
  * @version 0.3
  * @module
  */
-@DependsOn({CharSequencesTest.class, X364Test.class, LineFormatterTest.class})
+@DependsOn({
+  org.apache.sis.util.CharSequencesTest.class,
+  org.apache.sis.internal.util.X364Test.class,
+  LineFormatterTest.class})
 public final strictfp class TableFormatterTest extends FormatterTestCase {
     /**
      * The table formatter to test. May not be same instance than {@link #formatter},

Modified: sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java?rev=1403763&r1=1403762&r2=1403763&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
(original)
+++ sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
Tue Oct 30 16:16:46 2012
@@ -58,7 +58,7 @@ import org.junit.runners.Suite;
   // Formatting
   org.apache.sis.measure.AngleFormatTest.class,
   org.apache.sis.measure.AngleTest.class,
-  org.apache.sis.io.X364Test.class,
+  org.apache.sis.internal.util.X364Test.class,
   org.apache.sis.io.LineFormatterTest.class,
   org.apache.sis.io.TableFormatterTest.class,
 



Mime
View raw message