SAFE Logo
CodeMatch Detailed Report
Version: 5.6.0 | Date: 06/18/12 | Time: 19:09:04

SCORE

SETTINGS
Compare file 1: C:\Users\Evan\Desktop\Java2SE5.0\src\java\util\concurrent\PriorityBlockingQueue.java
To file 2: C:\Users\Evan\Desktop\Android2.2Froyo\java\util\concurrent\PriorityBlockingQueue.java
Links to results: Matching Statements
Matching Comments and Strings
Matching Instruction Sequences
Matching Identifiers
Partially Matching Identifiers
Score
RESULTS
Matching Statements
File1 Line# File2 Line# Statement
87package java.util.concurrent
109import java.util.concurrent.locks.*
1110import java.util.*
3968public class PriorityBlockingQueue<E> extends AbstractQueue<E>
4069implements BlockingQueue<E>, java.io.Serializable {
4170private static final long serialVersionUID = 5595510919245408276L
4372private final PriorityQueue<E> q
4473private final ReentrantLock lock = new ReentrantLock(true)
4574private final Condition notEmpty = lock.newCondition()
5381public PriorityBlockingQueue() {
5482q = new PriorityQueue<E>()
6794public PriorityBlockingQueue(int initialCapacity) {
6895q = new PriorityQueue<E>(initialCapacity, null)
83110public PriorityBlockingQueue(int initialCapacity,
84111Comparator<? super E> comparator) {
85112q = new PriorityQueue<E>(initialCapacity, comparator)
107131public PriorityBlockingQueue(Collection<? extends E> c) {
108132q = new PriorityQueue<E>(c)
137275public Comparator<? super E> comparator() {
138276return q.comparator()
153
195
215
226
248
258
281
291
301
312
326
348
368
378
398
161
205
215
235
257
280
310
328
351
362
382
410
430
477
final ReentrantLock lock = this.lock
154
216
249
259
282
292
302
313
327
349
369
379
399
425
435
453
162
206
258
281
311
329
352
363
383
411
431
478
533
556
lock.lock()
157165assert ok
158
202
238
166
222
247
notEmpty.signal()
161
209
220
243
253
263
286
296
306
317
337
359
373
383
403
429
439
457
169
210
229
252
262
285
315
333
356
367
393
421
435
482
542
560
lock.unlock()
194214public E take() throws InterruptedException {
196
227
216
236
lock.lockInterruptibly()
199219while (q.size() == 0)
200220notEmpty.await()
201
237
221
246
} catch (InterruptedException ie) {
203
239
223
248
throw ie
205
230
225
239
E x = q.poll()
206226assert x != null
207
232
227
241
return x
214204public E poll() {
218208return q.poll()
224233public E poll(long timeout, TimeUnit unit) throws InterruptedException {
225234long nanos = unit.toNanos(timeout)
231240if (x != null)
233242if (nanos <= 0)
236245nanos = notEmpty.awaitNanos(nanos)
247256public E peek() {
251260return q.peek()
257279public int size() {
261283return q.size()
272294public int remainingCapacity() {
273295return Integer.MAX_VALUE
280309public boolean remove(Object o) {
284313return q.remove(o)
290327public boolean contains(Object o) {
294331return q.contains(o)
300350public Object[] toArray() {
304354return q.toArray()
311361public String toString() {
315365return q.toString()
321377public int drainTo(Collection<? super E> c) {
322
342
378
404
if (c == null)
323
343
379
405
throw new NullPointerException()
324
344
380
406
if (c == this)
325
345
381
407
throw new IllegalArgumentException()
329
351
385
413
int n = 0
330
352
386
414
E e
331387while ( (e = q.poll()) != null) {
332
354
388
416
c.add(e)
333
355
389
417
++n
335
357
391
419
return n
341403public int drainTo(Collection<? super E> c, int maxElements) {
346408if (maxElements <= 0)
347409return 0
353415while (n < maxElements && (e = q.poll()) != null) {
367429public void clear() {
371433q.clear()
377476public <T> T[] toArray(T[] a) {
381480return q.toArray(a)
397498public Iterator<E> iterator() {
413515public boolean hasNext() {
423519public E next() {
433526public void remove() {
451554private void writeObject(java.io.ObjectOutputStream s)
452555throws java.io.IOException {
455558s.defaultWriteObject()

to top

Matching Comments and Strings
File1 Line# File2 Line# Comment/String
1417* An unbounded {@linkplain BlockingQueue blocking queue} that uses
1518* the same ordering rules as class {@link PriorityQueue} and supplies
1619* blocking retrieval operations. While this queue is logically
1720* unbounded, attempted additions may fail due to resource exhaustion
1821* (causing <tt>OutOfMemoryError</tt>). This class does not permit
2327* <p>This class and its iterator implement all of the
2428* <em>optional</em> methods of the {@link Collection} and {@link
3564* @since 1.5
3665* @author Doug Lea
3766* @param <E> the type of elements held in this collection
58
72
99* Creates a <tt>PriorityBlockingQueue</tt> with the specified initial
64
80
91
107
* @throws IllegalArgumentException if <tt>initialCapacity</tt> is less
65
81
92
108
* than 1
89116* Creates a <tt>PriorityBlockingQueue</tt> containing the elements
99123* @param c the collection whose elements are to be placed
101125* @throws ClassCastException if elements of the specified collection
102126* cannot be compared to one another according to the priority
121
146
140
155
178
195
* @throws ClassCastException if the specified element cannot be compared
142136
151
* Inserts the specified element into this priority queue.
145
184
194* @return <tt>true</tt>
167
180
175
189
* unbounded this method will never block.
175
191
184
201
never need to block
179174
188
* Inserts the specified element into this priority queue. As the queue is
182192* @param timeout This parameter is ignored as the method never blocks
183193* @param unit This parameter is ignored as the method never blocks
202
238
222
247
propagate to non-interrupted thread
268290* Always returns <tt>Integer.MAX_VALUE</tt> because
269291* a <tt>PriorityBlockingQueue</tt> is not capacity constrained.
270292* @return <tt>Integer.MAX_VALUE</tt>
364426* Atomically removes all of the elements from this queue.
365427* The queue will be empty after this call returns.
388487* Returns an iterator over the elements in this queue. The
389488* iterator does not return the elements in any particular order.
446549* merely wraps default serialization within lock. The
447550* serialization strategy for items is left to underlying
448551* Queue. Note that locking is not needed on deserialization, so
449552* readObject is not defined, just relying on default.

to top

Matching Instruction Sequences
File1 Line# File2 Line# Number of matching instructions
8 7 21
153 161 17
194 214 16
207 313 11
207 331 11
207 354 11
208 251 10
208 434 10
218 227 29
242 314 17
242 332 17
242 355 10
242 434 10
247 204 11
247 309 15
252 251 19
252 434 11
257 279 86
272 200 13
280 327 22
280 350 15
285 251 10
285 434 10
290 204 11
290 309 22
295 251 10
295 434 10
300 204 11
300 309 15
305 251 10
305 434 10
326 410 12
348 382 12
372 251 10
372 314 16
372 332 16
372 355 10
377 204 11
377 309 14

to top

Matching Identifiers
5595510919245408276L AbstractQueue add assert await awaitNanos BlockingQueue clear
Collection Comparator concurrent Condition contains defaultWriteObject drainTo hasNext
ie IllegalArgumentException initialCapacity InterruptedException io IOException Iterator Itr
java lock lockInterruptibly locks MAX_VALUE maxElements nanos newCondition
next notEmpty NullPointerException Object ObjectOutputStream offer ok peek
poll PriorityBlockingQueue PriorityQueue put ReentrantLock remainingCapacity remove Serializable
serialVersionUID signal size take timeout TimeUnit toArray toNanos
toString unit unlock util writeObject

to top

Partially Matching Identifiers
*** NONE ***
to the top
SCORE 71

CodeSuite copyright 2003-2012 by Software Analysis and Forensic Engineering Corporation