sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1470847 - in /sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso: citation/DefaultOnlineResource.java citation/package-info.java quality/AbstractElement.java
Date Tue, 23 Apr 2013 08:33:00 GMT
Author: desruisseaux
Date: Tue Apr 23 08:32:59 2013
New Revision: 1470847

URL: http://svn.apache.org/r1470847
Log:
Minor adjustment in AbstractElement.Dates, and javadoc links.

Modified:
    sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOnlineResource.java
    sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/package-info.java
    sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractElement.java

Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOnlineResource.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOnlineResource.java?rev=1470847&r1=1470846&r2=1470847&view=diff
==============================================================================
--- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOnlineResource.java
[UTF-8] (original)
+++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOnlineResource.java
[UTF-8] Tue Apr 23 08:32:59 2013
@@ -245,6 +245,8 @@ public class DefaultOnlineResource exten
      * Returns the connection protocol to be used. If no protocol has been {@linkplain #setProtocol(String)
      * explicitely set}, then this method returns the {@linkplain #getLinkage() linkage}
      * {@linkplain URI#getScheme() scheme} (if any).
+     *
+     * @see <a href="../doc-files/auto-properties.html">List of automatic properties</a>
      */
     @Override
     @XmlElement(name = "protocol")

Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/package-info.java?rev=1470847&r1=1470846&r2=1470847&view=diff
==============================================================================
--- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/package-info.java
[UTF-8] (original)
+++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/package-info.java
[UTF-8] Tue Apr 23 08:32:59 2013
@@ -64,6 +64,11 @@
  * except at XML marshalling time (for ISO 19139 compliance).
  * See {@link org.apache.sis.xml.IdentifierMap} for more information.
  *
+ * {@section Automatic properties}
+ * Some properties provide default value based on the value of other properties.
+ * See the <a href="../doc-files/auto-properties.html">list of automatic properties</a>
+ * page for more information.
+ *
  * {@section Null values, nil objects and collections}
  * All constructors (except the <cite>copy constructors</cite>) and setter methods
accept {@code null} arguments.
  * A null argument value means that the metadata element can not be provided, and the reason
for that is unspecified.

Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractElement.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractElement.java?rev=1470847&r1=1470846&r2=1470847&view=diff
==============================================================================
--- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractElement.java
[UTF-8] (original)
+++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractElement.java
[UTF-8] Tue Apr 23 08:32:59 2013
@@ -193,6 +193,7 @@ public class AbstractElement extends ISO
                 case 0: date1 = date; break;
                 case 1: date2 = date; break;
             }
+            modCount++;
             return previous;
         }
 
@@ -207,6 +208,7 @@ public class AbstractElement extends ISO
                 case 0: date1 = date2; // Fallthrough
                 case 1: date2 = Long.MIN_VALUE; break;
             }
+            modCount++;
             return previous;
         }
 
@@ -222,14 +224,16 @@ public class AbstractElement extends ISO
                     case 0: {
                         date2 = date1;
                         date1 = date;
+                        modCount++;
                         return;
                     }
                     case 1: {
-                        if (date1 != Long.MIN_VALUE) {
-                            date2 = date;
-                            return;
+                        if (date1 == Long.MIN_VALUE) {
+                            break; // Exception will be thrown below.
                         }
-                        break;
+                        date2 = date;
+                        modCount++;
+                        return;
                     }
                 }
             }
@@ -240,25 +244,24 @@ public class AbstractElement extends ISO
          * Adds all content from the given collection into this collection.
          */
         @Override
+        @SuppressWarnings("fallthrough")
         public boolean addAll(final Collection<? extends Date> dates) {
+            final int c = modCount;
             if (dates != null) {
-                if (date1 != Long.MIN_VALUE) {
-                    return super.addAll(dates);
-                }
                 final Iterator<? extends Date> it = dates.iterator();
-                if (it.hasNext()) {
-                    date1 = it.next().getTime();
-                    if (it.hasNext()) {
-                        date2 = it.next().getTime();
-                        if (it.hasNext()) {
-                            throw new IllegalArgumentException(Errors.format(
-                                    Errors.Keys.ExcessiveArgumentSize_3, "dates", 2, dates.size()));
-                        }
-                    }
-                    return true;
+                switch (size()) { // Fallthrough everywhere.
+                    case 0:  if (!it.hasNext()) break;
+                             date1 = it.next().getTime();
+                             modCount++;
+                    case 1:  if (!it.hasNext()) break;
+                             date2 = it.next().getTime();
+                             modCount++;
+                    default: if (!it.hasNext()) break;
+                             throw new IllegalArgumentException(Errors.format(
+                                     Errors.Keys.ExcessiveArgumentSize_3, "dates", 2, dates.size()));
                 }
             }
-            return false;
+            return modCount != c;
         }
 
         /**



Mime
View raw message