sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1532482 - in /sis/branches/JDK7/core: sis-referencing/src/main/java/org/apache/sis/referencing/ sis-referencing/src/main/java/org/apache/sis/referencing/datum/ sis-utility/src/main/java/org/apache/sis/util/resources/
Date Tue, 15 Oct 2013 18:53:25 GMT
Author: desruisseaux
Date: Tue Oct 15 18:53:24 2013
New Revision: 1532482

URL: http://svn.apache.org/r1532482
Log:
Minor refactoring in temporal datum name and in position of copy constructors.

Modified:
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/TemporalObjects.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java?rev=1532482&r1=1532481&r2=1532482&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
[UTF-8] Tue Oct 15 18:53:24 2013
@@ -158,23 +158,6 @@ public class AbstractIdentifiedObject ex
     private transient int hashCode;
 
     /**
-     * Constructs a new identified object with the same values than the specified one.
-     * This copy constructor provides a way to convert an arbitrary implementation into a
SIS one or a
-     * user-defined one (as a subclass), usually in order to leverage some implementation-specific
API.
-     *
-     * <p>This constructor performs a shallow copy, i.e. the properties are not cloned.</p>
-     *
-     * @param object The object to shallow copy.
-     */
-    public AbstractIdentifiedObject(final IdentifiedObject object) {
-        ensureNonNull("object", object);
-        name        =          object.getName();
-        alias       = nonEmpty(object.getAlias()); // Favor null for empty set in case it
is not Collections.EMPTY_SET
-        identifiers = nonEmpty(object.getIdentifiers());
-        remarks     =          object.getRemarks();
-    }
-
-    /**
      * Constructs an object from a set of properties. Keys are strings from the table below.
      * The map given in argument shall contain an entry at least for the
      * {@value org.opengis.referencing.IdentifiedObject#NAME_KEY} key.
@@ -291,6 +274,23 @@ public class AbstractIdentifiedObject ex
     }
 
     /**
+     * Constructs a new identified object with the same values than the specified one.
+     * This copy constructor provides a way to convert an arbitrary implementation into a
SIS one or a
+     * user-defined one (as a subclass), usually in order to leverage some implementation-specific
API.
+     *
+     * <p>This constructor performs a shallow copy, i.e. the properties are not cloned.</p>
+     *
+     * @param object The object to shallow copy.
+     */
+    protected AbstractIdentifiedObject(final IdentifiedObject object) {
+        ensureNonNull("object", object);
+        name        =          object.getName();
+        alias       = nonEmpty(object.getAlias()); // Favor null for empty set in case it
is not Collections.EMPTY_SET
+        identifiers = nonEmpty(object.getIdentifiers());
+        remarks     =          object.getRemarks();
+    }
+
+    /**
      * The {@code gml:id}, which is mandatory. The current implementation searches for the
first identifier,
      * regardless its authority. If no identifier is found, then the name is used.
      * If no name is found (which should not occur for valid objects), then this method returns
{@code null}.

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/TemporalObjects.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/TemporalObjects.java?rev=1532482&r1=1532481&r2=1532482&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/TemporalObjects.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/TemporalObjects.java
[UTF-8] Tue Oct 15 18:53:24 2013
@@ -20,7 +20,6 @@ import java.util.Date;
 import java.util.Locale;
 import java.util.Map;
 import java.util.HashMap;
-import java.util.Collections;
 import org.opengis.util.InternationalString;
 import org.opengis.referencing.IdentifiedObject;
 import org.opengis.referencing.crs.TemporalCRS;
@@ -51,11 +50,11 @@ import static org.opengis.referencing.Id
  * <blockquote><table class="sis">
  *   <tr><th>Name or alias</th>    <th>Object type</th> <th>Enumeration
value</th></tr>
  *   <tr><td>Dublin Julian</td>    <td>CRS, Datum</td>  <td>{@link
#DUBLIN_JULIAN}</td></tr>
- *   <tr><td>Java time</td>        <td>CRS, Datum</td>  <td>{@link
#JAVA}</td></tr>
+ *   <tr><td>Java time</td>        <td>CRS</td>         <td>{@link
#JAVA}</td></tr>
  *   <tr><td>Julian</td>           <td>CRS, Datum</td>  <td>{@link
#JULIAN}</td></tr>
  *   <tr><td>Modified Julian</td>  <td>CRS, Datum</td>  <td>{@link
#MODIFIED_JULIAN}</td></tr>
  *   <tr><td>Truncated Julian</td> <td>CRS, Datum</td>  <td>{@link
#TRUNCATED_JULIAN}</td></tr>
- *   <tr><td>Unix time</td>        <td>CRS, Datum</td>  <td>{@link
#UNIX}</td></tr>
+ *   <tr><td>Unix/POSIX time</td>  <td>CRS, Datum</td>  <td>{@link
#UNIX}</td></tr>
  * </table></blockquote>
  *
  * @author  Martin Desruisseaux (Geomatys)
@@ -94,16 +93,15 @@ public enum TemporalObjects {
     /**
      * Time measured as seconds since January 1st, 1970 at 00:00 UTC.
      */
