commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1353139 - /commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/
Date Sat, 23 Jun 2012 15:05:22 GMT
Author: tn
Date: Sat Jun 23 15:05:20 2012
New Revision: 1353139

URL: http://svn.apache.org/viewvc?rev=1353139&view=rev
Log:
[COLLECTIONS-231] return specific type rather than base type in factory methods, javadoc cleanup.

Modified:
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/BlockingBuffer.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/BoundedBuffer.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/PredicatedBuffer.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/SynchronizedBuffer.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/TransformedBuffer.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/UnboundedFifoBuffer.java
    commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/UnmodifiableBuffer.java

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java?rev=1353139&r1=1353138&r2=1353139&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java
(original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/AbstractBufferDecorator.java
Sat Jun 23 15:05:20 2012
@@ -65,10 +65,17 @@ public abstract class AbstractBufferDeco
     }
 
     //-----------------------------------------------------------------------
+    
+    /**
+     * {@inheritDoc}
+     */
     public E get() {
         return decorated().get();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public E remove() {
         return decorated().remove();
     }

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/BlockingBuffer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/BlockingBuffer.java?rev=1353139&r1=1353138&r2=1353139&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/BlockingBuffer.java
(original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/BlockingBuffer.java
Sat Jun 23 15:05:20 2012
@@ -59,26 +59,27 @@ public class BlockingBuffer<E> extends S
     /**
      * Factory method to create a blocking buffer.
      *
-     * @param <T> the type of the elements in the buffer
+     * @param <E> the type of the elements in the buffer
      * @param buffer the buffer to decorate, must not be null
      * @return a new blocking Buffer
      * @throws IllegalArgumentException if buffer is null
      */
-    public static <T> Buffer<T> blockingBuffer(Buffer<T> buffer) {
-        return new BlockingBuffer<T>(buffer);
+    public static <E> BlockingBuffer<E> blockingBuffer(Buffer<E> buffer)
{
+        return new BlockingBuffer<E>(buffer);
     }
 
     /**
      * Factory method to create a blocking buffer with a timeout value.
      *
+     * @param <E> the type of the elements in the buffer
      * @param buffer  the buffer to decorate, must not be null
      * @param timeoutMillis  the timeout value in milliseconds, zero or less for no timeout
      * @return a new blocking buffer
      * @throws IllegalArgumentException if the buffer is null
      * @since Commons Collections 3.2
      */
-    public static <T> Buffer<T> blockingBuffer(Buffer<T> buffer, long timeoutMillis)
{
-        return new BlockingBuffer<T>(buffer, timeoutMillis);
+    public static <E> BlockingBuffer<E> blockingBuffer(Buffer<E> buffer,
long timeoutMillis) {
+        return new BlockingBuffer<E>(buffer, timeoutMillis);
     }
 
     //-----------------------------------------------------------------------    
@@ -131,6 +132,7 @@ public class BlockingBuffer<E> extends S
      * set in the constructor.
      *
      * @throws BufferUnderflowException if an interrupt is received
+     * {@inheritDoc}
      */
     @Override
     public E get() {
@@ -157,6 +159,7 @@ public class BlockingBuffer<E> extends S
      * added for up to the specified timeout value if the buffer is empty.
      *
      * @param timeout  the timeout value in milliseconds
+     * @return the next object in the buffer
      * @throws BufferUnderflowException if an interrupt is received
      * @throws BufferUnderflowException if the timeout expires
      * @since Commons Collections 3.2
@@ -188,6 +191,7 @@ public class BlockingBuffer<E> extends S
      * set in the constructor.
      *
      * @throws BufferUnderflowException if an interrupt is received
+     * {@inheritDoc}
      */
     @Override
     public E remove() {
@@ -214,6 +218,7 @@ public class BlockingBuffer<E> extends S
      * added for up to the specified timeout value if the buffer is empty.
      *
      * @param timeout  the timeout value in milliseconds
+     * @return the next object in the buffer, which is also removed
      * @throws BufferUnderflowException if an interrupt is received
      * @throws BufferUnderflowException if the timeout expires
      * @since Commons Collections 3.2

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/BoundedBuffer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/BoundedBuffer.java?rev=1353139&r1=1353138&r2=1353139&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/BoundedBuffer.java
(original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/BoundedBuffer.java
Sat Jun 23 15:05:20 2012
@@ -61,6 +61,7 @@ public class BoundedBuffer<E> extends Sy
      * When the buffer is full, it will immediately throw a
      * <code>BufferOverflowException</code> on calling <code>add()</code>.
      *
+     * @param <E> the type of the elements in the buffer
      * @param buffer  the buffer to decorate, must not be null
      * @param maximumSize  the maximum size, must be size one or greater
      * @return a new bounded buffer
@@ -75,6 +76,7 @@ public class BoundedBuffer<E> extends Sy
      * Factory method to create a bounded buffer that blocks for a maximum
      * amount of time.
      *
+     * @param <E> the type of the elements in the buffer
      * @param buffer  the buffer to decorate, must not be null
      * @param maximumSize  the maximum size, must be size one or greater
      * @param timeout  the maximum amount of time to wait in milliseconds
@@ -169,11 +171,17 @@ public class BoundedBuffer<E> extends Sy
         }
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean isFull() {
         // size() is synchronized
         return (size() == maxSize());
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int maxSize() {
         return maximumSize;
     }

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/PredicatedBuffer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/PredicatedBuffer.java?rev=1353139&r1=1353138&r2=1353139&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/PredicatedBuffer.java
(original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/PredicatedBuffer.java
Sat Jun 23 15:05:20 2012
@@ -50,14 +50,15 @@ public class PredicatedBuffer<E> extends
      * If there are any elements already in the buffer being decorated, they
      * are validated.
      * 
+     * @param <E> the type of the elements in the buffer
      * @param buffer  the buffer to decorate, must not be null
      * @param predicate  the predicate to use for validation, must not be null
      * @return a new predicated Buffer
      * @throws IllegalArgumentException if buffer or predicate is null
      * @throws IllegalArgumentException if the buffer contains invalid elements
      */
-    public static <T> Buffer<T> predicatedBuffer(Buffer<T> buffer, Predicate<?
super T> predicate) {
-        return new PredicatedBuffer<T>(buffer, predicate);
+    public static <E> PredicatedBuffer<E> predicatedBuffer(Buffer<E> buffer,
Predicate<? super E> predicate) {
+        return new PredicatedBuffer<E>(buffer, predicate);
     }
     
     //-----------------------------------------------------------------------
@@ -87,10 +88,17 @@ public class PredicatedBuffer<E> extends
     }
 
     //-----------------------------------------------------------------------
+    
+    /**
+     * {@inheritDoc}
+     */
     public E get() {
         return decorated().get();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public E remove() {
         return decorated().remove();
     }

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/SynchronizedBuffer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/SynchronizedBuffer.java?rev=1353139&r1=1353138&r2=1353139&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/SynchronizedBuffer.java
(original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/SynchronizedBuffer.java
Sat Jun 23 15:05:20 2012
@@ -43,13 +43,13 @@ public class SynchronizedBuffer<E>
     /**
      * Factory method to create a synchronized buffer.
      * 
-     * @param <T> the type of the elements in the buffer
+     * @param <E> the type of the elements in the buffer
      * @param buffer  the buffer to decorate, must not be null
      * @return a new synchronized Buffer
      * @throws IllegalArgumentException if buffer is null
      */
-    public static <T> Buffer<T> synchronizedBuffer(Buffer<T> buffer) {
-        return new SynchronizedBuffer<T>(buffer);
+    public static <E> SynchronizedBuffer<E> synchronizedBuffer(Buffer<E>
buffer) {
+        return new SynchronizedBuffer<E>(buffer);
     }
 
     //-----------------------------------------------------------------------
@@ -85,12 +85,19 @@ public class SynchronizedBuffer<E>
     }
 
     //-----------------------------------------------------------------------
+    
+    /**
+     * {@inheritDoc}
+     */
     public E get() {
         synchronized (lock) {
             return decorated().get();
         }
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public E remove() {
         synchronized (lock) {
             return decorated().remove();

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/TransformedBuffer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/TransformedBuffer.java?rev=1353139&r1=1353138&r2=1353139&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/TransformedBuffer.java
(original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/TransformedBuffer.java
Sat Jun 23 15:05:20 2012
@@ -47,12 +47,14 @@ public class TransformedBuffer<E> extend
      * are NOT transformed.
      * Contrast this with {@link #transformedBuffer(Buffer, Transformer)}.
      * 
+     * @param <E> the type of the elements in the buffer
      * @param buffer  the buffer to decorate, must not be null
      * @param transformer  the transformer to use for conversion, must not be null
      * @return a new transformed Buffer
      * @throws IllegalArgumentException if buffer or transformer is null
      */
-    public static <E> Buffer<E> transformingBuffer(Buffer<E> buffer, Transformer<?
super E, ? extends E> transformer) {
+    public static <E> TransformedBuffer<E> transformingBuffer(Buffer<E>
buffer,
+                                                              Transformer<? super E, ?
extends E> transformer) {
         return new TransformedBuffer<E>(buffer, transformer);
     }
     
@@ -64,14 +66,17 @@ public class TransformedBuffer<E> extend
      * will be transformed by this method.
      * Contrast this with {@link #transformingBuffer(Buffer, Transformer)}.
      * 
+     * @param <E> the type of the elements in the buffer
      * @param buffer  the buffer to decorate, must not be null
      * @param transformer  the transformer to use for conversion, must not be null
      * @return a new transformed Buffer
      * @throws IllegalArgumentException if buffer or transformer is null
      * @since Commons Collections 3.3
      */
-    public static <E> Buffer<E> transformedBuffer(Buffer<E> buffer, Transformer<?
super E, ? extends E> transformer) {
-        TransformedBuffer<E> decorated = new TransformedBuffer<E>(buffer, transformer);
// throws IAE if buffer or transformer is null
+    public static <E> TransformedBuffer<E> transformedBuffer(Buffer<E>
buffer,
+                                                             Transformer<? super E, ?
extends E> transformer) {
+        // throws IAE if buffer or transformer is null
+        final TransformedBuffer<E> decorated = new TransformedBuffer<E>(buffer,
transformer); 
         if (buffer.size() > 0) {
             @SuppressWarnings("unchecked") // buffer is type <E>
             E[] values = (E[]) buffer.toArray();
@@ -108,10 +113,17 @@ public class TransformedBuffer<E> extend
     }
 
     //-----------------------------------------------------------------------
+    
+    /**
+     * {@inheritDoc}
+     */
     public E get() {
         return getBuffer().get();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public E remove() {
         return getBuffer().remove();
     }

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/UnboundedFifoBuffer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/UnboundedFifoBuffer.java?rev=1353139&r1=1353138&r2=1353139&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/UnboundedFifoBuffer.java
(original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/UnboundedFifoBuffer.java
Sat Jun 23 15:05:20 2012
@@ -67,7 +67,7 @@ public class UnboundedFifoBuffer<E> exte
     // invariant: buffer.length > size()
     //   ie.buffer always has at least one empty entry
 
-    /** Serialization vesrion */
+    /** Serialization version */
     private static final long serialVersionUID = -3482960336579541419L;
 
     /** The array of objects in the buffer. */

Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/UnmodifiableBuffer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/UnmodifiableBuffer.java?rev=1353139&r1=1353138&r2=1353139&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/UnmodifiableBuffer.java
(original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/UnmodifiableBuffer.java
Sat Jun 23 15:05:20 2012
@@ -51,6 +51,7 @@ public final class UnmodifiableBuffer<E>
      * <p>
      * If the buffer passed in is already unmodifiable, it is returned.
      * 
+     * @param <E> the type of the elements in the buffer
      * @param buffer  the buffer to decorate, must not be null
      * @return an unmodifiable Buffer
      * @throws IllegalArgumentException if buffer is null



Mime
View raw message