From 791a2749886f02ec7b8db25bf8862e8269b96da5 Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Thu, 17 Oct 2013 21:06:56 -0700 Subject: gluegen: remove trailing whitespace Signed-off-by: Harvey Harrison --- .../com/jogamp/common/util/SyncedRingbuffer.java | 94 +++++++++++----------- 1 file changed, 47 insertions(+), 47 deletions(-) (limited to 'src/java/com/jogamp/common/util/SyncedRingbuffer.java') diff --git a/src/java/com/jogamp/common/util/SyncedRingbuffer.java b/src/java/com/jogamp/common/util/SyncedRingbuffer.java index 747629b..8ef2970 100644 --- a/src/java/com/jogamp/common/util/SyncedRingbuffer.java +++ b/src/java/com/jogamp/common/util/SyncedRingbuffer.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -31,7 +31,7 @@ package com.jogamp.common.util; import java.io.PrintStream; import java.lang.reflect.Array; -/** +/** * Simple synchronized implementation of {@link Ringbuffer}. *

* All methods utilize global synchronization. @@ -56,12 +56,12 @@ public class SyncedRingbuffer implements Ringbuffer { private int readPos; private int writePos; private int size; - + @Override public final String toString() { return "SyncedRingbuffer[filled "+size+" / "+capacity+", writePos "+writePos+", readPos "+readPos+"]"; } - + @Override public final void dump(PrintStream stream, String prefix) { stream.println(prefix+" "+toString()+" {"); @@ -70,10 +70,10 @@ public class SyncedRingbuffer implements Ringbuffer { } stream.println("}"); } - - /** + + /** * Create a full ring buffer instance w/ the given array's net capacity and content. - *

+ *

* Example for a 10 element Integer array: *

      *  Integer[] source = new Integer[10];
@@ -89,7 +89,7 @@ public class SyncedRingbuffer implements Ringbuffer {
      * and copy all elements from array copyFrom into the internal array.
      * 

* @param copyFrom mandatory source array determining ring buffer's net {@link #capacity()} and initial content. - * @throws IllegalArgumentException if copyFrom is null + * @throws IllegalArgumentException if copyFrom is null */ @SuppressWarnings("unchecked") public SyncedRingbuffer(T[] copyFrom) throws IllegalArgumentException { @@ -97,10 +97,10 @@ public class SyncedRingbuffer implements Ringbuffer { array = (T[]) newArray(copyFrom.getClass(), capacity); resetImpl(true, copyFrom); } - - /** + + /** * Create an empty ring buffer instance w/ the given net capacity. - *

+ *

* Example for a 10 element Integer array: *

      *  Ringbuffer rb = new SyncedRingbuffer(10, Integer[].class);
@@ -120,13 +120,13 @@ public class SyncedRingbuffer implements Ringbuffer {
         this.array = (T[]) newArray(arrayType, capacity);
         resetImpl(false, null /* empty, nothing to copy */ );
     }
-    
+
     @Override
     public final T[] getInternalArray() { return array; }
-    
+
     @Override
     public final int capacity() { return capacity; }
