ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/util/uk/org/iscream/cms/util/Queue.java
(Generate patch)

Comparing projects/cms/source/util/uk/org/iscream/cms/util/Queue.java (file contents):
Revision 1.3 by tdb, Thu Jan 18 01:55:36 2001 UTC vs.
Revision 1.4 by tdb, Thu Jan 18 19:13:57 2001 UTC

# Line 116 | Line 116 | public class Queue {
116      }
117      
118      /**
119 +     * Returns the size of a given queue. A consumer can use
120 +     * this to see how big their queue is at any given time.
121 +     * they should use their queue number as the parameter.
122 +     *
123 +     * @param queue The queue number to query.
124 +     * @return the current size of the queue.
125 +     */
126 +    public int queueSize(int queue) throws InvalidQueueException {
127 +        if (queue >= _lists.size() || _lists.get(queue) == null) {
128 +            throw new InvalidQueueException("Requested queue "+queue+" does not exist");
129 +        }
130 +        return ((LinkedList) _lists.get(queue)).size();
131 +    }
132 +    
133 +    /**
134 +     * Returns the total numer of elements to have passed
135 +     * through this queue (ie. a counter on the add method).
136 +     *
137 +     * @return the element-ometer
138 +     */
139 +    public int elementCount() {
140 +        return _count;
141 +    }
142 +    
143 +    /**
144       * This method assigns a queue to a consumer. The idea behind
145       * this is to ensure that only 1 consumer can be associated with
146       * a given queue, otherwise the whole "blocking" thing fails

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines