WeakHashSet changes for revisions 25816:25820

The comments added by this commit have been removed, since the CanonicalSet class has not been retained. The changes in method visibility from private to protected have been reverted, since this internal mechanism should really stay private.

Command line:

svn diff --extensions "--unified --ignore-space-change --ignore-all-space --ignore-eol-style" -r25816:25820 https://svn.osgeo.org/geotools/trunk/modules/library/metadata/src/main/java/org/geotools/util/WeakHashSet.java
Revision 25816Revision 25820
* When an entry has been discarded it is effectively removed from the set, so
* this class behaves somewhat differently than other {@link Set} implementations.
* <br><br>
* {@code WeakHashSet} has a  {@link #get}  method that is not part of the
* {@link Set} interface. This {@code get} method fetch an entry from this
* set that is equals to the supplied object.   This is a convenient way to use
* {@code WeakHashSet} as a pool of immutable objects.
* <br><br>
* The {@code WeakHashSet} class is thread-safe.
*
* When an entry has been discarded it is effectively removed from the set, so
* this class behaves somewhat differently than other {@link Set} implementations.
* <br><br>
* If you would like to use {@code WeakHashSet} as inside a factory to prevent
* creating duplicate immutable objects please look at CanonicalSet.
* <br><br>
* The {@code WeakHashSet} class is thread-safe.
*
}

// Arguments for the {@link #intern} method.
/** The "remove" operation.  */  private static final int REMOVE = -1;
/** The "get"    operation.  */  private static final int GET    =  0;
/** The "add"    operation.  */  private static final int ADD    = +1;
/** The "intern" operation.  */  private static final int INTERN = +2;

/**
 * Returns an object equals to {@code obj} if such an object already
}

// Arguments for the {@link #intern} method.
/** The "remove" operation.  */  protected static final int REMOVE = -1;
/** The "get"    operation.  */  protected static final int GET    =  0;
/** The "add"    operation.  */  protected static final int ADD    = +1;
/** The "intern" operation.  */  protected static final int INTERN = +2;

/**
 * Returns an object equals to {@code obj} if such an object already
 * &nbsp;  return object;
 * </pre></blockquote>
 */
private Object intern(final Object obj, final int operation) {
    assert Thread.holdsLock(this);
    assert WeakCollectionCleaner.DEFAULT.isAlive();
    assert valid() : count;
 * &nbsp;  return object;
 * </pre></blockquote>
 */
protected Object intern(final Object obj, final int operation) {
    assert Thread.holdsLock(this);
    assert WeakCollectionCleaner.DEFAULT.isAlive();
    assert valid() : count;
 * &nbsp;  }
 * &nbsp;  return object;
 * </pre></blockquote>
 */
public synchronized Object canonicalize(final Object object) {
    return intern(object, INTERN);
 * &nbsp;  }
 * &nbsp;  return object;
 * </pre></blockquote>
 * @see CanonicalSet.toUnique
 */
public synchronized Object canonicalize(final Object object) {
    return intern(object, INTERN);