sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1480602 [7/15] - in /sis/branches/Android: ./ ide-project/ ide-project/NetBeans/ ide-project/NetBeans/nbproject/ ide-project/eclipse/ sis-app/src/main/java/org/apache/sis/cli/ sis-build-helper/ sis-build-helper/src/main/java/org/apache/sis...
Date Thu, 09 May 2013 12:24:20 GMT
Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java [UTF-8] Thu May  9 12:24:13 2013
@@ -17,7 +17,7 @@
 package org.apache.sis.io;
 
 import java.util.Map;
-import java.util.HashMap;
+import java.util.IdentityHashMap;
 import java.util.Locale;
 import java.util.TimeZone;
 import java.util.Date;
@@ -30,7 +30,6 @@ import java.text.NumberFormat;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import net.jcip.annotations.NotThreadSafe;
-import org.opengis.util.InternationalString;
 
 import org.apache.sis.measure.Angle;
 import org.apache.sis.measure.AngleFormat;
@@ -79,11 +78,11 @@ public abstract class CompoundFormat<T> 
     /**
      * For cross-version compatibility.
      */
-    private static final long serialVersionUID = -7094915750367581487L;
+    private static final long serialVersionUID = -689151528653024968L;
 
     /**
-     * The locale given at construction time, or {@code null} for unlocalized format.
-     * See {@link #getLocale()} for more information on {@code null} locale.
+     * The locale given at construction time, or {@link Locale#ROOT} (never {@code null}) for
+     * unlocalized format. See {@link #getLocale()} for more information on {@code ROOT} locale.
      */
     protected final Locale locale;
 
@@ -96,34 +95,33 @@ public abstract class CompoundFormat<T> 
      * The formats for smaller unit of information.
      * Will be created only when first needed.
      */
