sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1766794 - in /sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/collection: WeakEntry.java WeakHashSet.java WeakValueHashMap.java
Date Thu, 27 Oct 2016 09:27:42 GMT
Author: desruisseaux
Date: Thu Oct 27 09:27:42 2016
New Revision: 1766794

URL: http://svn.apache.org/viewvc?rev=1766794&view=rev
Log:
Javadoc fixes.

Modified:
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakEntry.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakHashSet.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakEntry.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakEntry.java?rev=1766794&r1=1766793&r2=1766794&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakEntry.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakEntry.java
[UTF-8] Thu Oct 27 09:27:42 2016
@@ -35,7 +35,7 @@ import org.apache.sis.math.MathFunctions
  * This is an element in a linked list. When the reference is disposed, it is removed
  * from the enclosing collection.
  *
- * @param <E> The type of elements in the collection.
+ * @param  <E>  the type of elements in the collection.
  *
  * @author  Martin Desruisseaux (MPO, IRD, Geomatys)
  * @since   0.3
@@ -90,9 +90,9 @@ abstract class WeakEntry<E> extends Weak
      * Counts the number of entries in the given table.
      * This method does not verify if the referenced object has been garbage collected.
      *
-     * @param  <E>   The type of elements in the collection.
-     * @param  table The table in which to count the number of entries.
-     * @return Number of entries in the given table.
+     * @param  <E>    the type of elements in the collection.
+     * @param  table  the table in which to count the number of entries.
+     * @return number of entries in the given table.
      */
     static <E> int count(final WeakEntry<E>[] table) {
         int n = 0;
@@ -108,8 +108,8 @@ abstract class WeakEntry<E> extends Weak
     /**
      * Removes this entry from the given table of entries.
      *
-     * @param  table    The table from which to remove this entry.
-     * @param  removeAt The index of this entry in the given table.
+     * @param  table     the table from which to remove this entry.
+     * @param  removeAt  the index of this entry in the given table.
      * @return {@code true} if this entry has been found and removed, or {@code false} otherwise.
      */
     final boolean removeFrom(final WeakEntry<E>[] table, final int removeAt) {
@@ -134,12 +134,12 @@ abstract class WeakEntry<E> extends Weak
     /**
      * Rehashes the given table.
      *
-     * @param  oldTable     The table to rehash.
-     * @param  count        Number of elements in the table (including chained elements).
-     * @param  callerMethod The method invoking this one, for logging purpose only. The caller
class
+     * @param  oldTable      the table to rehash.
+     * @param  count         number of elements in the table (including chained elements).
+     * @param  callerMethod  the method invoking this one, for logging purpose only. The
caller class
      *         will be inferred from the enclosing class of the {@code oldTable} component
type. This
      *         uses the knowledge that all our implementations of {@code WeakEntry} are inner
classes.
-     * @return The new table array, or {@code oldTable} if no rehash were needed.
+     * @return the new table array, or {@code oldTable} if no rehash were needed.
      */
     static <E> WeakEntry<E>[] rehash(final WeakEntry<E>[] oldTable, final
int count, final String callerMethod) {
         /*
@@ -188,8 +188,8 @@ abstract class WeakEntry<E> extends Weak
      * If the number of elements is lower than this threshold, then the table should be
      * rehashed for saving space.
      *
-     * @param  capacity The table capacity.
-     * @return Minimal number of elements for not rehashing.
+     * @param  capacity  the table capacity.
+     * @return minimal number of elements for not rehashing.
      */
     static int lowerCapacityThreshold(final int capacity) {
         return capacity >>> 2;
@@ -199,8 +199,8 @@ abstract class WeakEntry<E> extends Weak
      * If the number of elements is upper than this threshold, then the table should be
      * rehashed for better performance.
      *
-     * @param  capacity The table capacity.
-     * @return Maximal number of elements for not rehashing.
+     * @param  capacity  the table capacity.
+     * @return maximal number of elements for not rehashing.
      */
     static int upperCapacityThreshold(final int capacity) {
         return capacity - (capacity >>> 2);

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakHashSet.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakHashSet.java?rev=1766794&r1=1766793&r2=1766794&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakHashSet.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakHashSet.java
[UTF-8] Thu Oct 27 09:27:42 2016
@@ -69,7 +69,7 @@ import java.util.Objects;
  * the caller. But if a sequence of two or more method calls need to appear atomic from other
threads perspective,
  * then the caller can synchronize on {@code this}.
  *
- * @param <E> The type of elements in the set.
+ * @param  <E>  the type of elements in the set.
  *
  * @author  Martin Desruisseaux (MPO, IRD, Geomatys)
  * @since   0.3
@@ -134,7 +134,7 @@ public class WeakHashSet<E> extends Abst
     /**
      * Creates a {@code WeakHashSet} for elements of the specified type.
      *
-     * @param type The type of the element to be included in this set.
+     * @param  type  the type of the element to be included in this set.
      */
     public WeakHashSet(final Class<E> type) {
         elementType            = type;
@@ -198,7 +198,7 @@ public class WeakHashSet<E> extends Abst
     /**
      * Returns the count of element in this set.
      *
-     * @return Number of elements in this set.
+     * @return number of elements in this set.
      */
     @Override
     public synchronized int size() {
@@ -211,9 +211,9 @@ public class WeakHashSet<E> extends Abst
      * If this set already contains the specified element, the call leaves
      * this set unchanged and returns {@code false}.
      *
-     * @param  element Element to be added to this set.
+     * @param  element  element to be added to this set.
      * @return {@code true} if this set did not already contain the specified element.
-     * @throws NullArgumentException If the given object is {@code null}.
+     * @throws NullArgumentException if the given object is {@code null}.
      */
     @Override
     public synchronized boolean add(final E element) throws NullArgumentException {
@@ -225,7 +225,7 @@ public class WeakHashSet<E> extends Abst
      * Removes a single instance of the specified element from this set, if it is present
      * Null values are considered never present.
      *
-     * @param  element element to be removed from this set, if present. Can be {@code null}.
+     * @param  element  element to be removed from this set, if present. Can be {@code null}.
      * @return {@code true} if the set contained the specified element.
      */
     @Override
@@ -238,8 +238,8 @@ public class WeakHashSet<E> extends Abst
      * contain any object equals to {@code element}, then this method returns {@code null}.
      * Null values are considered never present.
      *
-     * @param  element The element to get.
-     * @return An element equals to the given one if already presents in the set,
+     * @param  element  the element to get.
+     * @return an element equals to the given one if already presents in the set,
      *         or {@code null} otherwise.
      *
      * @see #unique(Object)
@@ -252,7 +252,7 @@ public class WeakHashSet<E> extends Abst
      * Returns {@code true} if this set contains the specified element.
      * Null values are considered never present.
      *
-     * @param  element Object to be checked for containment in this set. Can be {@code null}.
+     * @param  element  object to be checked for containment in this set. Can be {@code null}.
      * @return {@code true} if this set contains the specified element.
      */
     @Override
@@ -277,10 +277,10 @@ public class WeakHashSet<E> extends Abst
      *     return element;
      * }
      *
-     * @param  <T> The type of the element to get. Can be {@code null}.
-     * @param  element The element to get or to add in the set if not already presents,
-     *         or {@code null} if the given element was null.
-     * @return An element equals to the given one if already presents in the set,
+     * @param  <T>      the type of the element to get. Can be {@code null}.
+     * @param  element  the element to get or to add in the set if not already presents,
+     *                  or {@code null} if the given element was null.
+     * @return an element equals to the given one if already presents in the set,
      *         or the given {@code object} otherwise.
      */
     public synchronized <T extends E> T unique(final T element) {
@@ -357,7 +357,7 @@ public class WeakHashSet<E> extends Abst
      * order. Note that this array contains strong references. Consequently, no
      * object reclamation will occur as long as a reference to this array is hold.
      *
-     * @return All elements in this set.
+     * @return all elements in this set.
      */
     @Override
     public synchronized E[] toArray() {
@@ -381,7 +381,7 @@ public class WeakHashSet<E> extends Abst
      * No element from this set will be garbage collected as long as a
      * reference to the iterator is hold.
      *
-     * @return An iterator over all elements in this set.
+     * @return an iterator over all elements in this set.
      */
     @Override
     public Iterator<E> iterator() {

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java?rev=1766794&r1=1766793&r2=1766794&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java
[UTF-8] Thu Oct 27 09:27:42 2016
@@ -56,7 +56,7 @@ import java.util.Objects;
  *     V value;
  *     synchronized (map) {
  *         value = map.get(key);
- *         if (value != null) {
+ *         if (value == null) {
  *             value = ...; // Create the value here.
  *             map.put(key, value);
  *         }
@@ -75,8 +75,8 @@ import java.util.Objects;
  * of the caller. But if a sequence of two or more method calls need to appear atomic from
other threads perspective,
  * then the caller can synchronize on {@code this}.
  *
- * @param <K> The class of key elements.
- * @param <V> The class of value elements.
+ * @param  <K>  the class of key elements.
+ * @param  <V>  the class of value elements.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3
@@ -233,7 +233,7 @@ public class WeakValueHashMap<K,V> exten
     /**
      * Creates a new {@code WeakValueHashMap}.
      *
-     * @param keyType The type of keys in the map.
+     * @param  keyType  the type of keys in the map.
      */
     public WeakValueHashMap(final Class<K> keyType) {
         this(keyType, false);
@@ -247,9 +247,9 @@ public class WeakValueHashMap<K,V> exten
      * <p>Reference-equality semantic is rarely used. See the {@link java.util.IdentityHashMap}
class javadoc
      * for a discussion about drawbacks and use cases when reference-equality semantic is
useful.</p>
      *
-     * @param keyType  The type of keys in the map.
-     * @param identity {@code true} if the map shall use reference-equality in place of object-equality
-     *                 when comparing keys, or {@code false} for the standard behavior.
+     * @param  keyType   the type of keys in the map.
+     * @param  identity  {@code true} if the map shall use reference-equality in place of
object-equality
+     *                   when comparing keys, or {@code false} for the standard behavior.
      *
      * @since 0.4
      */
@@ -309,7 +309,7 @@ public class WeakValueHashMap<K,V> exten
     /**
      * Returns the number of key-value mappings in this map.
      *
-     * @return The number of entries in this map.
+     * @return the number of entries in this map.
      */
     @Override
     public synchronized int size() {
@@ -320,7 +320,7 @@ public class WeakValueHashMap<K,V> exten
     /**
      * Returns the hash code value for the given key.
      *
-     * @param key The key (can not be null).
+     * @param  key  the key (can not be null).
      */
     final int keyHashCode(final Object key) {
         switch (comparisonMode) {
@@ -334,8 +334,8 @@ public class WeakValueHashMap<K,V> exten
     /**
      * Returns {@code true} if the two given keys are equal.
      *
-     * @param k1 The first key (can not be null).
-     * @paral k2 The second key.
+     * @param  k1  the first key (can not be null).
+     * @paral  k2  the second key.
      */
     final boolean keyEquals(final Object k1, final Object k2) {
         switch (comparisonMode) {
@@ -350,7 +350,7 @@ public class WeakValueHashMap<K,V> exten
      * Returns {@code true} if this map contains a mapping for the specified key.
      * Null keys are considered never present.
      *
-     * @param  key key whose presence in this map is to be tested.
+     * @param  key  key whose presence in this map is to be tested.
      * @return {@code true} if this map contains a mapping for the specified key.
      */
     @Override
@@ -362,7 +362,7 @@ public class WeakValueHashMap<K,V> exten
      * Returns {@code true} if this map maps one or more keys to this value.
      * Null values are considered never present.
      *
-     * @param  value value whose presence in this map is to be tested.
+     * @param  value  value whose presence in this map is to be tested.
      * @return {@code true} if this map maps one or more keys to this value.
      */
     @Override
@@ -375,8 +375,8 @@ public class WeakValueHashMap<K,V> exten
      * Returns {@code null} if the map contains no mapping for this key.
      * Null keys are considered never present.
      *
-     * @param  key Key whose associated value is to be returned.
-     * @return The value to which this map maps the specified key.
+     * @param  key  key whose associated value is to be returned.
+     * @return the value to which this map maps the specified key.
      */
     @Override
     @SuppressWarnings("unchecked")
@@ -436,9 +436,9 @@ public class WeakValueHashMap<K,V> exten
      * Associates the specified value with the specified key in this map.
      * The value is associated using a {@link WeakReference}.
      *
-     * @param  key key with which the specified value is to be associated.
-     * @param  value value to be associated with the specified key.
-     * @return The previous value associated with specified key, or {@code null} if there
was no mapping for key.
+     * @param  key    key with which the specified value is to be associated.
+     * @param  value  value to be associated with the specified key.
+     * @return the previous value associated with specified key, or {@code null} if there
was no mapping for key.
      *
      * @throws NullArgumentException if the key or the value is {@code null}.
      */
@@ -457,9 +457,9 @@ public class WeakValueHashMap<K,V> exten
      * value is returned. Otherwise the specified value is associated to the key using a
{@link WeakReference}
      * and {@code null} is returned.
      *
-     * @param  key key with which the specified value is to be associated.
-     * @param  value value to be associated with the specified key.
-     * @return The current value associated with specified key, or {@code null} if there
was no mapping for key.
+     * @param  key    key with which the specified value is to be associated.
+     * @param  value  value to be associated with the specified key.
+     * @return the current value associated with specified key, or {@code null} if there
was no mapping for key.
      *
      * @throws NullArgumentException if the key or the value is {@code null}.
      *
@@ -477,7 +477,7 @@ public class WeakValueHashMap<K,V> exten
     /**
      * Removes the mapping for this key from this map if present.
      *
-     * @param key key whose mapping is to be removed from the map.
+     * @param  key  key whose mapping is to be removed from the map.
      * @return previous value associated with specified key, or {@code null} if there was
no entry for key.
      */
     @Override
@@ -528,8 +528,7 @@ public class WeakValueHashMap<K,V> exten
 
         /**
          * Returns a view of this set as an array. Note that this array contains strong references.
-         * Consequently, no object reclamation will occur as long as a reference to this
array is
-         * hold.
+         * Consequently, no object reclamation will occur as long as a reference to this
array is hold.
          */
         @Override
         @SuppressWarnings("unchecked")



Mime
View raw message