-    UNIX(-1, 0),
+    UNIX(Vocabulary.Keys.Time_1, 0),
 
     /**
      * Time measured as milliseconds since January 1st, 1970 at 00:00 UTC.
      */
-    JAVA(-1, 0);
+    JAVA(Vocabulary.Keys.Time_1, 0);
 
     /**
-     * The resource keys for the name as one of the {@code Vocabulary.Keys} constants,
-     * or -1 for using the enumeration name.
+     * The resource keys for the name as one of the {@code Vocabulary.Keys} constants.
      */
     private final int key;
 
@@ -133,12 +131,12 @@ public enum TemporalObjects {
      * together with an enumeration value that can be used for fetching that datum:
      *
      * <blockquote><table class="sis">
-     *   <tr><th>Name or alias</th>    <th>Enum</th></tr>
-     *   <tr><td>Dublin Julian</td>    <td>{@link #DUBLIN_JULIAN}</td></tr>
-     *   <tr><td>Julian</td>           <td>{@link #JULIAN}</td></tr>
-     *   <tr><td>Modified Julian</td>  <td>{@link #MODIFIED_JULIAN}</td></tr>
-     *   <tr><td>Truncated Julian</td> <td>{@link #TRUNCATED_JULIAN}</td></tr>
-     *   <tr><td>Unix / Java</td>      <td>{@link #JAVA}</td></tr>
+     *   <tr><th>Name or alias</th>      <th>Enum</th></tr>
+     *   <tr><td>Dublin Julian</td>      <td>{@link #DUBLIN_JULIAN}</td></tr>
+     *   <tr><td>Julian</td>             <td>{@link #JULIAN}</td></tr>
+     *   <tr><td>Modified Julian</td>    <td>{@link #MODIFIED_JULIAN}</td></tr>
+     *   <tr><td>Truncated Julian</td>   <td>{@link #TRUNCATED_JULIAN}</td></tr>
+     *   <tr><td>Unix/POSIX or Java</td> <td>{@link #UNIX}</td></tr>
      * </table></blockquote>
      *
      * @return The datum associated to this constant.
@@ -156,14 +154,15 @@ public enum TemporalObjects {
                         object = JAVA.datum(); // Share the same instance for UNIX and JAVA.
                     } else {
                         final Map<String,Object> properties;
-                        if (key >= 0) {
-                            properties = new HashMap<>(4);
-                            final InternationalString name = Vocabulary.formatInternational(key);
-                            properties.put(NAME_KEY,  name.toString(Locale.ROOT));
-                            properties.put(ALIAS_KEY, name);
+                        properties = new HashMap<>(4);
+                        final InternationalString name;
+                        if (key == Vocabulary.Keys.Time_1) {
+                            name = Vocabulary.formatInternational(key, this == JAVA ? "Java"
: "Unix/POSIX");
                         } else {
-                            properties = Collections.<String,Object>singletonMap(NAME_KEY,
name());
+                            name = Vocabulary.formatInternational(key);
                         }
+                        properties.put(NAME_KEY,  name.toString(Locale.ROOT));
+                        properties.put(ALIAS_KEY, name);
                         object = new DefaultTemporalDatum(properties, new Date(epoch));
                     }
                     cached = object;

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java?rev=1532482&r1=1532481&r2=1532482&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
[UTF-8] Tue Oct 15 18:53:24 2013
@@ -18,8 +18,6 @@ package org.apache.sis.referencing.datum
 
 import java.util.Date;
 import java.util.Map;
-import java.util.HashMap;
-import java.util.Locale;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
@@ -33,7 +31,6 @@ import org.apache.sis.util.iso.Types;
 import org.apache.sis.util.Classes;
 import org.apache.sis.util.Immutable;
 import org.apache.sis.util.ComparisonMode;
-import org.apache.sis.util.resources.Vocabulary;
 import org.apache.sis.internal.metadata.MetadataUtilities;
 import org.apache.sis.internal.jaxb.gco.DateAsLongAdapter;
 
@@ -100,23 +97,6 @@ public class AbstractDatum extends Abstr
     private final InternationalString scope;
 
     /**
-     * Creates a new datum with the same values than the specified one.
-     * This copy constructor provides a way to convert an arbitrary implementation into a
SIS one
-     * or a user-defined one (as a subclass), usually in order to leverage some implementation-specific
API.
-     *
-     * <p>This constructor performs a shallow copy, i.e. the properties are not cloned.</p>
-     *
-     * @param datum The datum to copy.
-     */
-    public AbstractDatum(final Datum datum) {
-        super(datum);
-        realizationEpoch = MetadataUtilities.toMilliseconds(datum.getRealizationEpoch());
-        domainOfValidity = datum.getDomainOfValidity();
-        scope            = datum.getScope();
-        anchorPoint      = datum.getAnchorPoint();
-    }
-
-    /**
      * Creates a datum from a set of properties.
      * The properties given in argument follow the same rules than for the
      * {@linkplain AbstractIdentifiedObject#AbstractIdentifiedObject(Map) super-class constructor}.
@@ -161,18 +141,20 @@ public class AbstractDatum extends Abstr
     }
 
     /**
-     * Same convenience method than {@link org.apache.sis.referencing.cs.AbstractCS#name(int)}
except that
-     * we get the unlocalized name (usually in English locale), because the name is part
of the elements
-     * compared by the {@link #equals(Object, ComparisonMode)} method.
-     *
-     * @see org.apache.sis.referencing.cs.AbstractCS#name(int)
-     */
-    static Map<String,Object> name(final int key) {
-        final Map<String,Object> properties = new HashMap<>(4);
-        final InternationalString name = Vocabulary.formatInternational(key);
-        properties.put(NAME_KEY,  name.toString(Locale.ROOT));
-        properties.put(ALIAS_KEY, name);
-        return properties;
+     * Creates a new datum with the same values than the specified one.
+     * This copy constructor provides a way to convert an arbitrary implementation into a
SIS one
+     * or a user-defined one (as a subclass), usually in order to leverage some implementation-specific
API.
+     *
+     * <p>This constructor performs a shallow copy, i.e. the properties are not cloned.</p>
+     *
+     * @param datum The datum to copy.
+     */
+    protected AbstractDatum(final Datum datum) {
+        super(datum);
+        realizationEpoch = MetadataUtilities.toMilliseconds(datum.getRealizationEpoch());
+        domainOfValidity = datum.getDomainOfValidity();
+        scope            = datum.getScope();
+        anchorPoint      = datum.getAnchorPoint();
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java?rev=1532482&r1=1532481&r2=1532482&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
[UTF-8] Tue Oct 15 18:53:24 2013
@@ -320,6 +320,11 @@ public final class Vocabulary extends In
         public static final int TemporaryFiles = 31;
 
         /**
+         * {0} time
+         */
+        public static final int Time_1 = 64;
+
+        /**
          * Timezone
          */
         public static final int Timezone = 20;

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties?rev=1532482&r1=1532481&r2=1532482&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
[ISO-8859-1] Tue Oct 15 18:53:24 2013
@@ -67,6 +67,7 @@ Scale              = Scale
 Source             = Source
 StandardDeviation  = Standard deviation
 TemporaryFiles     = Temporary files
+Time_1             = {0} time
 Timezone           = Timezone
 TruncatedJulian    = Truncated Julian
 Type               = Type

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties?rev=1532482&r1=1532481&r2=1532482&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
[ISO-8859-1] Tue Oct 15 18:53:24 2013
@@ -67,6 +67,7 @@ Scale              = \u00c9chelle
 Source             = Source
 StandardDeviation  = \u00c9cart type
 TemporaryFiles     = Fichiers temporaires
+Time_1             = Heure {0}
 Timezone           = Fuseau horaire
 TruncatedJulian    = Julien tronqu\u00e9
 Type               = Type



Mime
View raw message