sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1597781 - in /sis/trunk: ./ core/sis-feature/src/main/java/org/apache/sis/feature/ core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ core/sis-utility/src/main/java/org/apache/sis/measure/
Date Tue, 27 May 2014 13:32:39 GMT
Author: desruisseaux
Date: Tue May 27 13:32:38 2014
New Revision: 1597781

URL: http://svn.apache.org/r1597781
Log:
Merge from the JDK6 branch. Actually most of the changes on the JDK6 branches are excluded
in this merge,
because they were about using org.opengis.feature interfaces which are not part of GeoAPI
3.0 release.

Modified:
    sis/trunk/   (props changed)
    sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAssociation.java
    sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAttribute.java
    sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java 
 (props changed)
    sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractIdentifiedType.java
    sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java
    sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAttributeType.java
    sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java
    sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultOperation.java
    sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/FieldType.java
    sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/SingletonAttribute.java
    sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/Validator.java
    sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/benchmarks.html
    sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java

Propchange: sis/trunk/
------------------------------------------------------------------------------
  Merged /sis/branches/JDK8:r1597142-1597748
  Merged /sis/branches/JDK7:r1597143-1597767
  Merged /sis/branches/JDK6:r1597144-1597769

Modified: sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAssociation.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAssociation.java?rev=1597781&r1=1597780&r2=1597781&view=diff
==============================================================================
--- sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAssociation.java
[UTF-8] (original)
+++ sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAssociation.java
[UTF-8] Tue May 27 13:32:38 2014
@@ -224,7 +224,7 @@ public abstract class AbstractAssociatio
     public String toString() {
         final String pt = role.getTitleProperty();
         final Iterator<AbstractFeature> it = getValues().iterator();
-        return role.toString("FeatureAssociation", role.getValueType().getName(), new Iterator<Object>()
{
+        return FieldType.toString("FeatureAssociation", role, role.getValueType().getName(),
new Iterator<Object>() {
             @Override public boolean hasNext() {
                 return it.hasNext();
             }

Modified: sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAttribute.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAttribute.java?rev=1597781&r1=1597780&r2=1597781&view=diff
==============================================================================
--- sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAttribute.java
[UTF-8] (original)
+++ sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAttribute.java
[UTF-8] Tue May 27 13:32:38 2014
@@ -271,6 +271,6 @@ public abstract class AbstractAttribute<
     @Debug
     @Override
     public String toString() {
-        return type.toString("Attribute", Classes.getShortName(type.getValueClass()), getValues().iterator());
+        return FieldType.toString("Attribute", type, Classes.getShortName(type.getValueClass()),
getValues().iterator());
     }
 }

Propchange: sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
------------------------------------------------------------------------------
  Merged /sis/branches/JDK6/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java:r1597137-1597769
  Merged /sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java:r1597131-1597748
  Merged /sis/branches/JDK7/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java:r1597135-1597767

Modified: sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractIdentifiedType.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractIdentifiedType.java?rev=1597781&r1=1597780&r2=1597781&view=diff
==============================================================================
--- sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractIdentifiedType.java
[UTF-8] (original)
+++ sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractIdentifiedType.java
[UTF-8] Tue May 27 13:32:38 2014
@@ -27,7 +27,7 @@ import org.apache.sis.util.iso.Types;
 
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
 
-// Related to JDK7
+// Branch-dependent imports
 import org.apache.sis.internal.jdk7.Objects;
 
 

Modified: sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java?rev=1597781&r1=1597780&r2=1597781&view=diff
==============================================================================
--- sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java
[UTF-8] (original)
+++ sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java
[UTF-8] Tue May 27 13:32:38 2014
@@ -212,6 +212,6 @@ public class DefaultAssociationRole exte
     @Debug
     @Override
     public String toString() {
-        return toString("FeatureAssociationRole", valueType.getName()).toString();
+        return toString("FeatureAssociationRole", this, valueType.getName()).toString();
     }
 }

Modified: sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAttributeType.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAttributeType.java?rev=1597781&r1=1597780&r2=1597781&view=diff
==============================================================================
--- sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAttributeType.java
[UTF-8] (original)
+++ sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAttributeType.java
[UTF-8] Tue May 27 13:32:38 2014
@@ -25,7 +25,7 @@ import org.apache.sis.internal.util.Nume
 
 import static org.apache.sis.util.ArgumentChecks.*;
 
-// Related to JDK7
+// Branch-dependent imports
 import org.apache.sis.internal.jdk7.Objects;
 
 
@@ -243,6 +243,6 @@ public class DefaultAttributeType<V> ext
     @Debug
     @Override
     public String toString() {
-        return toString("AttributeType", Classes.getShortName(valueClass)).toString();
+        return toString("AttributeType", this, Classes.getShortName(valueClass)).toString();
     }
 }

Modified: sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java?rev=1597781&r1=1597780&r2=1597781&view=diff
==============================================================================
--- sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java
[UTF-8] (original)
+++ sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java
[UTF-8] Tue May 27 13:32:38 2014
@@ -218,7 +218,7 @@ public class DefaultFeatureType extends 
                           CollectionsExt.<DefaultFeatureType>immutableSet(true, superTypes);
         switch (properties.length) {
             case 0:  this.properties = Collections.emptyList(); break;
-            case 1:  this.properties = Collections.singletonList((PropertyType) properties[0]);
break;
+            case 1:  this.properties = Collections.singletonList((PropertyType) properties[0]);
break; // There is no cast on other SIS branches.
             default: this.properties = UnmodifiableArrayList.wrap(Arrays.copyOf(properties,
properties.length, PropertyType[].class)); break;
         }
         computeTransientFields();
@@ -266,7 +266,7 @@ public class DefaultFeatureType extends 
         for (final Map.Entry<String,PropertyType> entry : byName.entrySet()) {
             final int minimumOccurs, maximumOccurs;
             final PropertyType property = entry.getValue();
-            if (property instanceof DefaultAttributeType<?>) { // TODO: check for AttributeType
instead (after GeoAPI upgrade).
+            if (property instanceof DefaultAttributeType<?>) { // Other SIS branches
check for AttributeType instead.
                 minimumOccurs = ((DefaultAttributeType<?>) property).getMinimumOccurs();
                 maximumOccurs = ((DefaultAttributeType<?>) property).getMaximumOccurs();
                 isSimple &= (minimumOccurs == maximumOccurs);
@@ -479,8 +479,8 @@ public class DefaultFeatureType extends 
     {
         if (base != other) {
             /*
-             * TODO: DefaultAttributeType and DefaultAssociationRole to be replaced by GeoAPI
interfaces
-             *       (pending GeoAPI review).
+             * Note: other SIS branches use AttributeType and FeatureAssociationRole
+             *       instead than DefaultAttributeType and DefaultAssociationRole.
              */
             if (base instanceof DefaultAttributeType<?>) {
                 if (!(other instanceof DefaultAttributeType<?>)) {
@@ -544,8 +544,15 @@ public class DefaultFeatureType extends 
      * @return Feature operation, attribute type and association role that carries characteristics
of this
      *         feature type (not including parent types).
      */
+    @SuppressWarnings("unchecked")
     public Collection<AbstractIdentifiedType> getProperties(final boolean includeSuperTypes)
{
-        // TODO: temporary cast to be removed after we upgraded GeoAPI.
+        /*
+         * Cast is a workaround for "Apache SIS on GeoAPI 3.0" branch only (other branches
do not need cast).
+         * This is because GeoAPI 3.0 does not provide the 'org.opengis.feature.PropertyType'
interface, and
+         * we do not want to put our internal PropertyType class in public API. Our closest
public class is
+         * AbstractIdentifiedType. Because of the way Java parameterized types are implemented
(type erasure),
+         * this cast is okay if the collections are read-only.
+         */
         return (Collection) (includeSuperTypes ? allProperties : properties);
     }
 

Modified: sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultOperation.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultOperation.java?rev=1597781&r1=1597780&r2=1597781&view=diff
==============================================================================
--- sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultOperation.java
[UTF-8] (original)
+++ sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultOperation.java
[UTF-8] Tue May 27 13:32:38 2014
@@ -24,7 +24,7 @@ import org.apache.sis.referencing.Identi
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.Debug;
 
-// Related to JDK7
+// Branch-dependent imports
 import org.apache.sis.internal.jdk7.Objects;
 
 

Modified: sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/FieldType.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/FieldType.java?rev=1597781&r1=1597780&r2=1597781&view=diff
==============================================================================
--- sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/FieldType.java [UTF-8]
(original)
+++ sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/FieldType.java [UTF-8]
Tue May 27 13:32:38 2014
@@ -124,12 +124,16 @@ abstract class FieldType extends Propert
      * Example:
      *
      * {@preformat text
-     *     FooType[“name” : ValueClass]
+     *     PropertyType[“name” : ValueClass]
      * }
+     *
+     * @param className The interface name of the object on which {@code toString()} is invoked.
+     * @param type      The property type, sometime {@code this} or sometime an other object.
+     * @param valueType The name of value class (attribute), or the feature type name (association).
      */
-    final StringBuilder toString(final String typeName, final Object valueName) {
-        final StringBuilder buffer = new StringBuilder(40).append(typeName).append('[');
-        final GenericName name = getName();
+    static StringBuilder toString(final String className, final PropertyType type, final
Object valueType) {
+        final StringBuilder buffer = new StringBuilder(40).append(className).append('[');
+        final GenericName name = type.getName();
         if (name != null) {
             buffer.append('“');
         }
@@ -137,7 +141,7 @@ abstract class FieldType extends Propert
         if (name != null) {
             buffer.append("” : ");
         }
-        return buffer.append(valueName).append(']');
+        return buffer.append(valueType).append(']');
     }
 
     /**
@@ -145,11 +149,16 @@ abstract class FieldType extends Propert
      * Example:
      *
      * {@preformat text
-     *     FooType[“name” : ValueClass] = {value1, value2, ...}
+     *     Property[“name” : ValueClass] = {value1, value2, ...}
      * }
+     *
+     * @param className The interface name of the object on which {@code toString()} is invoked.
+     * @param type      The property type associated to the object to format.
+     * @param valueType The name of value class (attribute), or the feature type name (association).
+     * @param values    The actual values.
      */
-    final String toString(final String typeName, final Object valueName, final Iterator<?>
values) {
-        final StringBuilder buffer = toString(typeName, valueName);
+    static String toString(final String className, final PropertyType type, final Object
valueType, final Iterator<?> values) {
+        final StringBuilder buffer = toString(className, type, valueType);
         if (values.hasNext()) {
             final Object value = values.next();
             final boolean isMultiValued = values.hasNext();

Modified: sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/SingletonAttribute.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/SingletonAttribute.java?rev=1597781&r1=1597780&r2=1597781&view=diff
==============================================================================
--- sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/SingletonAttribute.java
[UTF-8] (original)
+++ sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/SingletonAttribute.java
[UTF-8] Tue May 27 13:32:38 2014
@@ -16,7 +16,7 @@
  */
 package org.apache.sis.feature;
 
-// Related to JDK7
+// Branch-dependent imports
 import org.apache.sis.internal.jdk7.Objects;
 
 

Modified: sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/Validator.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/Validator.java?rev=1597781&r1=1597780&r2=1597781&view=diff
==============================================================================
--- sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/Validator.java [UTF-8]
(original)
+++ sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/Validator.java [UTF-8]
Tue May 27 13:32:38 2014
@@ -77,7 +77,7 @@ final class Validator {
      * @return The {@code report}, or a new report if {@code report} was null.
      */
     private AbstractElement addViolationReport(AbstractElement report,
-            final AbstractIdentifiedType type, final InternationalString explanation)
+            final PropertyType type, final InternationalString explanation)
     {
         if (report == null) {
             final GenericName name = type.getName();
@@ -158,7 +158,7 @@ final class Validator {
      *
      * @param report Where to add the result, or {@code null} if not yet created.
      */
-    private void verifyCardinality(final AbstractElement report, final AbstractIdentifiedType
type,
+    private void verifyCardinality(final AbstractElement report, final PropertyType type,
             final int minimumOccurs, final int maximumOccurs, final int count)
     {
         if (count < minimumOccurs) {

Modified: sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/benchmarks.html
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/benchmarks.html?rev=1597781&r1=1597780&r2=1597781&view=diff
==============================================================================
--- sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/benchmarks.html [UTF-8]
(original)
+++ sis/trunk/core/sis-feature/src/main/java/org/apache/sis/feature/benchmarks.html [UTF-8]
Tue May 27 13:32:38 2014
@@ -11,7 +11,7 @@
     Consider a ShapeFile or a database table with millions of records.
     Each record is represented by one <code>Feature</code> instance.
     Sophisticated <code>DataStore</code> implementations will create and discard
<code>Feature</code>
-    instances on the fly, but not all <code>DataStore</code> can do that.
+    instances on the fly, but not all <code>DataStore</code> do that.
     As a safety, Apache SIS tries to implement <code>Feature</code> in a way
that allow applications
     to scale higher before to die with an <code>OutOfMemoryError</code>.</p>
 
@@ -20,7 +20,9 @@
     final Map&lt;String,Object&gt; attributes = new HashMap&lt;&gt;(8);
 }</pre></blockquote>
 
-    <p>The above <code>SimpleFeature</code> does not supports multi-valued
properties and meta-information about the properties.
+    <p>The above <code>SimpleFeature</code> does not supports explicitely
multi-valued properties and metadata
+    about the properties (admittedly multi-values could be stored as <code>java.util.Collection</code>,
+    but this approach has implications on the way we ensure type safety).
     A more complete but still straightforward implementation could be:</p>
     <blockquote><pre>class ComplexFeature {
     final Map&lt;String,Property&gt; properties = new HashMap&lt;&gt;(8);
@@ -31,8 +33,9 @@ class Property {
 
 
     <p>A more sophisticated implementation would take advantage of our knowledge that
all records in a table have the
-    same attribute names. Apache SIS uses this knowledge, together with lazy instantiations
of <code>Property</code>.
-    The above simple implementation has been compared with the Apache SIS one in a micro-benchmark
consisting for the
+    same attribute names, and that the vast majority of attributes are singleton.
+    Apache SIS uses this knowledge, together with lazy instantiations of <code>Property</code>.
+    The above simple implementation has been compared with the Apache SIS one in a micro-benchmark
consisting of the
     following steps:</p>
 
     <ol>
@@ -57,7 +60,7 @@ class Property {
     </ol>
 
     <h2>Results and discussion</h2>
-    The benchmarks have been executed about 8 times for each implementations
+    The benchmarks have been executed about 8 times for each implementation
     (<cite>simple</cite> and <cite>complex</cite> versus <cite>SIS</cite>).
     Results of the simple feature implementation were very stable.
     But results of the SIS implementation randomly fall in two modes, one twice faster than
the other
@@ -101,11 +104,11 @@ class Property {
     implementation before the application get an <code>OutOfMemoryError</code>.
     We presume that this is caused by the <code>Map.Entry</code> instances that
<code>HashMap</code> must
     create internally for each attribute.
-    Compared to <code>ComplexFeature</code>, SIS allows 3.3 times more instances
while functionally equivalent.</p>
+    Compared to <code>ComplexFeature</code>, SIS allows 3.3 times more instances
while being functionally equivalent.</p>
 
     <p>The speed comparisons are subject to more cautions, in part because each run
has created a different amount
     of instances before the test stopped. So even the slowest SIS case would be almost twice
faster than
-    <cite>SimpleFeature</cite> because it created two times more instances in
an equivalent amount of time.
+    <code>SimpleFeature</code> because it created two times more instances in
an equivalent amount of time.
     However this may be highly dependent on garbage collector activities (it has not been
verified).</p>
   </body>
 </html>

Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java?rev=1597781&r1=1597780&r2=1597781&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
[UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
[UTF-8] Tue May 27 13:32:38 2014
@@ -152,7 +152,7 @@ public final strictfp class AllMetadataT
             org.opengis.metadata.maintenance.MaintenanceFrequency.class,
             org.opengis.metadata.maintenance.MaintenanceInformation.class,
             org.opengis.metadata.maintenance.ScopeCode.class,
-            org.opengis.metadata.maintenance.ScopeDescription.class,
+//          org.opengis.metadata.maintenance.ScopeDescription.class,  // Excluded because
of deprecated FeatureType.
             org.opengis.metadata.quality.AbsoluteExternalPositionalAccuracy.class,
             org.opengis.metadata.quality.AccuracyOfATimeMeasurement.class,
             org.opengis.metadata.quality.Completeness.class,
@@ -201,7 +201,7 @@ public final strictfp class AllMetadataT
     }
 
     /**
-     * Performs the test documente in the {@link MetadataTestCase} javadoc.
+     * Performs the test documented in the {@link MetadataTestCase} javadoc.
      */
     @Test
     @Override

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java?rev=1597781&r1=1597780&r2=1597781&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java [UTF-8]
(original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java [UTF-8]
Tue May 27 13:32:38 2014
@@ -73,9 +73,8 @@ import org.apache.sis.util.collection.We
  *
  * <p>All {@code create} static methods may return a shared instance. Those methods
are preferred
  * to the constructors when the range is expected to have a long lifetime, typically as instance
- * given to {@linkplain org.apache.sis.parameter.DefaultParameterDescriptor parameter descriptor}
- * or {@linkplain org.apache.sis.feature.DefaultAttributeType attribute type} constructor.
Other
- * methods do not check for shared instances, since the created object is often temporary.</p>
+ * given to {@linkplain org.apache.sis.parameter.DefaultParameterDescriptor parameter descriptor}.
+ * Other methods do not check for shared instances, since the created object is often temporary.</p>
  *
  * @param <E> The type of range elements as a subclass of {@link Number}.
  *



Mime
View raw message