sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1778901 [4/4] - in /sis/trunk: ./ application/sis-console/src/main/java/org/apache/sis/console/ core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ core/sis-metadata/src/main/java/org/apache/sis/metadata/ core/sis-metadata/sr...
Date Sun, 15 Jan 2017 10:36:24 GMT
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java?rev=1778901&r1=1778900&r2=1778901&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
[UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
[UTF-8] Sun Jan 15 10:36:23 2017
@@ -17,13 +17,15 @@
 package org.apache.sis.util.collection;
 
 import java.util.Arrays;
-import java.util.IdentityHashMap;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Set;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Locale;
 import java.util.TimeZone;
 import java.util.Currency;
+import java.util.ConcurrentModificationException;
 import java.io.IOException;
 import java.text.Format;
 import java.text.ParsePosition;
@@ -98,7 +100,7 @@ import static org.apache.sis.util.Charac
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3
- * @version 0.7
+ * @version 0.8
  * @module
  */
 public class TreeTableFormat extends TabularFormat<TreeTable> {
@@ -159,10 +161,10 @@ public class TreeTableFormat extends Tab
     private transient String treeBlank, treeLine, treeCross, treeEnd;
 
     /**
-     * The map to be given to {@link Writer#parentObjects}, created when first needed
-     * and reused for subsequent formating.
+     * The set to be given to {@link Writer#parentObjects},
+     * created when first needed and reused for subsequent formating.
      */
-    private transient Map<Object,Object> parentObjects;
+    private transient Set<TreeTable.Node> recursivityGuard;
 
     /**
      * Creates a new tree table format.
@@ -585,18 +587,9 @@ public class TreeTableFormat extends Tab
         private boolean[] isLast;
 
         /**
-         * The {@linkplain TreeTable.Node#getUserObject() user object} of the parent nodes.
-         * We use this map as a safety against infinite recursivity, on the assumption that
-         * the node content and children are fully determined by the user object.
-         *
-         * <p>User objects in this map will be compared by the identity comparator
rather than by the
-         * {@code equals(Object)} method because the later may be costly and could itself
be vulnerable
-         * to infinite recursivity if it has not been implemented defensively.</p>
-         *
-         * <p>We check the user object instead than the node itself because the same
node instance can
-         * theoretically not appear twice with a different parent.</p>
+         * The node that have already been formatted. We use this map as a safety against
infinite recursivity.
          */
-        private final Map<Object,Object> parentObjects;
+        private final Set<TreeTable.Node> recursivityGuard;
 
         /**
          * The format for the column in process of being written. This is a format to use
for the column as a whole.
@@ -607,17 +600,17 @@ public class TreeTableFormat extends Tab
         /**
          * Creates a new instance which will write to the given appendable.
          *
-         * @param  out            where to format the tree.
-         * @param  column         the columns of the tree table to format.
-         * @param  parentObjects  an initially empty {@link IdentityHashMap}.
+         * @param  out               where to format the tree.
+         * @param  column            the columns of the tree table to format.
+         * @param  recursivityGuard  an initially empty set.
          */
-        Writer(final Appendable out, final TableColumn<?>[] columns, final Map<Object,Object>
parentObjects) {
+        Writer(final Appendable out, final TableColumn<?>[] columns, final Set<TreeTable.Node>
recursivityGuard) {
             super(columns.length >= 2 ? new TableAppender(out, "") : out);
             this.columns = columns;
             this.formats = getFormats(columns, false);
             this.values  = new Object[columns.length];
             this.isLast  = new boolean[8];
-            this.parentObjects = parentObjects;
+            this.recursivityGuard = recursivityGuard;
             setTabulationExpanded(true);
             setLineSeparator(" ¶ ");
         }
@@ -707,9 +700,7 @@ public class TreeTableFormat extends Tab
          * If the collection contains other collections, the other collections will <strong>not</strong>
          * be written recursively.
          */
-        private void formatCollection(final Iterable<?> values, final boolean recursive)
-                throws IOException
-        {
+        private void formatCollection(final Iterable<?> values, final boolean recursive)
throws IOException {
             if (values != null) {
                 if (recursive) {
                     append('…');                                // Do not format collections
inside collections.
@@ -771,25 +762,30 @@ public class TreeTableFormat extends Tab
             }
             /*
              * Format the children only if we do not detect an infinite recursivity. Our
recursivity detection
-             * algorithm assumes that the node content is fully determined by the user object.
If that assumption
-             * holds, then we have an infinite recursivity if the user object of the current
node is also the user
-             * object of a parent node.
+             * algorithm assumes that the Node.equals(Object) method has been implemented
as specified in its javadoc.
+             * In particular, the implementation may compare the values and children but
shall not compare the parent.
              *
-             * Note that the value stored in the 'parentObjects' map needs to be the 'userObject'
because we want
-             * the map value to be null if the user object is null, in order to format the
children even if many
-             * null user objects exist in the tree.
+             * We skip the check for the particular case of DefaultTreeTable.Node implementation
because it performs
+             * a real check of values and children, which is a little bit costly and known
to be unnecessary in that
+             * particular case.
              */
-            final Object userObject = node.getUserObject();
-            if (parentObjects.put(userObject, userObject) == null) {
+            final boolean omitCheck = (node.getClass() == DefaultTreeTable.Node.class);
+            if (omitCheck || recursivityGuard.add(node)) {
                 final Iterator<? extends TreeTable.Node> it = node.getChildren().iterator();
                 boolean hasNext = it.hasNext();
                 while (hasNext) {
                     final TreeTable.Node child = it.next();
                     hasNext = it.hasNext();
-                    isLast[level] = !hasNext; // Must be set before the call to 'format'
below.
+                    isLast[level] = !hasNext;                   // Must be set before the
call to 'format' below.
                     format(child, level+1);
                 }
-                parentObjects.remove(userObject);
+                if (!omitCheck && !recursivityGuard.remove(node)) {
+                    /*
+                     * Assuming that Node.hashCode() and Node.equals(Object) implementation
are not broken,
+                     * this exception may happen only if the node content changed during
this method execution.
+                     */
+                    throw new ConcurrentModificationException();
+                }
             } else {
                 /*
                  * Detected a recursivity. Format "(cycle omitted)" just below the node.
@@ -798,7 +794,7 @@ public class TreeTableFormat extends Tab
                     out.append(getTreeSymbols(true, isLast[i]));
                 }
                 final Locale locale = getDisplayLocale();
-                out.append('(').append(Vocabulary.getResources(locale)
+                out.append(treeBlank).append('(').append(Vocabulary.getResources(locale)
                    .getString(Vocabulary.Keys.CycleOmitted).toLowerCase(locale))
                    .append(')').append(lineSeparator);
             }
@@ -831,15 +827,27 @@ public class TreeTableFormat extends Tab
             final List<TableColumn<?>> c = tree.getColumns();
             columns = c.toArray(new TableColumn<?>[c.size()]);
         }
-        if (parentObjects == null) {
-            parentObjects = new IdentityHashMap<>();
+        if (recursivityGuard == null) {
+            recursivityGuard = new HashSet<>();
         }
         try {
-            final Writer out = new Writer(toAppendTo, columns, parentObjects);
+            final Writer out = new Writer(toAppendTo, columns, recursivityGuard);
             out.format(tree.getRoot(), 0);
             out.flush();
         } finally {
-            parentObjects.clear();
+            recursivityGuard.clear();
         }
     }
+
+    /**
+     * Returns a clone of this format.
+     *
+     * @return a clone of this format.
+     */
+    @Override
+    public TreeTableFormat clone() {
+        final TreeTableFormat c = (TreeTableFormat) super.clone();
+        c.recursivityGuard = null;
+        return c;
+    }
 }

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/IdentifiedObject.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/IdentifiedObject.java?rev=1778901&r1=1778900&r2=1778901&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/IdentifiedObject.java [UTF-8]
(original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/IdentifiedObject.java [UTF-8]
Sun Jan 15 10:36:23 2017
@@ -90,7 +90,7 @@ public interface IdentifiedObject {
      * Note that XML ID attribute are actually unique only in the scope of the XML document
      * being processed.
      *
-     * @return All identifiers associated to this object, or an empty collection if none.
+     * @return all identifiers associated to this object, or an empty collection if none.
      *
      * @see org.apache.sis.metadata.iso.citation.DefaultCitation#getIdentifiers()
      * @see org.apache.sis.metadata.iso.acquisition.DefaultObjective#getIdentifiers()
@@ -126,7 +126,7 @@ public interface IdentifiedObject {
      * The map supports {@link IdentifierMap#put(Object, Object) put} operations
      * if and only if this {@code IdentifiedObject} is modifiable.
      *
-     * @return The identifiers as a map of (<var>authority</var>, <var>code</var>)
entries,
+     * @return the identifiers as a map of (<var>authority</var>, <var>code</var>)
entries,
      *         or an empty map if none.
      */
     IdentifierMap getIdentifierMap();

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/IdentifierMap.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/IdentifierMap.java?rev=1778901&r1=1778900&r2=1778901&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/IdentifierMap.java [UTF-8]
(original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/IdentifierMap.java [UTF-8]
Sun Jan 15 10:36:23 2017
@@ -47,9 +47,9 @@ public interface IdentifierMap extends M
      * or {@code null} if this map contains no mapping of the
      * specialized type for the namespace.
      *
-     * @param  <T> The identifier type.
-     * @param  authority The namespace whose associated identifier is to be returned.
-     * @return The identifier to which the given namespace is mapped, or
+     * @param  <T>        the identifier type.
+     * @param  authority  the namespace whose associated identifier is to be returned.
+     * @return the identifier to which the given namespace is mapped, or
      *         {@code null} if this map contains no mapping for the namespace.
      */
     <T> T getSpecialized(IdentifierSpace<T> authority);
@@ -59,12 +59,12 @@ public interface IdentifierMap extends M
      * (optional operation). If the map previously contained a mapping for
      * the namespace, then the old value is replaced by the specified value.
      *
-     * @param  <T> The identifier type.
-     * @param  authority The namespace with which the given identifier is to be associated.
-     * @param  value The identifier to be associated with the given namespace.
-     * @return The previous identifier associated with {@code authority}, or {@code null}
+     * @param  <T>        the identifier type.
+     * @param  authority  the namespace with which the given identifier is to be associated.
+     * @param  value      the identifier to be associated with the given namespace.
+     * @return the previous identifier associated with {@code authority}, or {@code null}
      *         if there was no mapping of the specialized type for {@code authority}.
-     * @throws UnsupportedOperationException If the identifier map is unmodifiable.
+     * @throws UnsupportedOperationException if the identifier map is unmodifiable.
      */
     <T> T putSpecialized(IdentifierSpace<T> authority, T value) throws UnsupportedOperationException;
 }

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/IdentifierSpace.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/IdentifierSpace.java?rev=1778901&r1=1778900&r2=1778901&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/IdentifierSpace.java [UTF-8]
(original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/IdentifierSpace.java [UTF-8]
Sun Jan 15 10:36:23 2017
@@ -42,7 +42,7 @@ import org.apache.sis.internal.jaxb.NonM
  * The values defined in this interface can be used as keys in the map returned by
  * {@link IdentifiedObject#getIdentifierMap()}.
  *
- * @param <T> The type of object used as identifier values.
+ * @param  <T>  the type of object used as identifier values.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
@@ -124,7 +124,7 @@ public interface IdentifierSpace<T> exte
      *       identifiers are marshalled as {@code <MD_Identifier>} XML elements rather
than attributes.</li>
      * </ul>
      *
-     * @return The name of this identifier space (may be XML attribute name).
+     * @return the name of this identifier space (may be XML attribute name).
      */
     String getName();
 }

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/NilObjectHandler.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/NilObjectHandler.java?rev=1778901&r1=1778900&r2=1778901&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/NilObjectHandler.java [UTF-8]
(original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/NilObjectHandler.java [UTF-8]
Sun Jan 15 10:36:23 2017
@@ -20,6 +20,7 @@ import java.util.Map;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Objects;
 import java.lang.reflect.Proxy;
 import java.lang.reflect.Method;
 import java.lang.reflect.InvocationHandler;
@@ -33,9 +34,6 @@ import org.apache.sis.util.resources.Err
 import org.apache.sis.internal.jaxb.IdentifierMapAdapter;
 import org.apache.sis.internal.jaxb.ModifiableIdentifierMap;
 
-// Branch-dependent imports
-import java.util.Objects;
-
 
 /**
  * The handler for an object where all methods returns null or empty collections, except
@@ -102,7 +100,7 @@ final class NilObjectHandler implements
                 return type;
             }
         }
-        throw new AssertionError(proxy); // Should not happen.
+        throw new AssertionError(proxy);                                // Should not happen.
     }
 
     /**
@@ -186,7 +184,7 @@ final class NilObjectHandler implements
             return attribute.equals(h.attribute);
         }
         switch (mode) {
-            case STRICT: return false; // The above test is the only relevant one for this
mode.
+            case STRICT: return false;              // The above test is the only relevant
one for this mode.
             case BY_CONTRACT: {
                 Object tx = attribute, ox = null;
                 if (tx instanceof IdentifierMapAdapter) {
@@ -223,10 +221,10 @@ final class NilObjectHandler implements
                 }
                 if (value != null) {
                     if ((value instanceof Collection<?>) && ((Collection<?>)
value).isEmpty()) {
-                        continue; // Empty collection, which is consistent with this proxy
behavior.
+                        continue;           // Empty collection, which is consistent with
this proxy behavior.
                     }
                     if ((value instanceof Map<?,?>) && ((Map<?,?>) value).isEmpty())
{
-                        continue; // Empty collection, which is consistent with this proxy
behavior.
+                        continue;           // Empty collection, which is consistent with
this proxy behavior.
                     }
                     return false;
                 }

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java?rev=1778901&r1=1778900&r2=1778901&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java [UTF-8]
(original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java [UTF-8]
Sun Jan 15 10:36:23 2017
@@ -72,13 +72,13 @@ public class ReferenceResolver {
      *       {@code false}, depending on the method return type.</li>
      * </ul>
      *
-     * @param  <T>     The compile-time type of the {@code type} argument.
-     * @param  context Context (GML version, locale, <i>etc.</i>) of the (un)marshalling
process.
-     * @param  type    The type of object to be unmarshalled, often as a GeoAPI interface.
-     * @param  identifiers An arbitrary amount of identifiers. For each identifier, the
-     *         {@linkplain Identifier#getAuthority() authority} is typically (but not
-     *         necessarily) one of the constants defined in {@link IdentifierSpace}.
-     * @return An object of the given type for the given identifiers, or {@code null} if
none.
+     * @param  <T>          the compile-time type of the {@code type} argument.
+     * @param  context      context (GML version, locale, <i>etc.</i>) of the
(un)marshalling process.
+     * @param  type         the type of object to be unmarshalled, often as a GeoAPI interface.
+     * @param  identifiers  an arbitrary amount of identifiers. For each identifier,
+     *         the {@linkplain org.apache.sis.metadata.iso.ImmutableIdentifier#getAuthority()
authority}
+     *         is typically (but not necessarily) one of the constants defined in {@link
IdentifierSpace}.
+     * @return an object of the given type for the given identifiers, or {@code null} if
none.
      */
     @SuppressWarnings("unchecked")
     public <T> T newIdentifiedObject(final MarshalContext context, final Class<T>
type, final Identifier... identifiers) {
@@ -94,11 +94,11 @@ public class ReferenceResolver {
      * Returns an object of the given type for the given {@code uuid} attribute, or {@code
null} if none.
      * The default implementation returns {@code null} in all cases.
      *
-     * @param  <T>     The compile-time type of the {@code type} argument.
-     * @param  context Context (GML version, locale, <i>etc.</i>) of the (un)marshalling
process.
-     * @param  type    The type of object to be unmarshalled, often as a GeoAPI interface.
-     * @param  uuid The {@code uuid} attributes.
-     * @return An object of the given type for the given {@code uuid} attribute, or {@code
null} if none.
+     * @param  <T>      the compile-time type of the {@code type} argument.
+     * @param  context  context (GML version, locale, <i>etc.</i>) of the (un)marshalling
process.
+     * @param  type     the type of object to be unmarshalled, often as a GeoAPI interface.
+     * @param  uuid     the {@code uuid} attributes.
+     * @return an object of the given type for the given {@code uuid} attribute, or {@code
null} if none.
      */
     @SuppressWarnings("unchecked")
     public <T> T resolve(final MarshalContext context, final Class<T> type, final
UUID uuid) {
@@ -118,11 +118,11 @@ public class ReferenceResolver {
      *   <li>Otherwise returns {@code null}.</li>
      * </ul>
      *
-     * @param  <T>     The compile-time type of the {@code type} argument.
-     * @param  context Context (GML version, locale, <i>etc.</i>) of the (un)marshalling
process.
-     * @param  type    The type of object to be unmarshalled, often as a GeoAPI interface.
-     * @param  link    The {@code xlink} attributes.
-     * @return An object of the given type for the given {@code xlink} attribute, or {@code
null} if none.
+     * @param  <T>      the compile-time type of the {@code type} argument.
+     * @param  context  context (GML version, locale, <i>etc.</i>) of the (un)marshalling
process.
+     * @param  type     the type of object to be unmarshalled, often as a GeoAPI interface.
+     * @param  link     the {@code xlink} attributes.
+     * @return an object of the given type for the given {@code xlink} attribute, or {@code
null} if none.
      */
     public <T> T resolve(final MarshalContext context, final Class<T> type, final
XLink link) {
         ensureNonNull("type",  type);
@@ -173,11 +173,11 @@ public class ReferenceResolver {
      * <p>The default implementation unconditionally returns {@code true}.
      * Subclasses can override this method if they want to filter which objects to declare
by reference.</p>
      *
-     * @param  <T>     The compile-time type of the {@code type} argument.
-     * @param  context Context (GML version, locale, <i>etc.</i>) of the (un)marshalling
process.
-     * @param  type    The type of object to be unmarshalled, often as a GeoAPI interface.
-     * @param  object  The object to be marshalled.
-     * @param  id      The {@code gml:id} value of the object to be marshalled.
+     * @param  <T>      the compile-time type of the {@code type} argument.
+     * @param  context  context (GML version, locale, <i>etc.</i>) of the (un)marshalling
process.
+     * @param  type     the type of object to be unmarshalled, often as a GeoAPI interface.
+     * @param  object   the object to be marshalled.
+     * @param  id       the {@code gml:id} value of the object to be marshalled.
      * @return {@code true} if the marshaller can use the {@code xlink:href="#id"} attribute
      *         instead than marshalling the given object.
      *
@@ -202,11 +202,11 @@ public class ReferenceResolver {
      *
      * Subclasses can override this method if they know whether the receiver will be able
to resolve the reference.
      *
-     * @param  <T>     The compile-time type of the {@code type} argument.
-     * @param  context Context (GML version, locale, <i>etc.</i>) of the (un)marshalling
process.
-     * @param  type    The type of object to be unmarshalled, often as a GeoAPI interface.
-     * @param  object  The object to be marshalled.
-     * @param  uuid    The unique identifier of the object to be marshalled.
+     * @param  <T>      the compile-time type of the {@code type} argument.
+     * @param  context  context (GML version, locale, <i>etc.</i>) of the (un)marshalling
process.
+     * @param  type     the type of object to be unmarshalled, often as a GeoAPI interface.
+     * @param  object   the object to be marshalled.
+     * @param  uuid     the unique identifier of the object to be marshalled.
      * @return {@code true} if the marshaller can use the {@code uuidref} attribute
      *         instead than marshalling the given object.
      */
@@ -229,11 +229,11 @@ public class ReferenceResolver {
      *
      * Subclasses can override this method if they know whether the receiver will be able
to resolve the reference.
      *
-     * @param  <T>     The compile-time type of the {@code type} argument.
-     * @param  context Context (GML version, locale, <i>etc.</i>) of the (un)marshalling
process.
-     * @param  type    The type of object to be unmarshalled, often as a GeoAPI interface.
-     * @param  object  The object to be marshalled.
-     * @param  link    The reference of the object to be marshalled.
+     * @param  <T>      the compile-time type of the {@code type} argument.
+     * @param  context  context (GML version, locale, <i>etc.</i>) of the (un)marshalling
process.
+     * @param  type     the type of object to be unmarshalled, often as a GeoAPI interface.
+     * @param  object   the object to be marshalled.
+     * @param  link     the reference of the object to be marshalled.
      * @return {@code true} if the marshaller can use the {@code xlink:href} attribute
      *         instead than marshalling the given object.
      */
@@ -263,15 +263,14 @@ public class ReferenceResolver {
      * </td></tr>
      * </table>
      *
-     * Subclasses can override this method if they can provide a mapping from some text
-     * values to anchors.
+     * Subclasses can override this method if they can provide a mapping from some text values
to anchors.
      *
-     * @param  context Context (GML version, locale, <i>etc.</i>) of the (un)marshalling
process.
-     * @param  value   The value for which an anchor is requested. Often the same instance
than {@code text},
-     *                 but can also be the {@link java.net.URI} or {@link java.util.Locale}
instance for which
-     *                 {@code text} is a string representation.
-     * @param  text    The textual representation of the value for which to get the anchor.
-     * @return The anchor for the given text, or {@code null} if none.
+     * @param  context  context (GML version, locale, <i>etc.</i>) of the (un)marshalling
process.
+     * @param  value    the value for which an anchor is requested. Often the same instance
than {@code text},
+     *                  but can also be the {@link java.net.URI} or {@link java.util.Locale}
instance for which
+     *                  {@code text} is a string representation.
+     * @param  text     the textual representation of the value for which to get the anchor.
+     * @return the anchor for the given text, or {@code null} if none.
      */
     public XLink anchor(final MarshalContext context, final Object value, final CharSequence
text) {
         return (text instanceof Anchor) ? (Anchor) text : null;

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/DefaultTreeTableTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/DefaultTreeTableTest.java?rev=1778901&r1=1778900&r2=1778901&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/DefaultTreeTableTest.java
[UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/DefaultTreeTableTest.java
[UTF-8] Sun Jan 15 10:36:23 2017
@@ -46,8 +46,7 @@ public final strictfp class DefaultTreeT
      * <p>This method is part of a chain.
      * The next method is {@link #testNodeCreation(DefaultTreeTable)}.</p>
      *
-     * @return The created table, for chaining with methods testing the next step
-     *         after this one.
+     * @return the created table, for chaining with methods testing the next step after this
one.
      */
     @TestStep
     public static DefaultTreeTable testTableCreation() {
@@ -67,8 +66,8 @@ public final strictfp class DefaultTreeT
      * The previous method is {@link #testTableCreation()} and
      * the next method is {@link #testNodeDisplacement(TreeTable.Node)}.</p>
      *
-     * @param  table An initially empty table where to set the root.
-     * @return The root node produced by this method.
+     * @param  table  an initially empty table where to set the root.
+     * @return the root node produced by this method.
      */
     @TestStep
     public static DefaultTreeTable.Node testNodeCreation(final DefaultTreeTable table) {
@@ -111,7 +110,7 @@ public final strictfp class DefaultTreeT
      * The previous method is {@link #testNodeCreation(DefaultTreeTable)} and
      * the next method is {@link #testSerialization(TreeTable)}.</p>
      *
-     * @param root The root node where to move children.
+     * @param  root  the root node where to move children.
      */
     @TestStep
     public static void testNodeDisplacement(final TreeTable.Node root) {
@@ -142,8 +141,8 @@ public final strictfp class DefaultTreeT
      * <p>This method is part of a chain.
      * The previous method is {@link #testNodeDisplacement(TreeTable.Node)}.</p>
      *
-     * @param  table The table to clone.
-     * @throws CloneNotSupportedException Should never happen.
+     * @param  table  the table to clone.
+     * @throws CloneNotSupportedException if the table can not be cloned.
      */
     @TestStep
     public static void testClone(final DefaultTreeTable table) throws CloneNotSupportedException
{
@@ -161,7 +160,7 @@ public final strictfp class DefaultTreeT
      * <p>This method is part of a chain.
      * The previous method is {@link #testNodeDisplacement(TreeTable.Node)}.</p>
      *
-     * @param table The table to serialize.
+     * @param  table  the table to serialize.
      */
     @TestStep
     public static void testSerialization(final TreeTable table) {
@@ -188,7 +187,7 @@ public final strictfp class DefaultTreeT
      *
      * <p>This test is actually a chain of {@link TestStep} methods.</p>
      *
-     * @throws CloneNotSupportedException If the {@link DefaultTreeTable#clone()} method
failed.
+     * @throws CloneNotSupportedException if the {@link DefaultTreeTable#clone()} method
failed.
      */
     @Test
     public void testTreeTableCreation() throws CloneNotSupportedException {

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/TreeTableFormatTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/TreeTableFormatTest.java?rev=1778901&r1=1778900&r2=1778901&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/TreeTableFormatTest.java
[UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/TreeTableFormatTest.java
[UTF-8] Sun Jan 15 10:36:23 2017
@@ -68,7 +68,7 @@ public final strictfp class TreeTableFor
      * and performs its check on the assumption that the tree formatting is
      * accurate.
      *
-     * @throws ParseException Should never happen.
+     * @throws ParseException if the parsing failed.
      */
     @Test
     @DependsOnMethod("testTreeFormat")
@@ -139,7 +139,7 @@ public final strictfp class TreeTableFor
      * Tests the parsing of a tree table. This method parses and reformats a tree table,
      * and performs its check on the assumption that the tree table formatting is accurate.
      *
-     * @throws ParseException Should never happen.
+     * @throws ParseException if the parsing failed.
      */
     @Test
     @DependsOnMethod("testTreeTableFormat")
@@ -161,7 +161,7 @@ public final strictfp class TreeTableFor
     /**
      * Tests parsing and formatting using a different column separator.
      *
-     * @throws ParseException Should never happen.
+     * @throws ParseException if the parsing failed.
      */
     @Test
     @DependsOnMethod("testTreeTableParse")
@@ -190,7 +190,7 @@ public final strictfp class TreeTableFor
         tf.setColumnSeparatorPattern("? [ ]; ");
         assertMultilinesEquals(
                 "Node #1         ; 10 ; Value #1B\n" +
-                " ├──Node #2     ; 20\n" + // Column separator omitted here.
+                " ├──Node #2     ; 20\n" +                                  // Column
separator omitted here.
                 " │   └──Node #4 ; 40 ; Value #4B\n" +
                 " └──Node #3     ;    ; Value #3B\n", tf.format(table));
         /*
@@ -256,14 +256,14 @@ public final strictfp class TreeTableFor
         assertMultilinesEquals(
                 "Root\n" +
                 "  ├─CodeList…… Point of contact\n" + // Not yet localized.
-                "  ├─Enum……………… Half down\n" +        // No localization
provided.
+                "  ├─Enum……………… Half down\n" +                      //
No localization provided.
                 "  └─i18n……………… Une phrase en français\n", tf.format(table));
 
         tf = new TreeTableFormat(Locale.JAPANESE, null);
         assertMultilinesEquals(
                 "Root\n" +
-                "  ├─CodeList…… Point of contact\n" + // Not yet localized.
-                "  ├─Enum……………… Half down\n" +        // No localization
provided.
+                "  ├─CodeList…… Point of contact\n" +               // Not yet
localized.
+                "  ├─Enum……………… Half down\n" +                      //
No localization provided.
                 "  └─i18n……………… 日本語の言葉\n", tf.format(table));
     }
 }



Mime
View raw message