-    
+
     /**
      * {@inheritDoc}
      * 

@@ -142,12 +142,12 @@ public class SyncedRingbuffer implements Ringbuffer { } } } - + @Override public final void resetFull(T[] copyFrom) throws IllegalArgumentException { resetImpl(true, copyFrom); } - + private final void resetImpl(boolean full, T[] copyFrom) throws IllegalArgumentException { synchronized ( syncGlobal ) { if( null != copyFrom ) { @@ -163,14 +163,14 @@ public class SyncedRingbuffer implements Ringbuffer { size = full ? capacity : 0; } } - + @Override public final int size() { synchronized ( syncGlobal ) { return size; } } - + @Override public final int getFreeSlots() { synchronized ( syncGlobal ) { @@ -184,14 +184,14 @@ public class SyncedRingbuffer implements Ringbuffer { return 0 == size; } } - + @Override public final boolean isFull() { synchronized ( syncGlobal ) { return capacity == size; } } - + /** * {@inheritDoc} *

@@ -215,7 +215,7 @@ public class SyncedRingbuffer implements Ringbuffer { public final T getBlocking() throws InterruptedException { return getImpl(true, false); } - + @Override public final T peek() { try { @@ -226,9 +226,9 @@ public class SyncedRingbuffer implements Ringbuffer { public final T peekBlocking() throws InterruptedException { return getImpl(true, true); } - + private final T getImpl(boolean blocking, boolean peek) throws InterruptedException { - synchronized( syncGlobal ) { + synchronized( syncGlobal ) { if( 0 == size ) { if( blocking ) { while( 0 == size ) { @@ -249,8 +249,8 @@ public class SyncedRingbuffer implements Ringbuffer { return r; } } - - /** + + /** * {@inheritDoc} *

* Implementation stores the element at the current write position and advances it, if not full. @@ -262,8 +262,8 @@ public class SyncedRingbuffer implements Ringbuffer { return putImpl(e, false, false); } catch (InterruptedException ie) { throw new RuntimeException(ie); } } - - /** + + /** * {@inheritDoc} *

* Implementation stores the element at the current write position and advances it, if not full. @@ -275,8 +275,8 @@ public class SyncedRingbuffer implements Ringbuffer { throw new InternalError("Blocking put failed: "+this); } } - - /** + + /** * {@inheritDoc} *

* Implementation keeps the element at the current write position and advances it, if not full. @@ -286,9 +286,9 @@ public class SyncedRingbuffer implements Ringbuffer { public final boolean putSame(boolean blocking) throws InterruptedException { return putImpl(null, true, blocking); } - + private final boolean putImpl(T e, boolean sameRef, boolean blocking) throws InterruptedException { - synchronized( syncGlobal ) { + synchronized( syncGlobal ) { if( capacity == size ) { if( blocking ) { while( capacity == size ) { @@ -308,7 +308,7 @@ public class SyncedRingbuffer implements Ringbuffer { return true; } } - + @Override public final void waitForFreeSlots(int count) throws InterruptedException { synchronized ( syncGlobal ) { @@ -319,8 +319,8 @@ public class SyncedRingbuffer implements Ringbuffer { } } } - - + + @Override public final void growEmptyBuffer(final T[] newElements) throws IllegalStateException, IllegalArgumentException { synchronized ( syncGlobal ) { @@ -340,15 +340,15 @@ public class SyncedRingbuffer implements Ringbuffer { if( readPos != writePos ) { throw new InternalError("R/W pos not equal: "+this); } - + final int growAmount = newElements.length; final int newCapacity = capacity + growAmount; final T[] oldArray = array; final T[] newArray = (T[]) newArray(arrayTypeInternal, newCapacity); - + // writePos == readPos writePos += growAmount; // warp writePos to the end of the new data location - + if( readPos > 0 ) { System.arraycopy(oldArray, 0, newArray, 0, readPos); } @@ -360,12 +360,12 @@ public class SyncedRingbuffer implements Ringbuffer { System.arraycopy(oldArray, readPos, newArray, writePos, tail); } size = growAmount; - + capacity = newCapacity; array = newArray; } } - + @Override public final void growFullBuffer(final int growAmount) throws IllegalStateException, IllegalArgumentException { synchronized ( syncGlobal ) { @@ -374,7 +374,7 @@ public class SyncedRingbuffer implements Ringbuffer { } if( capacity != size ) { throw new IllegalStateException("Buffer is not full: "+this); - } + } if( readPos != writePos ) { throw new InternalError("R/W pos not equal: "+this); } @@ -384,10 +384,10 @@ public class SyncedRingbuffer implements Ringbuffer { final int newCapacity = capacity + growAmount; final T[] oldArray = array; final T[] newArray = (T[]) newArray(arrayTypeInternal, newCapacity); - + // writePos == readPos readPos += growAmount; // warp readPos to the end of the new data location - + if(writePos > 0) { System.arraycopy(oldArray, 0, newArray, 0, writePos); } @@ -395,12 +395,12 @@ public class SyncedRingbuffer implements Ringbuffer { if( tail > 0 ) { System.arraycopy(oldArray, writePos, newArray, readPos, tail); } - + capacity = newCapacity; array = newArray; } } - + @SuppressWarnings("unchecked") private static T[] newArray(Class arrayType, int length) { return ((Object)arrayType == (Object)Object[].class) -- cgit v1.2.3