Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Vosburgh2015-07-21 20:25:52 +0000
committerBrian Vosburgh2015-07-21 20:25:52 +0000
commitd22060c7595ca84226f6c84970ebb4a5a031ea6b (patch)
tree49185574a8592a8515b397c06a1d329b9e198c91
parentf3527a8debc90335c4fdd0f426174b0e9bb57621 (diff)
downloadwebtools.dali-d22060c7595ca84226f6c84970ebb4a5a031ea6b.tar.gz
webtools.dali-d22060c7595ca84226f6c84970ebb4a5a031ea6b.tar.xz
webtools.dali-d22060c7595ca84226f6c84970ebb4a5a031ea6b.zip
clean up QueueTools etc.
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/collection/Queue.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/ArrayQueue.java21
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/EmptyQueue.java7
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/FixedSizeArrayQueue.java19
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/LinkedQueue.java30
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/ListQueue.java1
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/PriorityQueue.java13
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/QueueTools.java133
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/StackQueue.java3
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/SynchronizedQueue.java3
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/collection/ArrayQueueTests.java3
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/collection/FixedSizeArrayQueueTests.java3
12 files changed, 145 insertions, 95 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/collection/Queue.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/collection/Queue.java
index baafd861ed..53299251fe 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/collection/Queue.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/collection/Queue.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2013 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2015 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -22,6 +22,8 @@ package org.eclipse.jpt.common.utility.collection;
* @param <E> the type of elements contained by the queue
* @see org.eclipse.jpt.common.utility.internal.collection.ArrayQueue
* @see org.eclipse.jpt.common.utility.internal.collection.LinkedQueue
+ * @see org.eclipse.jpt.common.utility.internal.collection.QueueTools
+ * @see Stack Stack - for an interface without the semantic baggage of {@link java.util.Stack}
*/
public interface Queue<E> {
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/ArrayQueue.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/ArrayQueue.java
index 40f3930283..5b7b87ddcf 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/ArrayQueue.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/ArrayQueue.java
@@ -11,7 +11,6 @@ package org.eclipse.jpt.common.utility.internal.collection;
import java.io.Serializable;
import java.util.Arrays;
-import java.util.Collection;
import java.util.NoSuchElementException;
import org.eclipse.jpt.common.utility.collection.Queue;
@@ -19,6 +18,7 @@ import org.eclipse.jpt.common.utility.collection.Queue;
* Resizable-array FIFO implementation of the {@link Queue} interface.
* @param <E> the type of elements maintained by the queue
* @see FixedSizeArrayQueue
+ * @see QueueTools
*/
public class ArrayQueue<E>
implements Queue<E>, Cloneable, Serializable
@@ -57,25 +57,6 @@ public class ArrayQueue<E>
this.elements = (E[]) new Object[initialCapacity];
}
- /**
- * Construct a queue containing the elements of the specified
- * collection. The queue will dequeue its elements in the same
- * order they are returned by the collection's iterator (i.e. the
- * first element returned by the collection's iterator will be the
- * first element returned by {@link #dequeue()}).
- */
- @SuppressWarnings("unchecked")
- public ArrayQueue(Collection<? extends E> c) {
- super();
- int len = c.size();
- // add 10% for growth
- int capacity = (int) Math.min((len * 110L) / 100, Integer.MAX_VALUE);
- this.elements = (E[]) c.toArray(new Object[capacity]);
- this.head = 0;
- this.tail = len;
- this.size = len;
- }
-
// ********** Queue implementation **********
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/EmptyQueue.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/EmptyQueue.java
index e1872350f0..074e885f3e 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/EmptyQueue.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/EmptyQueue.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2013 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2015 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -13,6 +13,11 @@ import java.io.Serializable;
import java.util.NoSuchElementException;
import org.eclipse.jpt.common.utility.collection.Queue;
+/**
+ * Empty implementation of the {@link Queue} interface.
+ * @param <E> the type of elements maintained by the queue
+ * @see QueueTools
+ */
public final class EmptyQueue<E>
implements Queue<E>, Serializable
{
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/FixedSizeArrayQueue.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/FixedSizeArrayQueue.java
index 6914d675c0..1308adf523 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/FixedSizeArrayQueue.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/FixedSizeArrayQueue.java
@@ -11,7 +11,6 @@ package org.eclipse.jpt.common.utility.internal.collection;
import java.io.Serializable;
import java.util.Arrays;
-import java.util.Collection;
import java.util.NoSuchElementException;
import org.eclipse.jpt.common.utility.collection.Queue;
import org.eclipse.jpt.common.utility.internal.ObjectTools;
@@ -21,6 +20,7 @@ import org.eclipse.jpt.common.utility.internal.ObjectTools;
* This implementation will throw an exception if its capacity is exceeded.
* @param <E> the type of elements maintained by the queue
* @see ArrayQueue
+ * @see QueueTools
*/
public class FixedSizeArrayQueue<E>
implements Queue<E>, Cloneable, Serializable
@@ -52,23 +52,6 @@ public class FixedSizeArrayQueue<E>
this.elements = (E[]) new Object[capacity];
}
- /**
- * Construct a queue containing the elements of the specified
- * collection. The queue will dequeue its elements in the same
- * order they are returned by the collection's iterator (i.e. the
- * first element returned by the collection's iterator will be the
- * first element returned by {@link #dequeue()}).
- * The queue's capacity will be match the collection's size.
- */
- @SuppressWarnings("unchecked")
- public FixedSizeArrayQueue(Collection<? extends E> c) {
- super();
- int len = c.size();
- this.elements = (E[]) c.toArray(new Object[len]);
- this.size = len;
- // head and tail stay at zero
- }
-
// ********** Queue implementation **********
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/LinkedQueue.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/LinkedQueue.java
index d52d85d25f..a9468e24de 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/LinkedQueue.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/LinkedQueue.java
@@ -11,7 +11,6 @@ package org.eclipse.jpt.common.utility.internal.collection;
import java.io.Serializable;
import java.util.Arrays;
-import java.util.Collection;
import java.util.NoSuchElementException;
import org.eclipse.jpt.common.utility.collection.Queue;
import org.eclipse.jpt.common.utility.internal.ObjectTools;
@@ -19,6 +18,7 @@ import org.eclipse.jpt.common.utility.internal.ObjectTools;
/**
* Linked FIFO implementation of the {@link Queue} interface.
* @param <E> the type of elements maintained by the queue
+ * @see QueueTools
*/
public class LinkedQueue<E>
implements Queue<E>, Cloneable, Serializable
@@ -62,34 +62,6 @@ public class LinkedQueue<E>
this.tail = null;
}
- /**
- * Construct a queue containing the elements of the specified
- * collection and no node cache.
- * The queue will dequeue its elements in the same
- * order they are returned by the collection's iterator (i.e. the
- * first element returned by the collection's iterator will be the
- * first element returned by {@link #dequeue()}).
- */
- public LinkedQueue(Collection<? extends E> collection) {
- this(collection, 0);
- }
-
- /**
- * Construct a queue containing the elements of the specified
- * collection and a node cache with the specified size.
- * The queue will dequeue its elements in reverse of the
- * order they are returned by the collection's iterator (i.e. the
- * first element returned by the collection's iterator will be the
- * first element returned by {@link #dequeue()}).
- * Specify a cache size of -1 for an unlimited cache.
- */
- public LinkedQueue(Collection<? extends E> collection, int cacheSize) {
- this(cacheSize);
- for (E element : collection) {
- this.enqueue(element);
- }
- }
-
// ********** Queue implementation **********
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/ListQueue.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/ListQueue.java
index 909874090e..6a69812051 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/ListQueue.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/ListQueue.java
@@ -18,6 +18,7 @@ import org.eclipse.jpt.common.utility.collection.Queue;
* Adapt a {@link List} to the {@link Queue} interface.
* Elements are dequeued from the front of the list (i.e. index 0).
* @param <E> the type of elements maintained by the queue
+ * @see QueueTools
*/
public class ListQueue<E>
implements Queue<E>, Serializable
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/PriorityQueue.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/PriorityQueue.java
index fdc389dd2a..e928ab2434 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/PriorityQueue.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/PriorityQueue.java
@@ -10,9 +10,7 @@
package org.eclipse.jpt.common.utility.internal.collection;
import java.io.Serializable;
-import java.util.Comparator;
import java.util.SortedSet;
-import java.util.TreeSet;
import org.eclipse.jpt.common.utility.collection.Queue;
/**
@@ -21,6 +19,7 @@ import org.eclipse.jpt.common.utility.collection.Queue;
* wrapped sorted set (i.e. {@link #dequeue} will return the element returned
* by {@link SortedSet#first}.
* @param <E> the type of elements maintained by the queue
+ * @see QueueTools
*/
public class PriorityQueue<E>
implements Queue<E>, Serializable
@@ -30,16 +29,6 @@ public class PriorityQueue<E>
private static final long serialVersionUID = 1L;
- /**
- * Construct a priority queue that uses the specified comparator
- * to determine the order elements will be dequeued
- * (i.e. {@link #dequeue} will return the current element with
- * the lowest position, as specified by the comparator).
- */
- public PriorityQueue(Comparator<? super E> comparator) {
- this(new TreeSet<E>(comparator));
- }
-
public PriorityQueue(SortedSet<E> elements) {
super();
if (elements == null) {
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/QueueTools.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/QueueTools.java
index 8fd774a3f4..9de1eab2e3 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/QueueTools.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/QueueTools.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013 Oracle. All rights reserved.
+ * Copyright (c) 2013, 2015 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -13,6 +13,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
+import java.util.List;
import java.util.SortedSet;
import java.util.TreeSet;
import org.eclipse.jpt.common.utility.collection.Queue;
@@ -135,6 +136,20 @@ public final class QueueTools {
// ********** factory methods **********
/**
+ * Return an empty array-based FIFO queue.
+ */
+ public static <E> ArrayQueue<E> queue() {
+ return arrayQueue();
+ }
+
+ /**
+ * Return an empty array-based FIFO queue with specified initial capacity.
+ */
+ public static <E> ArrayQueue<E> queue(int initialCapacity) {
+ return arrayQueue(initialCapacity);
+ }
+
+ /**
* Return a FIFO queue corresponding to the specified iterable.
*/
public static <E> ArrayQueue<E> queue(Iterable<? extends E> iterable) {
@@ -172,6 +187,20 @@ public final class QueueTools {
}
/**
+ * Return an empty array-based FIFO queue.
+ */
+ public static <E> ArrayQueue<E> arrayQueue() {
+ return arrayQueue(10);
+ }
+
+ /**
+ * Return an empty array-based FIFO queue with specified initial capacity.
+ */
+ public static <E> ArrayQueue<E> arrayQueue(int initialCapacity) {
+ return new ArrayQueue<E>(initialCapacity);
+ }
+
+ /**
* Return an array-based FIFO queue corresponding to the specified iterable.
*/
public static <E> ArrayQueue<E> arrayQueue(Iterable<? extends E> iterable) {
@@ -190,7 +219,7 @@ public final class QueueTools {
* Return an array-based FIFO queue corresponding to the specified iterator.
*/
public static <E> ArrayQueue<E> arrayQueue(Iterator<? extends E> iterator) {
- return enqueueAll(new ArrayQueue<E>(), iterator);
+ return enqueueAll(QueueTools.<E>arrayQueue(), iterator);
}
/**
@@ -198,35 +227,97 @@ public final class QueueTools {
* The specified iterator size is a performance hint.
*/
public static <E> ArrayQueue<E> arrayQueue(Iterator<? extends E> iterator, int iteratorSize) {
- return enqueueAll(new ArrayQueue<E>(iteratorSize), iterator);
+ return enqueueAll(QueueTools.<E>arrayQueue(iteratorSize), iterator);
}
/**
* Return an array-based FIFO queue corresponding to the specified array.
*/
public static <E> ArrayQueue<E> arrayQueue(E... array) {
- return enqueueAll(new ArrayQueue<E>(array.length), array);
+ return enqueueAll(QueueTools.<E>arrayQueue(array.length), array);
+ }
+
+ /**
+ * Return an empty link-based FIFO queue with no node cache.
+ */
+ public static <E> LinkedQueue<E> linkedQueue() {
+ return linkedQueue(0);
+ }
+
+ /**
+ * Return an empty link-based FIFO queue
+ * with the specified node cache size.
+ * Specify a cache size of -1 for an unlimited cache.
+ */
+ public static <E> LinkedQueue<E> linkedQueue(int cacheSize) {
+ return new LinkedQueue<E>(cacheSize);
}
/**
- * Return an linked list-based FIFO queue corresponding to the specified iterable.
+ * Return a link-based FIFO queue corresponding to the specified iterable.
*/
public static <E> LinkedQueue<E> linkedQueue(Iterable<? extends E> iterable) {
- return linkedQueue(iterable.iterator());
+ return linkedQueue(iterable, 0);
+ }
+
+ /**
+ * Return a link-based FIFO queue corresponding to the specified iterable
+ * with the specified node cache size.
+ * Specify a cache size of -1 for an unlimited cache.
+ */
+ public static <E> LinkedQueue<E> linkedQueue(Iterable<? extends E> iterable, int cacheSize) {
+ return linkedQueue(iterable.iterator(), cacheSize);
}
/**
- * Return an linked list-based FIFO queue corresponding to the specified iterator.
+ * Return a link-based FIFO queue corresponding to the specified iterator.
*/
public static <E> LinkedQueue<E> linkedQueue(Iterator<? extends E> iterator) {
- return enqueueAll(new LinkedQueue<E>(), iterator);
+ return linkedQueue(iterator, 0);
}
/**
- * Return an linked list-based FIFO queue corresponding to the specified array.
+ * Return a link-based FIFO queue corresponding to the specified iterator
+ * with the specified node cache size.
+ * Specify a cache size of -1 for an unlimited cache.
+ */
+ public static <E> LinkedQueue<E> linkedQueue(Iterator<? extends E> iterator, int cacheSize) {
+ return enqueueAll(QueueTools.<E>linkedQueue(cacheSize), iterator);
+ }
+
+ /**
+ * Return a link-based FIFO queue corresponding to the specified array.
*/
public static <E> LinkedQueue<E> linkedQueue(E... array) {
- return enqueueAll(new LinkedQueue<E>(), array);
+ return linkedQueue(array, 0);
+ }
+
+ /**
+ * Return a link-based FIFO queue corresponding to the specified array
+ * with the specified node cache size.
+ * Specify a cache size of -1 for an unlimited cache.
+ */
+ public static <E> LinkedQueue<E> linkedQueue(E[] array, int cacheSize) {
+ return enqueueAll(QueueTools.<E>linkedQueue(cacheSize), array);
+ }
+
+ /**
+ * Return a fixed-size queue with the specified capacity.
+ */
+ public static <E> FixedSizeArrayQueue<E> fixedSizeQueue(int capacity) {
+ return new FixedSizeArrayQueue<E>(capacity);
+ }
+
+ /**
+ * Return a fized-size queue containing the elements of the specified
+ * collection. The queue will dequeue its elements in the same
+ * order they are returned by the collection's iterator (i.e. the
+ * first element returned by the collection's iterator will be the
+ * first element returned by {@link Queue#dequeue()}).
+ * The queue's capacity will be match the collection's size.
+ */
+ public static <E> FixedSizeArrayQueue<E> fixedSizeQueue(Collection<? extends E> collection) {
+ return enqueueAll(QueueTools.<E>fixedSizeQueue(collection.size()), collection);
}
/**
@@ -271,6 +362,28 @@ public final class QueueTools {
}
/**
+ * Adapt the specified list to the {@link Queue} interface.
+ */
+ public static <E> ListQueue<E> wrap(List<E> list) {
+ return new ListQueue<E>(list);
+ }
+
+ /**
+ * Return a queue that synchronizes the specified queue
+ * with specified mutex.
+ */
+ public static <E> SynchronizedQueue<E> synchronizedQueue(Queue<E> queue, Object mutex) {
+ return new SynchronizedQueue<E>(queue, mutex);
+ }
+
+ /**
+ * Return a queue that synchronizes the specified queue.
+ */
+ public static <E> SynchronizedQueue<E> synchronizedQueue(Queue<E> queue) {
+ return new SynchronizedQueue<E>(queue);
+ }
+
+ /**
* Return an unmodifiable empty queue.
*/
public static <E> Queue<E> emptyQueue() {
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/StackQueue.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/StackQueue.java
index ac9cda6daf..4239a829b3 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/StackQueue.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/StackQueue.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013 Oracle. All rights reserved.
+ * Copyright (c) 2013, 2015 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -17,6 +17,7 @@ import org.eclipse.jpt.common.utility.collection.Stack;
* Adapt a {@link Stack} to create a LIFO implementation of the {@link Queue}
* interface.
* @param <E> the type of elements maintained by the queue
+ * @see QueueTools
*/
public class StackQueue<E>
implements Queue<E>, Serializable
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/SynchronizedQueue.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/SynchronizedQueue.java
index 8bce8f8e67..769deb4ffa 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/SynchronizedQueue.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/collection/SynchronizedQueue.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2013 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2015 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -23,6 +23,7 @@ import org.eclipse.jpt.common.utility.command.Command;
* This also provides protocol for suspending a thread until the
* queue is empty or not empty, with optional time-outs.
* @param <E> the type of elements maintained by the queue
+ * @see QueueTools
*/
public class SynchronizedQueue<E>
implements Queue<E>, Serializable
diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/collection/ArrayQueueTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/collection/ArrayQueueTests.java
index 0a3eeb1893..a6066d594f 100644
--- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/collection/ArrayQueueTests.java
+++ b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/collection/ArrayQueueTests.java
@@ -12,6 +12,7 @@ package org.eclipse.jpt.common.utility.tests.internal.collection;
import java.util.ArrayList;
import org.eclipse.jpt.common.utility.collection.Queue;
import org.eclipse.jpt.common.utility.internal.collection.ArrayQueue;
+import org.eclipse.jpt.common.utility.internal.collection.QueueTools;
import org.eclipse.jpt.common.utility.tests.internal.TestTools;
@SuppressWarnings("nls")
@@ -39,7 +40,7 @@ public class ArrayQueueTests
c.add("eighth");
c.add("ninth");
c.add("tenth"); // force some free space
- Queue<String> queue = new ArrayQueue<String>(c);
+ Queue<String> queue = QueueTools.arrayQueue(c);
assertFalse(queue.isEmpty());
assertEquals("first", queue.peek());
diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/collection/FixedSizeArrayQueueTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/collection/FixedSizeArrayQueueTests.java
index d503c28833..e1f0bfa5dc 100644
--- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/collection/FixedSizeArrayQueueTests.java
+++ b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/collection/FixedSizeArrayQueueTests.java
@@ -12,6 +12,7 @@ package org.eclipse.jpt.common.utility.tests.internal.collection;
import java.util.ArrayList;
import org.eclipse.jpt.common.utility.collection.Queue;
import org.eclipse.jpt.common.utility.internal.collection.FixedSizeArrayQueue;
+import org.eclipse.jpt.common.utility.internal.collection.QueueTools;
@SuppressWarnings("nls")
public class FixedSizeArrayQueueTests
@@ -38,7 +39,7 @@ public class FixedSizeArrayQueueTests
c.add("eighth");
c.add("ninth");
c.add("tenth");
- Queue<String> queue = new FixedSizeArrayQueue<String>(c);
+ Queue<String> queue = QueueTools.fixedSizeQueue(c);
assertFalse(queue.isEmpty());
assertEquals("first", queue.peek());

Back to the top