sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 03/03: Documentation cleanup and removal of duplicated code.
Date Sat, 19 Jan 2019 16:50:35 GMT
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit 04f8d71026a53025f35ad4df04349e9f92967de7
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Sat Jan 19 16:42:55 2019 +0100

    Documentation cleanup and removal of duplicated code.
---
 .../src/main/java/org/apache/sis/measure/Units.java          |  4 ++--
 .../src/main/java/org/apache/sis/util/CharSequences.java     | 12 +-----------
 .../main/java/org/apache/sis/internal/netcdf/Variable.java   |  4 ++--
 .../org/apache/sis/internal/netcdf/ucar/VariableWrapper.java |  2 +-
 .../src/main/java/org/apache/sis/storage/ProbeResult.java    |  2 +-
 .../main/java/org/apache/sis/storage/WritableAggregate.java  |  4 ++--
 6 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java b/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java
index 3443fbb..f51f206 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java
@@ -1525,8 +1525,8 @@ public final class Units extends Static {
     /**
      * Creates a linear converter from the given scale and offset.
      *
-     * @param  scale   the scale factor, or {@code null} if none.
-     * @param  offset  the offset, or {@code null} if none.
+     * @param  scale   the scale factor, or {@code null} if none (default value of 1).
+     * @param  offset  the offset, or {@code null} if none (default value of 0).
      * @return a converter for the given scale and offset.
      *
      * @see org.apache.sis.referencing.operation.transform.MathTransforms#linear(double,
double)
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java b/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java
index c84e518..df3629d 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java
@@ -187,17 +187,7 @@ public final class CharSequences extends Static {
      * @see #codePointCount(CharSequence, int, int)
      */
     public static int codePointCount(final CharSequence text) {
-        if (text == null)                  return 0;
-        if (text instanceof String)        return ((String)        text).codePointCount(0,
text.length());
-        if (text instanceof StringBuilder) return ((StringBuilder) text).codePointCount(0,
text.length());
-        if (text instanceof StringBuffer)  return ((StringBuffer)  text).codePointCount(0,
text.length());
-        if (text instanceof CharBuffer) {
-            final CharBuffer buffer = (CharBuffer) text;
-            if (buffer.hasArray() && !buffer.isReadOnly()) {
-                return Character.codePointCount(buffer.array(), buffer.position(), buffer.limit());
-            }
-        }
-        return Character.codePointCount(text, 0, text.length());
+        return (text != null) ? codePointCount(text, 0, text.length()) : 0;
     }
 
     /**
diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java
b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java
index a363279..c1b882f 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java
@@ -144,9 +144,9 @@ public abstract class Variable extends NamedElement {
     public abstract String getFilename();
 
     /**
-     * Returns the name of this variable, or {@code null} if none.
+     * Returns the name of this variable.
      *
-     * @return the name of this variable, or {@code null}.
+     * @return the name of this variable.
      */
     @Override
     public abstract String getName();
diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/VariableWrapper.java
b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/VariableWrapper.java
index 94da9c7..5d12c2d 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/VariableWrapper.java
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/VariableWrapper.java
@@ -110,7 +110,7 @@ final class VariableWrapper extends Variable {
     }
 
     /**
-     * Returns the name of this variable, or {@code null} if none.
+     * Returns the name of this variable.
      */
     @Override
     public String getName() {
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/storage/ProbeResult.java b/storage/sis-storage/src/main/java/org/apache/sis/storage/ProbeResult.java
index 87d6a7b..e4d8477 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/storage/ProbeResult.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/storage/ProbeResult.java
@@ -289,7 +289,7 @@ public class ProbeResult implements Serializable {
             try {
                 return ProbeResult.class.getField(name).get(null);
             } catch (ReflectiveOperationException e) {
-                return this; // See javadoc
+                return this;                                            // See javadoc
             }
         }
 
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/storage/WritableAggregate.java
b/storage/sis-storage/src/main/java/org/apache/sis/storage/WritableAggregate.java
index 17c42cd..e8f3614 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/storage/WritableAggregate.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/storage/WritableAggregate.java
@@ -46,7 +46,7 @@ public interface WritableAggregate extends Aggregate {
      *
      * @param  resource  the resource to copy in this {@code Aggregate}.
      * @return the effectively added resource. May be {@code resource} itself if it has been
added verbatim.
-     * @throws DataStoreException if the given resource can not be stored in this {@code
Aggregate} for another reason.
+     * @throws DataStoreException if the given resource can not be stored in this {@code
Aggregate}.
      */
     Resource add(Resource resource) throws DataStoreException;
 
@@ -55,7 +55,7 @@ public interface WritableAggregate extends Aggregate {
      * This operation is destructive: the {@link Resource} and it's related data will be
removed.
      *
      * @param  resource  child resource to remove, should not be null.
-     * @throws DataStoreException if the given resource could not be removed for another
reason.
+     * @throws DataStoreException if the given resource could not be removed.
      */
     void remove(Resource resource) throws DataStoreException;
 }


Mime
View raw message