From f9f881e59c78e3036cb3f956bc97cfc3197f620d Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 24 Aug 2013 03:14:14 +0200 Subject: *Ringbuffer: Remove Ringbuffer.AllocEmptyArray interface to favor a more simple approach; Split 'grow' into 'growEmpty' and 'growFull' - java.lang.reflect.Array can instantiate an array w/ a given array-type and length - array-type is Class - We either deduct the array-type via array.getClass(), or pass it (ctor for empty Ringbuffer). - Split 'growBuffer(T[] newElements, int amount, ..)' into: - 'growEmptyBuffer(T[] newElements)' - 'growFullBuffer(int amount)' Allowing a more clean API w/ simpler semantics. --- src/junit/com/jogamp/common/util/TestSyncRingBuffer01.java | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src/junit/com/jogamp/common/util/TestSyncRingBuffer01.java') diff --git a/src/junit/com/jogamp/common/util/TestSyncRingBuffer01.java b/src/junit/com/jogamp/common/util/TestSyncRingBuffer01.java index bc9284b..b598f15 100644 --- a/src/junit/com/jogamp/common/util/TestSyncRingBuffer01.java +++ b/src/junit/com/jogamp/common/util/TestSyncRingBuffer01.java @@ -32,18 +32,11 @@ import com.jogamp.common.util.Ringbuffer; import com.jogamp.common.util.SyncedRingbuffer; public class TestSyncRingBuffer01 extends RingBuffer01Base { - - static final Ringbuffer.AllocEmptyArray allocEmptyIntArray = new Ringbuffer.AllocEmptyArray() { - @Override - public Integer[] newArray(int size) { - return new Integer[size]; - } }; - public Ringbuffer createEmpty(int initialCapacity) { - return new SyncedRingbuffer(initialCapacity, allocEmptyIntArray); + return new SyncedRingbuffer(Integer[].class, initialCapacity); } public Ringbuffer createFull(Integer[] source) { - return new SyncedRingbuffer(source, allocEmptyIntArray); + return new SyncedRingbuffer(source); } public static void main(String args[]) { -- cgit v1.2.3