@@ -12,15 +12,15 @@ module Collection
12
12
#
13
13
# The API is based on the `Queue` class from the Ruby standard library.
14
14
#
15
- # The pure Ruby implementation, `MutexPriorityQueue ` uses a heap algorithm
15
+ # The pure Ruby implementation, `RubyNonConcurrentPriorityQueue ` uses a heap algorithm
16
16
# stored in an array. The algorithm is based on the work of Robert Sedgewick
17
17
# and Kevin Wayne.
18
18
#
19
19
# The JRuby native implementation is a thin wrapper around the standard
20
- # library `java.util.PriorityQueue `.
20
+ # library `java.util.NonConcurrentPriorityQueue `.
21
21
#
22
- # When running under JRuby the class `PriorityQueue ` extends `JavaPriorityQueue `.
23
- # When running under all other interpreters it extends `MutexPriorityQueue `.
22
+ # When running under JRuby the class `NonConcurrentPriorityQueue ` extends `JavaNonConcurrentPriorityQueue `.
23
+ # When running under all other interpreters it extends `RubyNonConcurrentPriorityQueue `.
24
24
#
25
25
# @note This implementation is *not* thread safe.
26
26
#
@@ -30,11 +30,11 @@ module Collection
30
30
# @see http://algs4.cs.princeton.edu/24pq/index.php#2.6
31
31
# @see http://algs4.cs.princeton.edu/24pq/MaxPQ.java.html
32
32
#
33
- # @see http://docs.oracle.com/javase/7/docs/api/java/util/PriorityQueue .html
33
+ # @see http://docs.oracle.com/javase/7/docs/api/java/util/NonConcurrentPriorityQueue .html
34
34
#
35
35
# @!visibility private
36
36
# @!macro internal_implementation_note
37
- class MutexPriorityQueue
37
+ class RubyNonConcurrentPriorityQueue
38
38
39
39
# @!macro [attach] priority_queue_method_initialize
40
40
#
@@ -161,7 +161,7 @@ def push(item)
161
161
# @param [Enumerable] list the list to build the queue from
162
162
# @param [Hash] opts the options for creating the queue
163
163
#
164
- # @return [PriorityQueue ] the newly created and populated queue
164
+ # @return [NonConcurrentPriorityQueue ] the newly created and populated queue
165
165
def self . from_list ( list , opts = { } )
166
166
queue = new ( opts )
167
167
list . each { |item | queue << item }
@@ -229,7 +229,7 @@ def swim(k)
229
229
#
230
230
# @!visibility private
231
231
# @!macro internal_implementation_note
232
- class JavaPriorityQueue
232
+ class JavaNonConcurrentPriorityQueue
233
233
234
234
# @!macro priority_queue_method_initialize
235
235
def initialize ( opts = { } )
@@ -303,18 +303,18 @@ def self.from_list(list, opts = {})
303
303
304
304
# @!visibility private
305
305
# @!macro internal_implementation_note
306
- PriorityQueueImplementation = case
307
- when Concurrent . on_jruby?
308
- JavaPriorityQueue
309
- else
310
- MutexPriorityQueue
311
- end
312
- private_constant :PriorityQueueImplementation
306
+ NonConcurrentPriorityQueueImplementation = case
307
+ when Concurrent . on_jruby?
308
+ JavaNonConcurrentPriorityQueue
309
+ else
310
+ RubyNonConcurrentPriorityQueue
311
+ end
312
+ private_constant :NonConcurrentPriorityQueueImplementation
313
313
314
314
# @!macro priority_queue
315
315
#
316
316
# @!visibility private
317
- class PriorityQueue < PriorityQueueImplementation
317
+ class NonConcurrentPriorityQueue < NonConcurrentPriorityQueueImplementation
318
318
319
319
alias_method :has_priority? , :include?
320
320
0 commit comments