--- projects/cms/source/util/uk/org/iscream/cms/util/Queue.java 2001/03/01 01:05:49 1.14 +++ projects/cms/source/util/uk/org/iscream/cms/util/Queue.java 2001/03/17 18:48:22 1.18 @@ -1,11 +1,11 @@ //---PACKAGE DECLARATION--- -package uk.ac.ukc.iscream.util; +package uk.org.iscream.util; //---IMPORTS--- import java.util.LinkedList; import java.util.NoSuchElementException; import java.util.Random; -import uk.ac.ukc.iscream.util.*; +import uk.org.iscream.util.*; /** * A Queue class designed to operate in a multi-threaded environment, with @@ -14,7 +14,7 @@ import uk.ac.ukc.iscream.util.*; * actually contains some elements. * * @author $Author: tdb $ - * @version $Id: Queue.java,v 1.14 2001/03/01 01:05:49 tdb Exp $ + * @version $Id: Queue.java,v 1.18 2001/03/17 18:48:22 tdb Exp $ */ public class Queue { @@ -23,7 +23,7 @@ public class Queue { /** * The current CVS revision of this class */ - public static final String REVISION = "$Revision: 1.14 $"; + public static final String REVISION = "$Revision: 1.18 $"; /** * Pass to constructor to remove a RANDOM item from @@ -49,6 +49,11 @@ public class Queue { */ public static final int DROP = 3; + /** + * To allow opposite lookups. + */ + public static final String[] algorithms = {"RANDOM", "FIRST", "LAST", "DROP"}; + //---STATIC METHODS--- //---CONSTRUCTORS--- @@ -131,8 +136,8 @@ public class Queue { throw new InvalidQueueException("Requested queue "+queue+" does not exist"); } // block if the queue is empty - if (((LinkedList) _lists.get(queue)).size() == 0) { - synchronized(((LinkedList) _lists.get(queue))) { + synchronized(((LinkedList) _lists.get(queue))) { + if (((LinkedList) _lists.get(queue)).size() == 0) { try { ((LinkedList) _lists.get(queue)).wait(); } catch(Exception e) {} } } @@ -201,7 +206,7 @@ public class Queue { if(_maxSize != -1) { status += " maxSize=\""+_maxSize+"\""; } - status += ""; + status += ">"; return status; } @@ -327,7 +332,7 @@ public class Queue { * Overrides the {@link java.lang.Object#toString() Object.toString()} * method to provide clean logging (every class should have this). * - * This uses the uk.ac.ukc.iscream.util.FormatName class + * This uses the uk.org.iscream.util.FormatName class * to format the toString() * * @return the name of this class and its CVS revision.