-    private transient Map<Class<?>,Format> formats;
+    private transient Map<Class<?>, Format> formats;
 
     /**
-     * Creates a new format for the given locale. The given locale can be {@code null} if this
-     * format shall parse and format "unlocalized" strings. See {@link #getLocale()} for more
-     * information on {@code null} locale.
+     * Creates a new format for the given locale. The given locale can be {@code null} or
+     * {@link Locale#ROOT} if this format shall parse and format "unlocalized" strings.
+     * See {@link #getLocale()} for more information on {@code ROOT} locale.
      *
-     * @param locale   The locale, or {@code null} for unlocalized format.
+     * @param locale   The locale to use for numbers, dates and angles formatting,
+     *                 or {@code null} for the {@linkplain Locale#ROOT root locale}.
      * @param timezone The timezone, or {@code null} for UTC.
      */
     protected CompoundFormat(final Locale locale, final TimeZone timezone) {
-        this.locale   = locale;
+        this.locale   = (locale != null) ? locale : Locale.ROOT;
         this.timezone = timezone;
     }
 
     /**
-     * Returns the locale given at construction time. The returned locale may be {@code null}
+     * Returns the locale given at construction time. The returned value may be {@link Locale#ROOT}
      * if this format does not apply any localization. The definition of "unlocalized string"
      * is implementation-dependent, but some typical examples are:
      *
      * <ul>
      *   <li>Format {@link Number}s using {@code toString()} instead than {@code NumberFormat}.</li>
-     *   <li>Format {@link InternationalString}s using {@code toString(null)}. This has the desired
-     *       behavior at least with the {@linkplain org.apache.sis.util.iso.DefaultInternationalString#toString(Locale)
-     *       SIS implementation}.</li>
+     *   <li>Format {@link Date}s using the ISO pattern instead than the English one.</li>
      * </ul>
      *
-     * @return The locale used for this format, or {@code null} for unlocalized format.
+     * @return The locale used for this format, or {@link Locale#ROOT} for unlocalized format.
      */
     @Override
     public Locale getLocale() {
@@ -225,9 +223,9 @@ public abstract class CompoundFormat<T> 
      * {@linkplain Character#isISOControl(int) ISO control characters}.
      *
      * {@note The usual SIS policy, as documented in the <code>CharSequences</code> class,
-     * is to test for whitespaces using the <code>Characters.isWhitespace(…)</code> method.
-     * The combination of <code>isSpaceChar(…)</code> and <code>isISOControl(…)</code> done
-     * in this <code>parseObject(…)</code> method is more permissive since it encompasses
+     * is to test for whitespaces using the <code>Characters.isWhitespace(…)</code> method.
+     * The combination of <code>isSpaceChar(…)</code> and <code>isISOControl(…)</code> done
+     * in this <code>parseObject(…)</code> method is more permissive since it encompasses
      * all whitespace characters, plus non-breaking spaces and non-white ISO controls.}
      *
      * @param  text The string representation of the object to parse.
@@ -330,7 +328,7 @@ public abstract class CompoundFormat<T> 
             format = createFormat(type);
             if (format != null) {
                 if (formats == null) {
-                    this.formats = formats = new HashMap<Class<?>,Format>(4);
+                    this.formats = formats = new IdentityHashMap<Class<?>,Format>(4);
                 }
                 formats.put(type, format);
                 break;
@@ -370,25 +368,27 @@ public abstract class CompoundFormat<T> 
         /*
          * The first case below is an apparent exception to the 'expected == type' rule
          * documented in this method javadoc. But actually it is not, since the call to
-         * DefaultFormat.getInstance(…) will indirectly perform this kind of comparison.
+         * DefaultFormat.getInstance(…) will indirectly perform this kind of comparison.
          */
         if (Number.class.isAssignableFrom(valueType)) {
-            if (locale == null) {
+            if (Locale.ROOT.equals(locale)) {
                 return DefaultFormat.getInstance(valueType);
             } else if (valueType == Number.class) {
                 return NumberFormat.getInstance(locale);
             }
         } else if (valueType == Date.class) {
             final DateFormat format;
-            if (locale != null) {
+            if (!Locale.ROOT.equals(locale)) {
                 format = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, locale);
             } else {
-                format = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.US);
+                format = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.ROOT);
             }
             format.setTimeZone(timezone != null ? timezone : TimeZone.getTimeZone("UTC"));
             return format;
         } else if (valueType == Angle.class) {
-            return AngleFormat.getInstance(locale != null ? locale : Locale.US);
+            return AngleFormat.getInstance(locale);
+        } else if (valueType == Class.class) {
+            return ClassFormat.INSTANCE;
         }
         return null;
     }
@@ -401,7 +401,7 @@ public abstract class CompoundFormat<T> 
         @SuppressWarnings("unchecked")
         final CompoundFormat<T> clone = (CompoundFormat<T>) super.clone();
         if (clone.formats != null) {
-            clone.formats = new HashMap<Class<?>,Format>(clone.formats);
+            clone.formats = new IdentityHashMap<Class<?>,Format>(clone.formats);
             for (final Map.Entry<Class<?>,Format> entry : clone.formats.entrySet()) {
                 entry.setValue((Format) entry.getValue().clone());
             }

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/DefaultFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/DefaultFormat.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/DefaultFormat.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/DefaultFormat.java [UTF-8] Thu May  9 12:24:13 2013
@@ -20,14 +20,16 @@ import java.text.Format;
 import java.text.FieldPosition;
 import java.text.ParsePosition;
 import java.text.ParseException;
+import java.io.InvalidObjectException;
 import net.jcip.annotations.ThreadSafe;
 import org.apache.sis.util.Numbers;
+import org.apache.sis.util.CharSequences;
 import org.apache.sis.internal.util.LocalizedParseException;
 
 
 /**
  * Created by {@link CompoundFormat} for parsing and formatting unlocalized numbers.
- * This implementation use {@code toString()} and {@code valueOf(…)} methods instead
+ * This implementation use {@code toString()} and {@code valueOf(…)} methods instead
  * than the {@link java.text} package because the former provide the best guarantees
  * to format all significant digits.
  *
@@ -41,10 +43,11 @@ final class DefaultFormat extends Format
     /**
      * For cross-version compatibility.
      */
-    private static final long serialVersionUID = -4896767141936942311L;
+    private static final long serialVersionUID = -2309270763519060316L;
 
     /**
      * The array for storing singleton instances for types {@code byte} to {@code double}.
+     * The value at index 0 is reserved for the generic {@link Number} type.
      */
     private static final Format[] INSTANCES = new Format[Numbers.DOUBLE - Numbers.BYTE + 2];
 
@@ -97,14 +100,15 @@ final class DefaultFormat extends Format
      * @throws NumberFormatException If the parsing failed.
      */
     private Object valueOf(final String source) throws NumberFormatException {
-        return (type != Number.class) ? Numbers.valueOf(type, source) : Numbers.narrowestNumber(source);
+        return (type != Number.class) ? Numbers.valueOf(source, type) : Numbers.narrowestNumber(source);
     }
 
     /**
      * Parses the given string as a number of the type given at construction time.
      */
     @Override
-    public Object parseObject(final String source) throws ParseException {
+    public Object parseObject(String source) throws ParseException {
+        source = CharSequences.trimWhitespaces(source);
         try {
             return valueOf(source);
         } catch (NumberFormatException cause) {
@@ -119,8 +123,9 @@ final class DefaultFormat extends Format
      */
     @Override
     public Object parseObject(String source, final ParsePosition pos) {
-        final int index = pos.getIndex();
-        source = source.substring(index);
+        final int length = source.length();
+        final int index = CharSequences.skipLeadingWhitespaces(source, pos.getIndex(), length);
+        source = source.substring(index, CharSequences.skipTrailingWhitespaces(source, index, length));
         try {
             return valueOf(source);
         } catch (NumberFormatException cause) {
@@ -128,4 +133,12 @@ final class DefaultFormat extends Format
             return null;
         }
     }
+
+    /**
+     * Resolves to the singleton instance on deserialization.
+     */
+    private Object readResolve() throws InvalidObjectException {
+        final Format format = getInstance(type);
+        return (format != null) ? format : this;
+    }
 }

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/DefaultFormat.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/IO.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/LineAppender.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/LineAppender.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/LineAppender.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/LineAppender.java [UTF-8] Thu May  9 12:24:13 2013
@@ -25,7 +25,7 @@ import org.apache.sis.util.ArgumentCheck
 import org.apache.sis.internal.util.X364;
 
 // Related to JK7
-import org.apache.sis.internal.util.JDK7;
+import org.apache.sis.internal.jdk7.JDK7;
 
 
 /**
@@ -393,7 +393,7 @@ public class LineAppender extends Append
          * the buffer to the underlying appendable since we know that those characters didn't
          * exceeded the line length limit.
          *
-         * We use Character.isWhitespace(…) instead of Character.isSpaceChar(…) because
+         * We use Character.isWhitespace(…) instead of Character.isSpaceChar(…) because
          * the former returns 'true' tabulations (which we want), and returns 'false'
          * for non-breaking spaces (which we also want).
          */

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/LineAppender.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java [UTF-8] Thu May  9 12:24:13 2013
@@ -21,17 +21,17 @@ import java.util.Arrays;
 import java.util.List;
 import java.io.Flushable;
 import java.io.IOException;
+import org.apache.sis.util.ArraysExt;
 import org.apache.sis.util.Decorator;
 import org.apache.sis.util.CharSequences;
 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;
 
 // Related to JK7
-import org.apache.sis.internal.util.JDK7;
+import org.apache.sis.internal.jdk7.JDK7;
 
 
 /**
@@ -48,28 +48,28 @@ import org.apache.sis.internal.util.JDK7
  * {@preformat java
  *     StringBuilder  buffer = new StringBuilder();
  *     TableAppender table  = new TableAppender(buffer);
- *     table.nextLine('═');
+ *     table.nextLine('═');
  *     table.append("English\tFrench\tr.e.d.\n");
  *     table.nextLine('-');
  *     table.append("Mercury\tMercure\t0.382\n")
- *          .append("Venus\tVénus\t0.949\n")
+ *          .append("Venus\tVénus\t0.949\n")
  *          .append("Earth\tTerre\t1.00\n")
  *          .append("Mars\tMars\t0.532\n");
- *     table.nextLine('═');
+ *     table.nextLine('═');
  *     table.flush();
  * }
  *
  * produces the following output:
  *
  * {@preformat text
- *   ╔═════════╤═════════╤════════╗
- *   ║ English │ French  │ r.e.d. ║
- *   ╟─────────┼─────────┼────────╢
- *   ║ Mercury │ Mercure │ 0.382  ║
- *   ║ Venus   │ Vénus   │ 0.949  ║
- *   ║ Earth   │ Terre   │ 1.00   ║
- *   ║ Mars    │ Mars    │ 0.532  ║
- *   ╚═════════╧═════════╧════════╝
+ *   ╔═════════╤═════════╤════════╗
+ *   ║ English │ French  │ r.e.d. ║
+ *   ╟─────────┼─────────┼────────╢
+ *   ║ Mercury │ Mercure │ 0.382  ║
+ *   ║ Venus   │ Vénus   │ 0.949  ║
+ *   ║ Earth   │ Terre   │ 1.00   ║
+ *   ║ Mars    │ Mars    │ 0.532  ║
+ *   ╚═════════╧═════════╧════════╝
  * }
  *
  * @author  Martin Desruisseaux (MPO, IRD, Geomatys)
@@ -77,7 +77,7 @@ import org.apache.sis.internal.util.JDK7
  * @version 0.3
  * @module
  *
- * @see org.apache.sis.util.tree.TreeTableFormat
+ * @see org.apache.sis.util.collection.TreeTableFormat
  */
 @Decorator(Appendable.class)
 public class TableAppender extends Appender implements Flushable {
@@ -105,28 +105,28 @@ public class TableAppender extends Appen
      */
     private static final char[][] BOX = new char[][] {
         {// [0000]: single horizontal, single vertical
-            '┌','┬','┐',
-            '├','┼','┤',
-            '└','┴','┘',
-            '─','│'
+            '┌','┬','┐',
+            '├','┼','┤',
+            '└','┴','┘',
+            '─','│'
         },
         {// [0001]: single horizontal, double vertical
-            '╓','╥','╖',
-            '╟','╫','╢',
-            '╙','╨','╜',
-            '─','║'
+            '╓','╥','╖',
+            '╟','╫','╢',
+            '╙','╨','╜',
+            '─','║'
         },
         {// [0010]: double horizontal, single vertical
-            '╒','╤','╕',
-            '╞','╪','╡',
-            '╘','╧','╛',
-            '═','│'
+            '╒','╤','╕',
+            '╞','╪','╡',
+            '╘','╧','╛',
+            '═','│'
         },
         {// [0011]: double horizontal, double vertical
-            '╔','╦','╗',
-            '╠','╬','╣',
-            '╚','╩','╝',
-            '═','║'
+            '╔','╦','╗',
+            '╠','╬','╣',
+            '╚','╩','╝',
+            '═','║'
         }
     };
 
@@ -172,7 +172,7 @@ public class TableAppender extends Appen
      * Maximum width for each columns. This array length must
      * be equal to the number of columns in this table.
      */
-    private int[] maximalColumnWidths = EMPTY_INT;
+    private int[] maximalColumnWidths = ArraysExt.EMPTY_INT;
 
     /**
      * The line separator. We will use the first line separator found in the
@@ -242,9 +242,9 @@ public class TableAppender extends Appen
      */
     public TableAppender(final Appendable out) {
         super(out);
-        leftBorder      =  "║ ";
-        rightBorder     = " ║" ;
-        columnSeparator = " │ ";
+        leftBorder      =  "║ ";
+        rightBorder     = " ║" ;
+        columnSeparator = " │ ";
     }
 
     /**
@@ -256,7 +256,7 @@ public class TableAppender extends Appen
     public TableAppender(final Appendable out, final String separator) {
         super(out);
         /*
-         * Following methods use Character.isWhitespace(…) instead of Character.isSpaceChar(…).
+         * Following methods use Character.isWhitespace(…) instead of Character.isSpaceChar(…).
          * This has the effect of removing some ISO control characters (line feeds, tabulation,
          * etc.) from the border. If this policy is changed, search for other occurrences of
          * 'isWhitespace' in this class for ensuring consistency. Note however that the same
@@ -304,7 +304,7 @@ public class TableAppender extends Appen
         assert (verticalBorder >= -1) && (verticalBorder <= +1) : verticalBorder;
         /*
          * Remplaces spaces by the horizontal lines, and vertical lines by an intersection.
-         * Use Character.isWhitespace(…) instead of Character.isSpaceChar(…) for consistency
+         * Use Character.isWhitespace(…) instead of Character.isSpaceChar(…) for consistency
          * with the policy used in the constructor, since we work on the same object (namely
          * the border strings).
          */
@@ -372,7 +372,7 @@ public class TableAppender extends Appen
     /**
      * Sets the alignment of the text inside the current cell. The alignments of any cell
      * written prior this method call are left unchanged. The new alignment will apply to
-     * the next cells too until this {@code setCellAlignment(…)} method is invoked again
+     * the next cells too until this {@code setCellAlignment(…)} method is invoked again
      * with a different value.
      *
      * <p>If this method is never invoked, then the default alignment is {@link #ALIGN_LEFT}.</p>
@@ -481,7 +481,7 @@ public class TableAppender extends Appen
         try {
             start = appendSurrogate(sequence, start, end);
         } catch (IOException e) {
-            // Should never happen, because appendSurrogate(…) delegates to append(char)
+            // Should never happen, because appendSurrogate(…) delegates to append(char)
             // which is overriden without 'throws IOException' clause in this class.
             throw new AssertionError(e);
         }
@@ -530,7 +530,7 @@ public class TableAppender extends Appen
         if (currentColumn != 0 || buffer.length() != 0) {
             nextLine();
         }
-        nextLine('─');
+        nextLine('─');
     }
 
     /**
@@ -730,8 +730,8 @@ public class TableAppender extends Appen
                             /*
                              * Verify if the remaining contains only white spaces. If so, those spaces
                              * will be ignored. But if there is at least one non-white character, then
-                             * we will not skip those spaces. We use Character.isWhitespace(…) instead
-                             * of Character.isSpaceChar(…) in order to consider non-breaking spaces as
+                             * we will not skip those spaces. We use Character.isWhitespace(…) instead
+                             * of Character.isSpaceChar(…) in order to consider non-breaking spaces as
                              * non-white characters. This is similar to the use of &nbsp; in HTML tables,
                              * which can be used for forcing the insertion of an otherwise ignored space.
                              */
@@ -820,7 +820,7 @@ public class TableAppender extends Appen
     }
 
     /**
-     * Repeats a character. The {@code count} value may be negative,
+     * Repeats a character. The {@code count} value may be negative,
      * which is handled as if it was zero.
      *
      * @param out   The stream or buffer where to repeat the character.

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/TabularFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/TabularFormat.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/TabularFormat.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/TabularFormat.java [UTF-8] Thu May  9 12:24:13 2013
@@ -27,7 +27,7 @@ import org.apache.sis.util.ArgumentCheck
 import org.apache.sis.util.resources.Errors;
 
 // Related to JK7
-import org.apache.sis.internal.util.JDK7;
+import org.apache.sis.internal.jdk7.JDK7;
 
 
 /**
@@ -43,7 +43,7 @@ import org.apache.sis.internal.util.JDK7
  *
  * For implementors, this base class takes care of splitting a column separator pattern into
  * its components ({@link #beforeFill}, {@link #fillCharacter} and {@link #columnSeparator})
- * for easier usage in {@code format(…)} method implementations. Subclasses can use those fields
+ * for easier usage in {@code format(…)} method implementations. Subclasses can use those fields
  * like below:
  *
  * <table class="sis"><tr>
@@ -80,7 +80,7 @@ public abstract class TabularFormat<T> e
     /**
      * For cross-version compatibility.
      */
-    private static final long serialVersionUID = -1599411687892965650L;
+    private static final long serialVersionUID = -4556687020021477908L;
 
     /**
      * The line separator to use for formatting the tree.
@@ -135,7 +135,8 @@ public abstract class TabularFormat<T> e
     /**
      * Creates a new tabular format.
      *
-     * @param locale   The locale to use for numbers, dates and angles formatting.
+     * @param locale   The locale to use for numbers, dates and angles formatting,
+     *                 or {@code null} for the {@linkplain Locale#ROOT root locale}.
      * @param timezone The timezone, or {@code null} for UTC.
      */
     public TabularFormat(final Locale locale, final TimeZone timezone) {
@@ -223,8 +224,8 @@ public abstract class TabularFormat<T> e
      * </ul>
      *
      * {@section Example}
-     * The {@code "?……[…] "} pattern means "<cite>If the next value is non-null, then insert the
-     * {@code "……"} string, repeat the {@code '…'} character as many time as needed (may be zero),
+     * The {@code "?……[…] "} pattern means "<cite>If the next value is non-null, then insert the
+     * {@code "……"} string, repeat the {@code '…'} character as many time as needed (may be zero),
      * then insert a space</cite>".
      *
      * @param  pattern The pattern of the new column separator.
@@ -314,7 +315,7 @@ scan:   for (int i=0; i<length; i++) {
 
     /**
      * Returns a matcher for the column separators in the given text.
-     * This method is invoked by subclasses in their {@code parse(…)} implementations.
+     * This method is invoked by subclasses in their {@code parse(…)} implementations.
      *
      * @param  text The text for which to get a matcher.
      * @return A matcher for the column separators in the given text.

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/TabularFormat.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/package-info.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/math/FunctionProperty.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/math/MathFunctions.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/math/MathFunctions.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/math/MathFunctions.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/math/MathFunctions.java [UTF-8] Thu May  9 12:24:13 2013
@@ -18,6 +18,7 @@ package org.apache.sis.math;
 
 import java.util.Arrays;
 import org.apache.sis.util.Static;
+import org.apache.sis.util.ArraysExt;
 import org.apache.sis.util.Workaround;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Errors;
@@ -26,9 +27,6 @@ import static java.lang.Float.intBitsToF
 import static java.lang.Float.floatToRawIntBits;
 import static java.lang.Double.longBitsToDouble;
 import static java.lang.Double.doubleToRawLongBits;
-import static org.apache.sis.util.Arrays.resize;
-import static org.apache.sis.util.Arrays.isSorted;
-import static org.apache.sis.util.Arrays.EMPTY_INT;
 import static org.apache.sis.internal.util.Utilities.SIGN_BIT_MASK;
 
 
@@ -60,6 +58,8 @@ import static org.apache.sis.internal.ut
  * @since   0.3 (derived from geotk-1.0)
  * @version 0.3
  * @module
+ *
+ * @see org.apache.sis.util.Numbers
  */
 public final class MathFunctions extends Static {
     /**
@@ -152,13 +152,13 @@ public final class MathFunctions extends
      * Returns the magnitude of the given vector. This is defined by:
      *
      * {@preformat math
-     *     sqrt(vector[0]² + vector[1]² + … + vector[length-1]²)
+     *     sqrt(vector[0]² + vector[1]² + … + vector[length-1]²)
      * }
      *
      * {@section Implementation note}
      * In the special case where only one element is different than zero, this method
      * returns directly the {@linkplain Math#abs(double) absolute value} of that element
-     * without computing {@code sqrt(v²)}, in order to avoid rounding error. This special case
+     * without computing {@code sqrt(v²)}, in order to avoid rounding error. This special case
      * has been implemented because this method is often invoked for computing the length of
      * {@linkplain org.opengis.coverage.grid.RectifiedGrid#getOffsetVectors() offset vectors},
      * typically aligned with the axes of a {@linkplain org.opengis.referencing.cs.CartesianCS
@@ -216,8 +216,8 @@ public final class MathFunctions extends
      *       then this method returns 0.</li>
      *   <li>If {@code accuracy} is greater than 1, then this method returns
      *       the number of "unnecessary" trailing zeros as a negative number.
-     *       For example {@code fractionDigitsForDelta(100, …)} returns -2.</li>
-     *   <li>If the first non-zero digits of {@code accuracy} are equal or greater than 95
+     *       For example {@code fractionDigitsForDelta(100, …)} returns -2.</li>
+     *   <li>If the first non-zero digits of {@code accuracy} are equal or greater than 95
      *       (e.g. 0.00099) and the {@code strict} argument is {@code true}, then this method
      *       increases the number of needed fraction digits in order to prevent the rounded
      *       number to be collapsed into the next integer value.
@@ -227,16 +227,16 @@ public final class MathFunctions extends
      *       rounded value of 0.95 with 1 fraction digit would be 1.0. Such value would be a
      *       violation of this method contract since the difference between 0 and that formatted
      *       value would be greater than the accuracy. Note that this is not an artificial rule;
-     *       this is related to the fact that 0.9999… is mathematically strictly equals to 1.
+     *       this is related to the fact that 0.9999… is mathematically strictly equals to 1.
      *       </font></blockquote></li>
      * </ul>
      *
      * <p>Invoking this method is equivalent to computing <code>(int)
      * -{@linkplain Math#floor(double) floor}({@linkplain Math#log10(double) log10}(accuracy))</code>
-     * except for the 0, {@code NaN}, infinities and {@code 0.…95} special cases.</p>
+     * except for the 0, {@code NaN}, infinities and {@code 0.…95} special cases.</p>
      *
      * @param  accuracy The desired accuracy of numbers to format in base 10.
-     * @param  strict {@code true} for checking the {@code 0.…95} special case.
+     * @param  strict {@code true} for checking the {@code 0.…95} special case.
      *         If {@code false}, then the difference between adjacent formatted numbers is not
      *         guaranteed to be smaller than {@code accuracy} in every cases.
      * @return Number of fraction digits needed for formatting numbers with the given accuracy.
@@ -274,7 +274,7 @@ public final class MathFunctions extends
             scale = pow10(i);
         }
         while ((accuracy *= scale) >= 9.5) {
-            i++; // The 0.…95 special case.
+            i++; // The 0.…95 special case.
             accuracy -= Math.floor(accuracy);
             scale = 10;
         }
@@ -344,7 +344,7 @@ public final class MathFunctions extends
     /**
      * Returns the inverse hyperbolic tangent of the given value.
      * This is the inverse of the {@linkplain Math#tanh(double) tanh} method.
-     * The range of input values shall be in the [-1 … 1].
+     * The range of input values shall be in the [-1 … 1].
      * Special cases:
      *
      * <ul>
@@ -553,16 +553,16 @@ public final class MathFunctions extends
      *       then this method returns {@code true}.</li>
      *   <li>If both values {@linkplain Float#isNaN(float) are NaN}, then this method returns {@code true}.
      *       Note that this method does not differentiate the various NaN values.</li>
-     *   <li>Otherwise, this method returns the result of the {@code abs(v1 - v2) <= ε} comparison.</li>
+     *   <li>Otherwise, this method returns the result of the {@code abs(v1 - v2) <= ε} comparison.</li>
      * </ul>
      *
      * @param  v1 The first value to compare.
      * @param  v2 The second value to compare.
-     * @param  ε  The tolerance threshold, which must be positive.
+     * @param  ε  The tolerance threshold, which must be positive.
      * @return {@code true} If both values are equal given the tolerance threshold.
      */
-    public static boolean epsilonEqual(final float v1, final float v2, final float ε) {
-        return (Math.abs(v1 - v2) <= ε) || Float.floatToIntBits(v1) == Float.floatToIntBits(v2);
+    public static boolean epsilonEqual(final float v1, final float v2, final float ε) {
+        return (Math.abs(v1 - v2) <= ε) || Float.floatToIntBits(v1) == Float.floatToIntBits(v2);
     }
 
     /**
@@ -575,16 +575,16 @@ public final class MathFunctions extends
      *       then this method returns {@code true}.</li>
      *   <li>If both values {@linkplain Double#isNaN(double) are NaN}, then this method returns {@code true}.
      *       Note that this method does not differentiate the various NaN values.</li>
-     *   <li>Otherwise, this method returns the result of the {@code abs(v1 - v2) <= ε} comparison.</li>
+     *   <li>Otherwise, this method returns the result of the {@code abs(v1 - v2) <= ε} comparison.</li>
      * </ul>
      *
      * @param  v1 The first value to compare.
      * @param  v2 The second value to compare.
-     * @param  ε  The tolerance threshold, which must be positive.
+     * @param  ε  The tolerance threshold, which must be positive.
      * @return {@code true} If both values are equal given the tolerance threshold.
      */
-    public static boolean epsilonEqual(final double v1, final double v2, final double ε) {
-        return (Math.abs(v1 - v2) <= ε) || Double.doubleToLongBits(v1) == Double.doubleToLongBits(v2);
+    public static boolean epsilonEqual(final double v1, final double v2, final double ε) {
+        return (Math.abs(v1 - v2) <= ε) || Double.doubleToLongBits(v1) == Double.doubleToLongBits(v2);
     }
 
     /**
@@ -593,9 +593,9 @@ public final class MathFunctions extends
      * This method allocates one of valid NaN bit fields to each ordinal value.
      *
      * <ul>
-     *   <li>[{@code 0x7F800001} … {@code 0x7FFFFFFF}], with
+     *   <li>[{@code 0x7F800001} … {@code 0x7FFFFFFF}], with
      *        {@code 0x7FC00000} as the bit fields of the standard {@link Float#NaN} value</li>
-     *   <li>[{@code 0xFF800001} … {@code 0xFFFFFFFF}]</li>
+     *   <li>[{@code 0xFF800001} … {@code 0xFFFFFFFF}]</li>
      * </ul>
      *
      * The relationship between bit fields and ordinal values is implementation dependent and may
@@ -643,7 +643,7 @@ public final class MathFunctions extends
 
     /**
      * Returns the <var>i</var><sup>th</sup> prime number.
-     * This method returns (2, 3, 5, 7, 11, …) for index (0, 1, 2, 3, 4, …).
+     * This method returns (2, 3, 5, 7, 11, …) for index (0, 1, 2, 3, 4, …).
      *
      * @param  index The prime number index, starting at index 0 for prime number 2.
      * @return The prime number at the specified index.
@@ -687,7 +687,7 @@ testNextNumber:         while (true) { /
     /**
      * Returns the first prime number equals or greater than the given value.
      * Current implementation accepts only values in the
-     * [2 … {@value #HIGHEST_SUPPORTED_PRIME_NUMBER}] range.
+     * [2 … {@value #HIGHEST_SUPPORTED_PRIME_NUMBER}] range.
      *
      * @param  number The number for which to find the next prime.
      * @return The given number if it is a prime number, or the next prime number otherwise.
@@ -727,7 +727,7 @@ testNextNumber:         while (true) { /
      */
     public static int[] divisors(int number) {
         if (number == 0) {
-            return EMPTY_INT;
+            return ArraysExt.EMPTY_INT;
         }
         number = Math.abs(number);
         int[] divisors = new int[16];
@@ -788,8 +788,8 @@ testNextNumber:         while (true) { /
                 }
             }
         }
-        divisors = resize(divisors, count);
-        assert isSorted(divisors, true);
+        divisors = ArraysExt.resize(divisors, count);
+        assert ArraysExt.isSorted(divisors, true);
         return divisors;
     }
 
@@ -801,7 +801,7 @@ testNextNumber:         while (true) { /
      */
     public static int[] commonDivisors(final int... numbers) {
         if (numbers.length == 0) {
-            return EMPTY_INT;
+            return ArraysExt.EMPTY_INT;
         }
         /*
          * Get the smallest value. We will compute the divisors only for this value,
@@ -831,6 +831,6 @@ testNextNumber:         while (true) { /
                 }
             }
         }
-        return resize(divisors, count);
+        return ArraysExt.resize(divisors, count);
     }
 }

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/math/MathFunctions.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/math/Statistics.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/math/Statistics.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/math/Statistics.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/math/Statistics.java [UTF-8] Thu May  9 12:24:13 2013
@@ -27,26 +27,26 @@ import static java.lang.Double.isNaN;
 import static java.lang.Double.doubleToLongBits;
 
 // Related to JDK7
-import org.apache.sis.internal.util.Objects;
+import org.apache.sis.internal.jdk7.Objects;
 
 
 /**
  * Holds some statistics derived from a series of sample values.
- * Given a series of <var>y₀</var>, <var>y₁</var>, <var>y₂</var>, <var>y₃</var>, <i>etc…</i> samples,
+ * Given a series of <var>y₀</var>, <var>y₁</var>, <var>y₂</var>, <var>y₃</var>, <i>etc…</i> samples,
  * this class computes the {@linkplain #minimum() minimum}, {@linkplain #maximum() maximum},
  * {@linkplain #mean() mean}, {@linkplain #rms() root mean square} and
  * {@linkplain #standardDeviation(boolean) standard deviation} of the given samples.
  *
  * <p>In addition to the statistics on the sample values, this class can optionally compute
  * statistics on the differences between consecutive sample values, i.e. the statistics on
- * <var>y₁</var>-<var>y₀</var>, <var>y₂</var>-<var>y₁</var>, <var>y₃</var>-<var>y₂</var>, <i>etc…</i>,
+ * <var>y₁</var>-<var>y₀</var>, <var>y₂</var>-<var>y₁</var>, <var>y₃</var>-<var>y₂</var>, <i>etc…</i>,
  * Those statistics can be fetched by a call to {@link #differences()}.
  * They are useful for verifying if the interval between sample values is approximatively constant.</p>
  *
  * <p>If the samples are (at least conceptually) the result of some <var>y</var>=<var>f</var>(<var>x</var>)
- * function for <var>x</var> values increasing or decreasing at a constant interval Δ<var>x</var>,
+ * function for <var>x</var> values increasing or decreasing at a constant interval Δ<var>x</var>,
  * then one can get the statistics on the <cite>discrete derivatives</cite> by a call to
- * <code>differences().{@linkplain #scale(double) scale}(1/Δx)</code>.</p>
+ * <code>differences().{@linkplain #scale(double) scale}(1/Δx)</code>.</p>
  *
  * <p>Statistics are computed on the fly using the
  * <a href="http://en.wikipedia.org/wiki/Kahan_summation_algorithm">Kahan summation algorithm</a>
@@ -54,7 +54,7 @@ import org.apache.sis.internal.util.Obje
  *
  * <p>An instance of {@code Statistics} is initially empty: the {@linkplain #count() count} of
  * values is set to zero, and all above-cited statistical values are set to {@link Double#NaN NaN}.
- * The statistics are updated every time an {@link #add(double)} method is invoked with a non-NaN
+ * The statistics are updated every time an {@link #accept(double)} method is invoked with a non-NaN
  * value.</p>
  *
  * {@section Examples}
@@ -64,7 +64,7 @@ import org.apache.sis.internal.util.Obje
  * {@preformat java
  *     Statistics stats = new Statistics("y");
  *     for (int i=0; i<numberOfValues; i++) {
- *         stats.add(f(i));
+ *         stats.accept(f(i));
  *     }
  *     System.out.println(stats);
  * }
@@ -73,13 +73,13 @@ import org.apache.sis.internal.util.Obje
  * in addition to the statistics on the sample values:
  *
  * {@preformat java
- *     final double x₀ = ...; // Put here the x value at i=0
- *     final double Δx = ...; // Put here the interval between x values
- *     Statistics stats = Statistics.forSeries("y", "∂y/∂x", "∂²y/∂x²");
+ *     final double x₀ = ...; // Put here the x value at i=0
+ *     final double Δx = ...; // Put here the interval between x values
+ *     Statistics stats = Statistics.forSeries("y", "∂y/∂x", "∂²y/∂x²");
  *     for (int i=0; i<numberOfValues; i++) {
- *         stats.add(f(x₀ + i*Δx));
+ *         stats.accept(f(x₀ + i*Δx));
  *     }
- *     stats.differences().scale(1/Δx);
+ *     stats.differences().scale(1/Δx);
  *     System.out.println(stats);
  * }
  *
@@ -92,7 +92,7 @@ public class Statistics implements Clone
     /**
      * Serial number for compatibility with different versions.
      */
-    private static final long serialVersionUID = -22884277805533726L;
+    private static final long serialVersionUID = 8495118253884975477L;
 
     /**
      * The name of the phenomenon for which this object is collecting statistics.
@@ -104,22 +104,22 @@ public class Statistics implements Clone
     private final InternationalString name;
 
     /**
-     * The minimal value given to the {@link #add(double)} method.
+     * The minimal value given to the {@link #accept(double)} method.
      */
     private double minimum = NaN;
 
     /**
-     * The maximal value given to the {@link #add(double)} method.
+     * The maximal value given to the {@link #accept(double)} method.
      */
     private double maximum = NaN;
 
     /**
-     * The sum of all values given to the {@link #add(double)} method.
+     * The sum of all values given to the {@link #accept(double)} method.
      */
     private double sum;
 
     /**
-     * The sum of square of all values given to the {@link #add(double)} method.
+     * The sum of square of all values given to the {@link #accept(double)} method.
      */
     private double squareSum;
 
@@ -136,12 +136,12 @@ public class Statistics implements Clone
     private transient double squareLowBits;
 
     /**
-     * Number of non-NaN values given to the {@link #add(double)} method.
+     * Number of non-NaN values given to the {@link #accept(double)} method.
      */
     private int count;
 
     /**
-     * Number of NaN values given to the {@link #add(double)} method.
+     * Number of NaN values given to the {@link #accept(double)} method.
      * Those value are ignored in the computation of all above values.
      */
     private int countNaN;
@@ -152,7 +152,7 @@ public class Statistics implements Clone
      * and all other statistical values are initialized to {@link Double#NaN}.
      *
      * <p>Instances created by this constructor do not compute differences between sample values.
-     * If differences or discrete derivatives are wanted, use the {@link #forSeries forSeries(…)}
+     * If differences or discrete derivatives are wanted, use the {@link #forSeries forSeries(…)}
      * method instead.</p>
      *
      * @param name The phenomenon for which this object is collecting statistics, or {@code null}
@@ -165,17 +165,17 @@ public class Statistics implements Clone
 
     /**
      * Constructs a new {@code Statistics} object which will also compute finite differences
-     * up to the given order. If the values to be given to the {@code add(…)} methods are the
-     * <var>y</var> values of some <var>y</var>=<var>f</var>(<var>x</var>) function for
-     * <var>x</var> values increasing or decreasing at a constant interval Δ<var>x</var>,
+     * up to the given order. If the values to be given to the {@code accept(…)} methods are
+     * the <var>y</var> values of some <var>y</var>=<var>f</var>(<var>x</var>) function for
+     * <var>x</var> values increasing or decreasing at a constant interval Δ<var>x</var>,
      * then the finite differences are proportional to discrete derivatives.
      *
-     * <p>The {@code Statistics} object created by this method know nothing about the Δ<var>x</var>
+     * <p>The {@code Statistics} object created by this method know nothing about the Δ<var>x</var>
      * interval. In order to get the discrete derivatives, the following method needs to be invoked
      * <em>after</em> all sample values have been added:</p>
      *
      * {@preformat java
-     *     statistics.differences().scale(1/Δx);
+     *     statistics.differences().scale(1/Δx);
      * }
      *
      * The maximal "derivative" order is determined by the length of the {@code differenceNames} array:
@@ -245,23 +245,26 @@ public class Statistics implements Clone
      * {@link Double#NaN NaN} values increment the {@linkplain #countNaN() NaN count},
      * but are otherwise ignored.
      *
+     * {@note This method is named <code>accept</code> for compatibility with the
+     *        <code>java.util.function.DoubleConsumer</code> interface in JDK8.}
+     *
      * @param sample The sample value (may be NaN).
      *
-     * @see #add(long)
-     * @see #add(Statistics)
+     * @see #accept(long)
+     * @see #combine(Statistics)
      */
-    public void add(final double sample) {
+    public void accept(final double sample) {
         if (isNaN(sample)) {
             countNaN++;
         } else {
-            addReal(sample);
+            real(sample);
         }
     }
 
     /**
-     * Implementation of {@link #add(double)} for real (non-NaN) numbers.
+     * Implementation of {@link #accept(double)} for real (non-NaN) numbers.
      */
-    private void addReal(double sample) {
+    private void real(double sample) {
         // Two next lines use !(a >= b) instead than
         // (a < b) in order to take NaN in account.
         if (!(minimum <= sample)) minimum = sample;
@@ -282,25 +285,28 @@ public class Statistics implements Clone
     /**
      * Updates statistics for the specified integer sample value.
      * For very large integer values (greater than 2<sup>52</sup> in magnitude),
-     * this method may be more accurate than the {@link #add(double)} version.
+     * this method may be more accurate than the {@link #accept(double)} version.
+     *
+     * {@note This method is named <code>accept</code> for compatibility with the
+     *        <code>java.util.function.LongConsumer</code> interface in JDK8.}
      *
      * @param sample The sample value.
      *
-     * @see #add(double)
-     * @see #add(Statistics)
+     * @see #accept(double)
+     * @see #combine(Statistics)
      */
-    public void add(final long sample) {
-        addReal(sample);
+    public void accept(final long sample) {
+        real(sample);
     }
 
     /**
      * Updates statistics with all samples from the specified {@code stats}.
      * Invoking this method is equivalent (except for rounding errors) to invoking
-     * {@link #add(double) add} for all samples that were added to {@code stats}.
+     * {@link #accept(double) accept(…)} for all samples that were added to {@code stats}.
      *
      * @param stats The statistics to be added to {@code this}.
      */
-    public void add(final Statistics stats) {
+    public void combine(final Statistics stats) {
         ArgumentChecks.ensureNonNull("stats", stats);
 
         // "if (a < b)" is equivalent to "if (!isNaN(a) && a < b)".
@@ -321,10 +327,10 @@ public class Statistics implements Clone
      * Multiplies the statistics by the given factor. The given scale factory is also applied
      * recursively on the {@linkplain #differences() differences} statistics, if any.
      * Invoking this method transforms the statistics as if every values given to the
-     * {@code add(…)} had been first multiplied by the given factor.
+     * {@code accept(…)} had been first multiplied by the given factor.
      *
      * <p>This method is useful for computing discrete derivatives from the differences between
-     * sample values. See {@link #differences()} or {@link #forSeries forSeries(…)} for more
+     * sample values. See {@link #differences()} or {@link #forSeries forSeries(…)} for more
      * information.</p>
      *
      * @param factor The factor by which to multiply the statistics.
@@ -423,7 +429,7 @@ public class Statistics implements Clone
     }
 
     /**
-     * Returns the standard deviation. If the sample values given to the {@code add(…)}
+     * Returns the standard deviation. If the sample values given to the {@code accept(…)}
      * methods have a uniform distribution, then the returned value should be close to
      * <code>sqrt({@linkplain #span() span}<sup>2</sup> / 12)</code>. If they have a
      * Gaussian distribution (which is the most common case), then the returned value
@@ -431,7 +437,7 @@ public class Statistics implements Clone
      * function</a>.
      *
      * <p>As a reminder, the table below gives the probability for a sample value to be
-     * inside the {@linkplain #mean() mean} ± <var>n</var> × <var>deviation range</var>,
+     * inside the {@linkplain #mean() mean} ± <var>n</var> × <var>deviation range</var>,
      * assuming that the distribution is Gaussian (first column) or assuming that the
      * distribution is uniform (second column).</p>
      *
@@ -445,7 +451,7 @@ public class Statistics implements Clone
      * </table>
      *
      * @param allPopulation
-     *          {@code true} if sample values given to {@code add(…)} methods were the totality
+     *          {@code true} if sample values given to {@code accept(…)} methods were the totality
      *          of the population under study, or {@code false} if they were only a sampling.
      * @return  The standard deviation.
      */
@@ -455,23 +461,23 @@ public class Statistics implements Clone
 
     /**
      * Returns the statistics on the differences between sample values, or {@code null} if none.
-     * For example if the sample values given to the {@code add(…)} methods were <var>y₀</var>,
-     * <var>y₁</var>, <var>y₂</var> and <var>y₃</var>, then this method returns statistics on
-     * <var>y₁</var>-<var>y₀</var>, <var>y₂</var>-<var>y₁</var> and <var>y₃</var>-<var>y₂</var>.
+     * For example if the sample values given to the {@code accept(…)} methods were <var>y₀</var>,
+     * <var>y₁</var>, <var>y₂</var> and <var>y₃</var>, then this method returns statistics on
+     * <var>y₁</var>-<var>y₀</var>, <var>y₂</var>-<var>y₁</var> and <var>y₃</var>-<var>y₂</var>.
      *
      * <p>The differences between sample values are related to the discrete derivatives as below,
-     * where Δ<var>x</var> is the constant interval between the <var>x</var> values of the
+     * where Δ<var>x</var> is the constant interval between the <var>x</var> values of the
      * <var>y</var>=<var>f</var>(<var>x</var>) function:</p>
      *
      * {@preformat java
      *     Statistics derivative = statistics.differences();
-     *     derivative.scale(1/Δx); // Shall be invoked only once.
+     *     derivative.scale(1/Δx); // Shall be invoked only once.
      *     Statistics secondDerivative = derivative.differences();
-     *     // Do not invoke scale(1/Δx) again.
+     *     // Do not invoke scale(1/Δx) again.
      * }
      *
      * This method returns a non-null value only if this {@code Statistics} instance has been created by a
-     * call to the {@link #forSeries forSeries(…)} method with a non-empty {@code differenceNames} array.
+     * call to the {@link #forSeries forSeries(…)} method with a non-empty {@code differenceNames} array.
      * More generally, calls to this method can be chained up to {@code differenceNames.length} times for
      * fetching second or higher order derivatives, as in the above example.
      *
@@ -559,9 +565,9 @@ public class Statistics implements Clone
 
     /**
      * Holds some statistics about the difference between consecutive sample values.
-     * Given a series of <var>s₀</var>, <var>s₁</var>, <var>s₂</var>, <var>s₃</var>,
-     * <i>etc…</i> samples, this class computes statistics for <var>s₁</var>-<var>s₀</var>,
-     * <var>s₂</var>-<var>s₁</var>, <var>s₃</var>-<var>s₂</var>, <i>etc…</i>
+     * Given a series of <var>s₀</var>, <var>s₁</var>, <var>s₂</var>, <var>s₃</var>,
+     * <i>etc…</i> samples, this class computes statistics for <var>s₁</var>-<var>s₀</var>,
+     * <var>s₂</var>-<var>s₁</var>, <var>s₃</var>-<var>s₂</var>, <i>etc…</i>
      * which are stored in a {@link #delta} statistics object.
      *
      * @author  Martin Desruisseaux (MPO, IRD, Geomatys)
@@ -573,7 +579,7 @@ public class Statistics implements Clone
         /**
          * Serial number for compatibility with different versions.
          */
-        private static final long serialVersionUID = 3464306833883333219L;
+        private static final long serialVersionUID = -5149634417399815874L;
 
         /**
          * Statistics about the differences between consecutive sample values.
@@ -582,13 +588,13 @@ public class Statistics implements Clone
         private Statistics delta;
 
         /**
-         * Last value given to an {@link #add(double) add} method as
-         * a {@code double}, or {@link Double#NaN NaN} if none.
+         * Last value given to an {@link #accept(double)} method as
+         * a {@code double}, or {@link Double#NaN} if none.
          */
         private double last = NaN;
 
         /**
-         * Last value given to an {@link #add(long) add}
+         * Last value given to an {@link #accept(long)}
          * method as a {@code long}, or 0 if none.
          */
         private long lastAsLong;
@@ -632,31 +638,31 @@ public class Statistics implements Clone
          * Updates statistics for the specified sample value and its discrete derivatives.
          * The {@link #delta} statistics are updated with <code>sample - sample<sub>last</sub></code>
          * value, where <code>sample<sub>last</sub></code> is the value given to the previous call of
-         * an {@code add(…)} method.
+         * an {@code accept(…)} method.
          */
         @Override
-        public void add(final double sample) {
-            super.add(sample);
-            delta.add(sample - last);
+        public void accept(final double sample) {
+            super.accept(sample);
+            delta.accept(sample - last);
             last       = sample;
             lastAsLong = (long) sample;
         }
 
         /**
-         * Performs the same work than {@link #add(double)}, but with greater precision for
+         * Performs the same work than {@link #accept(double)}, but with greater precision for
          * very large integer values (greater than 2<sup>52</sup> in magnitude),
          */
         @Override
-        public void add(final long sample) {
-            super.add(sample);
+        public void accept(final long sample) {
+            super.accept(sample);
             if (last == (double) lastAsLong) {
                 // 'lastAsLong' may have more precision than 'last' since the cast to the
-                // 'double' type may loose some digits. Invoke the 'delta.add(long)' version.
-                delta.add(sample - lastAsLong);
+                // 'double' type may loose some digits. Invoke the 'delta.accept(long)' version.
+                delta.accept(sample - lastAsLong);
             } else {
                 // The sample value is either fractional, outside 'long' range,
-                // infinity or NaN. Invoke the 'delta.add(double)' version.
-                delta.add(sample - last);
+                // infinity or NaN. Invoke the 'delta.accept(double)' version.
+                delta.accept(sample - last);
             }
             last       = sample;
             lastAsLong = sample;
@@ -669,10 +675,10 @@ public class Statistics implements Clone
          *         {@code Statistics.Delta}.
          */
         @Override
-        public void add(final Statistics stats) throws ClassCastException {
+        public void combine(final Statistics stats) throws ClassCastException {
             ArgumentChecks.ensureNonNull("stats", stats);
-            delta.add(stats.differences());
-            super.add(stats);
+            delta.combine(stats.differences());
+            super.combine(stats);
             if (stats instanceof WithDelta) {
                 final WithDelta toAdd = (WithDelta) stats;
                 last       = toAdd.last;

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/math/Statistics.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java [UTF-8] Thu May  9 12:24:13 2013
@@ -55,7 +55,7 @@ public class StatisticsFormat extends Ta
     /**
      * For cross-version compatibility.
      */
-    private static final long serialVersionUID = -7393669354879347985L;
+    private static final long serialVersionUID = 6914760410359494163L;
 
     /**
      * Number of additional digits, to be added to the number of digits computed from the
@@ -78,7 +78,7 @@ public class StatisticsFormat extends Ta
     private byte borderWidth;
 
     /**
-     * {@code true} if the sample values given to {@code Statistics.add(…)} methods were the
+     * {@code true} if the sample values given to {@code Statistics.accept(…)} methods were the
      * totality of the population under study, or {@code false} if they were only a sampling.
      *
      * @see #isForAllPopulation()
@@ -110,13 +110,14 @@ public class StatisticsFormat extends Ta
      * Constructs a new format for the given numeric and header locales.
      * The timezone is used only if the values added to the {@link Statistics} are dates.
      *
-     * @param locale       The locale for numeric values, or {@code null} for unlocalized format.
+     * @param locale       The locale to use for numbers, dates and angles formatting,
+     *                     or {@code null} for the {@linkplain Locale#ROOT root locale}.
      * @param headerLocale The locale for row and column headers. Usually same as {@code locale}.
      * @param timezone     The timezone, or {@code null} for UTC.
      */
     public StatisticsFormat(final Locale locale, final Locale headerLocale, final TimeZone timezone) {
         super(locale, timezone);
-        this.headerLocale = headerLocale;
+        this.headerLocale = (headerLocale != null) ? headerLocale : Locale.ROOT;
     }
 
     /**
@@ -170,8 +171,8 @@ public class StatisticsFormat extends Ta
      *
      * <ul>
      *  <li>0 (the default) for no border</li>
-     *  <li>1 for single line ({@code │},{@code ─})</li>
-     *  <li>2 for double lines ({@code ║},{@code ═})</li>
+     *  <li>1 for single line ({@code │},{@code ─})</li>
+     *  <li>2 for double lines ({@code ║},{@code ═})</li>
      * </ul>
      *
      * @param borderWidth The border width, in number of lines.
@@ -264,8 +265,8 @@ public class StatisticsFormat extends Ta
         char horizontalLine = 0;
         String separator = columnSeparator;
         switch (borderWidth) {
-            case 1: horizontalLine = '─'; separator += "│ "; break;
-            case 2: horizontalLine = '═'; separator += "║ "; break;
+            case 1: horizontalLine = '─'; separator += "│ "; break;
+            case 2: horizontalLine = '═'; separator += "║ "; break;
         }
         final TableAppender table = new TableAppender(toAppendTo, separator);
         final Vocabulary resources = Vocabulary.getResources(headerLocale);

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/math/package-info.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/Angle.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/Angle.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/Angle.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/Angle.java [UTF-8] Thu May  9 12:24:13 2013
@@ -24,9 +24,10 @@ import java.text.Format;
 import java.text.ParseException;
 import java.io.Serializable;
 import net.jcip.annotations.Immutable;
-import org.apache.sis.math.MathFunctions;
+import org.apache.sis.internal.util.Utilities;
 
 import static java.lang.Double.doubleToLongBits;
+import static org.apache.sis.math.MathFunctions.isNegative;
 
 
 /**
@@ -54,7 +55,7 @@ public class Angle implements Comparable
     /**
      * Serial number for inter-operability with different versions.
      */
-    private static final long serialVersionUID = 1158747349433104534L;
+    private static final long serialVersionUID = 3701568577051191744L;
 
     /**
      * A shared instance of {@link AngleFormat}.
@@ -66,26 +67,26 @@ public class Angle implements Comparable
     /**
      * Angle value in decimal degrees. We use decimal degrees as the storage unit
      * instead than radians in order to avoid rounding errors, since there is no
-     * way to represent 30°, 45°, 90°, 180°, <i>etc.</i> in radians without errors.
+     * way to represent 30°, 45°, 90°, 180°, <i>etc.</i> in radians without errors.
      */
-    private final double θ;
+    private final double θ;
 
     /**
      * Constructs a new angle with the specified value in decimal degrees.
      *
-     * @param θ Angle in decimal degrees.
+     * @param θ Angle in decimal degrees.
      */
-    public Angle(final double θ) {
-        this.θ = θ;
+    public Angle(final double θ) {
+        this.θ = θ;
     }
 
     /**
      * Constructs a newly allocated {@code Angle} object that contain the angular value
      * represented by the string. The string should represent an angle in either fractional
-     * degrees (e.g. 45.5°) or degrees with minutes and seconds (e.g. 45°30').
+     * degrees (e.g. 45.5°) or degrees with minutes and seconds (e.g. 45°30').
      *
      * <p>This is a convenience constructor mostly for testing purpose, since it uses a fixed
-     * locale. Developers should consider using {@link AngleFormat} for end-user applications
+     * locale. Developers should consider using {@link AngleFormat} for end-user applications
      * instead than this constructor.</p>
      *
      * @param  string A string to be converted to an {@code Angle}.
@@ -102,7 +103,7 @@ public class Angle implements Comparable
         } catch (ParseException exception) {
             /*
              * Use Exception.getMessage() instead than getLocalizedMessage() because the later
-             * is formatted in the AngleFormat locale, which is hard-coded to Locale.US in our
+             * is formatted in the AngleFormat locale, which is hard-coded to Locale.ROOT in our
              * 'getAngleFormat()' implementation. The getMessage() method uses the system locale,
              * which is what we actually want.
              */
@@ -112,7 +113,7 @@ public class Angle implements Comparable
         }
         final Class<?> type = angle.getClass();
         if (type == Angle.class || getClass().isAssignableFrom(type)) {
-            this.θ = ((Angle) angle).θ;
+            this.θ = ((Angle) angle).θ;
         } else {
             throw new NumberFormatException(string);
         }
@@ -124,7 +125,7 @@ public class Angle implements Comparable
      * @return The angle value in decimal degrees.
      */
     public double degrees() {
-        return θ;
+        return θ;
     }
 
     /**
@@ -133,7 +134,7 @@ public class Angle implements Comparable
      * @return The angle value in radians.
      */
     public double radians() {
-        return Math.toRadians(θ);
+        return Math.toRadians(θ);
     }
 
     /**
@@ -141,7 +142,7 @@ public class Angle implements Comparable
      */
     @Override
     public int hashCode() {
-        final long code = Double.doubleToLongBits(θ);
+        final long code = Double.doubleToLongBits(θ);
         return (int) code ^ (int) (code >>> 32) ^ (int) serialVersionUID;
     }
 
@@ -157,7 +158,7 @@ public class Angle implements Comparable
             return true;
         }
         if (object != null && getClass() == object.getClass()) {
-            return doubleToLongBits(θ) == doubleToLongBits(((Angle) object).θ);
+            return doubleToLongBits(θ) == doubleToLongBits(((Angle) object).θ);
         }
         return false;
     }
@@ -171,12 +172,12 @@ public class Angle implements Comparable
      */
     @Override
     public int compareTo(final Angle that) {
-        return Double.compare(this.θ, that.θ);
+        return Double.compare(this.θ, that.θ);
     }
 
     /**
      * Upper threshold before to format an angle as an ordinary number.
-     * This is set to 90° in the case of latitude numbers.
+     * This is set to 90° in the case of latitude numbers.
      */
     double maximum() {
         return 360;
@@ -193,7 +194,7 @@ public class Angle implements Comparable
     /**
      * Returns a string representation of this {@code Angle} object.
      * This is a convenience method mostly for debugging purpose, since it uses a fixed locale.
-     * Developers should consider using {@link AngleFormat} for end-user applications instead
+     * Developers should consider using {@link AngleFormat} for end-user applications instead
      * than this method.
      *
      * @see AngleFormat#format(double)
@@ -201,16 +202,16 @@ public class Angle implements Comparable
     @Override
     public String toString() {
         StringBuffer buffer = new StringBuffer();
-        double m = Math.abs(θ);
+        double m = Math.abs(θ);
         final boolean isSmall = m <= (1 / 3600E+3); // 1E-3 arc-second.
         if (isSmall || m > maximum()) {
-            final char h = hemisphere(MathFunctions.isNegative(θ));
+            final char h = hemisphere(isNegative(θ));
             if (h == 0) {
-                m = θ;  // Restore the sign.
+                m = θ;  // Restore the sign.
             }
-            char symbol = '°';
+            char symbol = '°';
             if (isSmall) {
-                symbol = '″';
+                symbol = '″';
                 m *= 3600;
             }
             buffer.append(m).append(symbol);
@@ -240,7 +241,7 @@ public class Angle implements Comparable
     private static Format getAngleFormat() {
         assert Thread.holdsLock(Angle.class);
         if (format == null) {
-            format = AngleFormat.getInstance(Locale.US);
+            format = AngleFormat.getInstance(Locale.ROOT);
         }
         return format;
     }
@@ -255,9 +256,7 @@ public class Angle implements Comparable
      *   <li>If the precision is 0, then this method formats an empty string.</li>
      *   <li>If the precision is 1 and this angle is a {@link Latitude} or {@link Longitude},
      *       then this method formats only the hemisphere symbol.</li>
-     *   <li>Otherwise the precision, if positive, is given to {@link AngleFormat#setMaximumWidth(int)}.
-     *       That formatter will try to respect the precision limit, but the formatted angle may
-     *       still be wider if the precision is too small or the angle magnitude too large.</li>
+     *   <li>Otherwise the precision, if positive, is given to {@link AngleFormat#setMaximumWidth(int)}.</li>
      * </ul>
      *
      * @param formatter The formatter in which to format this angle.
@@ -266,24 +265,23 @@ public class Angle implements Comparable
      * @param precision Maximal number of characters to write, or -1 if no limit.
      */
     @Override
-    public void formatTo(final Formatter formatter, final int flags, final int width, int precision) {
+    public void formatTo(final Formatter formatter, final int flags, final int width, final int precision) {
         final String value;
         if (precision == 0) {
             value = "";
         } else {
-            if (precision > 0) {
-                final char h = hemisphere(MathFunctions.isNegative(θ));
-                if (h != 0 && --precision == 0) {
-                    formatter.format("%c", h);
-                    return;
+            final char h;
+            int w = precision; // To be decremented only if we may truncate and an hemisphere symbol exist.
+            if (w > 0 && (h = hemisphere(isNegative(θ))) != 0 && --w == 0) {
+                value = Character.toString(h);
+            } else {
+                final AngleFormat format = new AngleFormat(formatter.locale());
+                if (w > 0) {
+                    format.setMaximumWidth(w);
                 }
+                value = format.format(this, new StringBuffer(), null).toString();
             }
-            final AngleFormat format = new AngleFormat(formatter.locale());
-            if (precision > 0) {
-                format.setMaximumWidth(precision);
-            }
-            value = format.format(this, new StringBuffer(), null).toString();
         }
-        org.apache.sis.internal.util.Utilities.formatTo(formatter, flags, width, value);
+        Utilities.formatTo(formatter, flags, width, precision, value);
     }
 }

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/Angle.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java [UTF-8] Thu May  9 12:24:13 2013
@@ -44,7 +44,7 @@ import static org.apache.sis.math.MathFu
 import static org.apache.sis.math.MathFunctions.fractionDigitsForDelta;
 
 // Related to JDK7
-import org.apache.sis.internal.util.Objects;
+import org.apache.sis.internal.jdk7.Objects;
 
 
 /**
@@ -65,12 +65,12 @@ import org.apache.sis.internal.util.Obje
  *
  * Upper-case letters {@code D}, {@code M} and {@code S} stand for the integer parts of degrees,
  * minutes and seconds respectively. They shall appear in this order. For example {@code M'D} is
- * illegal because "M" and "S" are in reverse order; {@code D°S} is illegal too because "M" is
+ * illegal because "M" and "S" are in reverse order; {@code D°S} is illegal too because "M" is
  * missing between "D" and "S".
  *
  * <p>Lower-case letters {@code d}, {@code m} and {@code s} stand for fractional parts of degrees,
  * minutes and seconds respectively. Only one of those may appears in a pattern, and it must be
- * the last special symbol. For example {@code D.dd°MM'} is illegal because "d" is followed by
+ * the last special symbol. For example {@code D.dd°MM'} is illegal because "d" is followed by
  * "M"; {@code D.mm} is illegal because "m" is not the fractional part of "D".</p>
  *
  * <p>The number of occurrence of {@code D}, {@code M}, {@code S} and their lower-case counterpart
@@ -78,19 +78,19 @@ import org.apache.sis.internal.util.Obje
  * for the integer part and three digits for the fractional part (e.g. 4.4578 will be formatted as
  * "04.458").</p>
  *
- * <p>Separator characters like {@code °}, {@code ′} and {@code ″} are inserted "as-is" in the
+ * <p>Separator characters like {@code °}, {@code ′} and {@code ″} are inserted "as-is" in the
  * formatted string, except the decimal separator dot ({@code .}) which is replaced by the
  * local-dependent decimal separator. Separator characters may be completely omitted;
  * {@code AngleFormat} will still differentiate degrees, minutes and seconds fields according
  * the pattern. For example, "{@code 0480439}" with the pattern {@code DDDMMmm} will be parsed
- * as 48°04.39'.</p>
+ * as 48°04.39'.</p>
  *
  * <p>The following table gives some pattern examples:</p>
  *
  * <table class="sis">
  *   <tr><th>Pattern           </th>  <th>Example   </th></tr>
- *   <tr><td>{@code DD°MM′SS″ }</td>  <td>48°30′00″ </td></tr>
- *   <tr><td>{@code DD°MM′    }</td>  <td>48°30′    </td></tr>
+ *   <tr><td>{@code DD°MM′SS″ }</td>  <td>48°30′00″ </td></tr>
+ *   <tr><td>{@code DD°MM′    }</td>  <td>48°30′    </td></tr>
  *   <tr><td>{@code DD.ddd    }</td>  <td>48.500    </td></tr>
  *   <tr><td>{@code DD.###    }</td>  <td>48.5      </td></tr>
  *   <tr><td>{@code DDMM      }</td>  <td>4830      </td></tr>
@@ -111,7 +111,7 @@ public class AngleFormat extends Format 
     /**
      * Serial number for inter-operability with different versions.
      */
-    private static final long serialVersionUID = 4320403817210439764L;
+    private static final long serialVersionUID = 820524050016391537L;
 
     /**
      * Hemisphere symbols. Must be upper-case.
@@ -186,7 +186,7 @@ public class AngleFormat extends Format 
         /**
          * For cross-version compatibility.
          */
-        private static final long serialVersionUID = 3824094360855371451L;
+        private static final long serialVersionUID = -5015489890305908251L;
 
         /**
          * Creates a new field of the given name. The given name shall
@@ -239,7 +239,7 @@ public class AngleFormat extends Format 
     }
 
     /**
-     * The locale specified at construction time.
+     * The locale specified at construction time (never null).
      */
     private final Locale locale;
 
@@ -361,14 +361,15 @@ public class AngleFormat extends Format 
      * @param  locale The locale to use.
      */
     public AngleFormat(final Locale locale) {
+        ArgumentChecks.ensureNonNull("locale", locale);
         this.locale = locale;
         degreesFieldWidth     = 1;
         minutesFieldWidth     = 2;
         secondsFieldWidth     = 2;
-        fractionFieldWidth    = 16;  // Number of digits for accurate representation of 1″ ULP.
-        degreesSuffix         = "°";
-        minutesSuffix         = "′";
-        secondsSuffix         = "″";
+        fractionFieldWidth    = 16;  // Number of digits for accurate representation of 1″ ULP.
+        degreesSuffix         = "°";
+        minutesSuffix         = "′";
+        secondsSuffix         = "″";
         useDecimalSeparator   = true;
     }
 
@@ -392,6 +393,7 @@ public class AngleFormat extends Format 
      * @throws IllegalArgumentException If the specified pattern is illegal.
      */
     public AngleFormat(final String pattern, final Locale locale) throws IllegalArgumentException {
+        ArgumentChecks.ensureNonNull("locale", locale);
         this.locale = locale;
         applyPattern(pattern, SYMBOLS, '.');
     }
@@ -908,10 +910,10 @@ scan:   for (int i=0; i<length;) {
              * At this point, we known the value to format and the NumberFormat instance has been
              * configured. If the user asked for an attributed character iterator and assuming that
              * we want also the attributes produced by the NumberFormat, then we have to invoke the
-             * heavy formatToCharacterIterator(…). Otherwise the usual format(…) method fits well.
+             * heavy formatToCharacterIterator(…). Otherwise the usual format(…) method fits well.
              */
             final int startPosition = toAppendTo.length();
-            if (characterIterator instanceof FormattedCharacterIterator) {
+            if (characterIterator != null) {
                 final FormattedCharacterIterator it = (FormattedCharacterIterator) characterIterator;
                 it.append(numberFormat.formatToCharacterIterator(value), toAppendTo);
                 if (suffix != null) {
@@ -920,7 +922,7 @@ scan:   for (int i=0; i<length;) {
                 it.addFieldLimit(Field.forCode(field), hasMore
                         ? (Number) Integer.valueOf((int) Math.round(value))
                         : (Number) Float.valueOf((float) value), startPosition);
-                // The 'valueOf(…)' was for information purpose only. We use Float instead of Double
+                // The 'valueOf(…)' was for information purpose only. We use Float instead of Double
                 // because we don't want to give a false impression of accuracy (when formatting the
                 // seconds field, at least the 10 last bits of the double value are non-significant).
             } else {
@@ -1001,7 +1003,7 @@ scan:   for (int i=0; i<length;) {
             pos.setBeginIndex(startPosition);
             pos.setEndIndex(toAppendTo.length());
         }
-        if (characterIterator instanceof FormattedCharacterIterator) {
+        if (characterIterator != null) {
             ((FormattedCharacterIterator) characterIterator).addFieldLimit(
                     Field.HEMISPHERE, suffix, startPosition);
         }
@@ -1031,12 +1033,12 @@ scan:   for (int i=0; i<length;) {
      *
      * <p>The returned character iterator contains all {@link java.text.NumberFormat.Field}
      * attributes in addition to the {@link Field} ones. Consequently the same character may
-     * have more than one attribute. For example when formatting 45°30′15.0″N, then:</p>
+     * have more than one attribute. For example when formatting 45°30′15.0″N, then:</p>
      *
      * <ul>
-     *   <li>The {@code 45°}   part has the {@link Field#DEGREES} attribute.</li>
-     *   <li>The {@code 30′}   part has the {@link Field#MINUTES} attribute.</li>
-     *   <li>The {@code 15.0″} part has the {@link Field#SECONDS} attribute.</li>
+     *   <li>The {@code 45°}   part has the {@link Field#DEGREES} attribute.</li>
+     *   <li>The {@code 30′}   part has the {@link Field#MINUTES} attribute.</li>
+     *   <li>The {@code 15.0″} part has the {@link Field#SECONDS} attribute.</li>
      *   <li>The {@code N}     part has the {@link Field#HEMISPHERE} attribute.</li>
      *   <li>The {@code 45}, {@code 30} and {@code 15} parts have the
      *       {@link java.text.NumberFormat.Field#INTEGER} attribute.</li>
@@ -1067,12 +1069,12 @@ scan:   for (int i=0; i<length;) {
     /**
      * Ignores a field suffix, then returns the identifier of the suffix just skipped.
      * This method is invoked by {@link #parse(String, ParsePosition)} for determining
-     * what was the field it just parsed. For example if we just parsed "48°12'", then
-     * this method will skip the "°" part and returns {@link #DEGREES_FIELD}.
+     * what was the field it just parsed. For example if we just parsed "48°12'", then
+     * this method will skip the "°" part and returns {@link #DEGREES_FIELD}.
      *
      * <p>This method skips whitespaces before the suffix, then compares the characters
      * with the suffix specified to {@link #applyPattern(String)}. If the suffix has not
-     * been recognized, then this method will compares against the standard ', ° and "
+     * been recognized, then this method will compares against the standard ', ° and "
      * ASCII symbols.</p>
      *
      * @param source
@@ -1112,7 +1114,7 @@ scan:   for (int i=0; i<length;) {
                     c = source.codePointAt(index);
                     index += Character.charCount(c);
                 }
-                while (Character.isSpaceChar(c)); // Method shall be consistent with skipSpaces(…)
+                while (Character.isSpaceChar(c)); // Method shall be consistent with skipSpaces(…)
             }
             if (++field > SECONDS_FIELD) {
                 field = PREFIX_FIELD;
@@ -1131,11 +1133,11 @@ scan:   for (int i=0; i<length;) {
                 c = source.codePointAt(start);
                 start += Character.charCount(c);
             }
-            while (Character.isSpaceChar(c)); // Method shall be consistent with skipSpaces(…)
+            while (Character.isSpaceChar(c)); // Method shall be consistent with skipSpaces(…)
             switch (c) {
-                case '°' :            pos.setIndex(start); return DEGREES_FIELD;
-                case '′' : case '\'': pos.setIndex(start); return MINUTES_FIELD;
-                case '″' : case '"' : pos.setIndex(start); return SECONDS_FIELD;
+                case '°' :            pos.setIndex(start); return DEGREES_FIELD;
+                case '′' : case '\'': pos.setIndex(start); return MINUTES_FIELD;
+                case '″' : case '"' : pos.setIndex(start); return SECONDS_FIELD;
             }
         }
         return Integer.MIN_VALUE; // Unknown field.
@@ -1168,7 +1170,7 @@ scan:   for (int i=0; i<length;) {
     /**
      * Parses the given string as an angle. This method can parse the string even if it is not
      * strictly compliant to the expected pattern. For example if {@link #isFallbackAllowed()}
-     * is {@code true}, then this method will parse "{@code 48°12.34'}" correctly even if the
+     * is {@code true}, then this method will parse "{@code 48°12.34'}" correctly even if the
      * expected pattern was "{@code DDMM.mm}" (i.e. the string should have been "{@code 4812.34}").
      *
      * <p>If the given string ends with a "N" or "S" hemisphere symbol, then this method returns
@@ -1195,7 +1197,7 @@ scan:   for (int i=0; i<length;) {
     /**
      * Parses the given string as an angle. The {@code spaceAsSeparator} additional argument
      * specifies if spaces can be accepted as a field separator. For example if {@code true},
-     * then "45 30" will be parsed as "45°30".
+     * then "45 30" will be parsed as "45°30".
      */
     @SuppressWarnings("fallthrough")
     private Angle parse(final String source, final ParsePosition pos, final boolean spaceAsSeparator) {
@@ -1486,7 +1488,7 @@ BigBoss:    switch (skipSuffix(source, p
                 minutes  -= degrees * facteur;
             } else {
                 ////////////////////
-                //// DDD°MMSS.s ////
+                //// DDD°MMSS.s ////
                 ////////////////////
                 seconds  = minutes;
                 minutes  = truncate(minutes / facteur);
@@ -1518,7 +1520,7 @@ BigBoss:    switch (skipSuffix(source, p
                 case EAST : pos.setIndex(index); return new Longitude( degrees);
                 case WEST : pos.setIndex(index); return new Longitude(-degrees);
             }
-            if (!Character.isSpaceChar(c)) { // Method shall be consistent with skipSpaces(…)
+            if (!Character.isSpaceChar(c)) { // Method shall be consistent with skipSpaces(…)
                 break;
             }
         }
@@ -1591,13 +1593,13 @@ BigBoss:    switch (skipSuffix(source, p
      * {@linkplain #applyPattern(String) applied pattern}. The build-in fallback is:
      *
      * <ul>
-     *   <li>{@code °} (an extended-ASCII character) or space (in {@link #parse(String)} method only) for degrees.</li>
-     *   <li>{@code '} (an ASCII character) or {@code ′} (the default Unicode character) for minutes.</li>
-     *   <li>{@code "} (an ASCII character) or {@code ″} (the default Unicode character) for seconds.</li>
+     *   <li>{@code °} (an extended-ASCII character) or space (in {@link #parse(String)} method only) for degrees.</li>
+     *   <li>{@code '} (an ASCII character) or {@code ′} (the default Unicode character) for minutes.</li>
+     *   <li>{@code "} (an ASCII character) or {@code ″} (the default Unicode character) for seconds.</li>
      * </ul>
      *
      * The default value is {@code true}, because many end-users will not enter the Unicode
-     * {@code ′} and {@code ″} symbols. However developers may need to set this flag to
+     * {@code ′} and {@code ″} symbols. However developers may need to set this flag to
      * {@code false} if those ASCII symbols are used in a wider context (for example the
      * {@code "} character for quoting strings).
      *
@@ -1609,9 +1611,9 @@ BigBoss:    switch (skipSuffix(source, p
 
     /**
      * Returns this formatter locale. This is the locale specified at construction time if any,
-     * or the default locale at construction time otherwise.
+     * or the {@linkplain Locale#getDefault() default locale} at construction time otherwise.
      *
-     * @return This formatter locale.
+     * @return This formatter locale (never {@code null}).
      */
     @Override
     public Locale getLocale() {

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8



Mime
View raw message