pqueue 2.0.2 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Contributing.md +63 -0
- data/Gemfile.lock +24 -0
- data/{HISTORY.rdoc → History.md} +23 -6
- data/Index.yml +44 -0
- data/License.txt +23 -0
- data/README.md +71 -0
- data/lib/pqueue.rb +33 -9
- metadata +93 -42
- data/.ruby +0 -58
- data/COPYING.rdoc +0 -31
- data/README.rdoc +0 -57
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 58541f0cdd4e79a637522d1d78794428c6ea6510
|
|
4
|
+
data.tar.gz: 7834f9997de1480be4d11bef6c9e4ad08d547644
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 85926b70318b7a6b3b0a5f5fbcad2ee4ef667435db897151618bcf645c5bb219ad6a5b1503c6a2871abed96f44e951a0a275c1575bcea4c641ee5323c0a0672d
|
|
7
|
+
data.tar.gz: 4dfb6c6d2e0413f6c636e6d54a4cc56216994795cd6d2fe83d07b0f01527a2ec880a82927ec44ac0bfd01babc36e41ea3a2733d8e56bfc944f9a53e4fc31eb3e
|
data/Contributing.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# CONTRIBUTING
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
|
|
5
|
+
Once you've cloned the repo, hit up Bundler.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
$ bundle
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Testing
|
|
12
|
+
|
|
13
|
+
We are using the Microtest framework which is a very simple test
|
|
14
|
+
framework built to mimic the original Test::Unit but build on
|
|
15
|
+
Ruby Test, the slick meta-testing framework.
|
|
16
|
+
|
|
17
|
+
Thanks to the configuration in `etc/test.rb` running test should
|
|
18
|
+
be as simple as:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
$ rubytest
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Releasing
|
|
25
|
+
|
|
26
|
+
When releasing a new version there a few things that need to done.
|
|
27
|
+
First, of course, make sure the version number is correct by editing
|
|
28
|
+
the `Index.yml` file. Then update the canonical `.index` file via:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
$ index -u Index.yml Gemfile
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Also, don't forget to add an entry to the `HISTORY.md` file for the
|
|
35
|
+
new release.
|
|
36
|
+
|
|
37
|
+
Though it is not likely to be needed for this project, ensure the MANIFEST
|
|
38
|
+
is up to date:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
$ mast -u
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Now build the gem:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
$ gem build .gemspec
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
To release simply use:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
$ gem push pqueue-x.x.x.gem
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Finally, don't forget to add a tag for the release. I always use the
|
|
57
|
+
description of the release from the HISTORY file as the tag message
|
|
58
|
+
(excluding the changes list).
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
$ gem tag -a x.x.x
|
|
62
|
+
```
|
|
63
|
+
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
GEM
|
|
2
|
+
remote: https://rubygems.org/
|
|
3
|
+
specs:
|
|
4
|
+
ae (1.8.2)
|
|
5
|
+
ansi
|
|
6
|
+
ansi (1.4.3)
|
|
7
|
+
indexer (0.3.1)
|
|
8
|
+
microtest (0.2.1)
|
|
9
|
+
rubytest
|
|
10
|
+
rubytest (0.7.0)
|
|
11
|
+
ansi
|
|
12
|
+
rubytest-cli (0.1.0)
|
|
13
|
+
ansi
|
|
14
|
+
rubytest (>= 0.7.0)
|
|
15
|
+
|
|
16
|
+
PLATFORMS
|
|
17
|
+
ruby
|
|
18
|
+
|
|
19
|
+
DEPENDENCIES
|
|
20
|
+
ae
|
|
21
|
+
indexer
|
|
22
|
+
microtest
|
|
23
|
+
rubytest
|
|
24
|
+
rubytest-cli
|
data/{HISTORY.rdoc → History.md}
RENAMED
|
@@ -1,6 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
# CHANGE HISTORY
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## 2.1.0 / 2014-03-03
|
|
4
|
+
|
|
5
|
+
Ostatnicky has found a bug! As it turns out both `#deq` and `#shift` were
|
|
6
|
+
aliased incorrectly to `push`, when they should have been to `#pop`.
|
|
7
|
+
With this release that has been fixes, but we have modified `#shift`
|
|
8
|
+
to instead return the lowest priority item, which is a more polymorphic
|
|
9
|
+
definition with its use in Array. In addition we have added `#peek` as
|
|
10
|
+
an alias for `#top`, and added `bottom`, which it the opposite of `#top`.
|
|
11
|
+
|
|
12
|
+
Changes:
|
|
13
|
+
|
|
14
|
+
* Fix `#deq` as alias of `#pop`, not `#push`.
|
|
15
|
+
* Fix `#shift` to be like `#pop` but opposite priority.
|
|
16
|
+
* Add `#peek` as alias of `#top`.
|
|
17
|
+
* Add `#bottom` method as opposite of `#top`.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## 2.0.2 / 2011-10-29
|
|
4
21
|
|
|
5
22
|
It's been one of those days. I went to to get a wash cloth for the shower,
|
|
6
23
|
on my way through the kitchen realized the chilling cookie dough needed to
|
|
@@ -13,10 +30,10 @@ me food I don't want to eat. Yea, one of those days!
|
|
|
13
30
|
|
|
14
31
|
Changes:
|
|
15
32
|
|
|
16
|
-
* Fixed
|
|
33
|
+
* Fixed `#reheap` search algorithm.
|
|
17
34
|
|
|
18
35
|
|
|
19
|
-
|
|
36
|
+
## 2.0.1 / 2011-10-29
|
|
20
37
|
|
|
21
38
|
Quick fix to remove old legacy library that was supposed to be
|
|
22
39
|
removed in previous release. No big deal, it just confused the
|
|
@@ -27,7 +44,7 @@ Changes:
|
|
|
27
44
|
* Remove legacy version of library.
|
|
28
45
|
|
|
29
46
|
|
|
30
|
-
|
|
47
|
+
## 2.0.0 / 2011-10-29
|
|
31
48
|
|
|
32
49
|
This is a complete rewrite to simplify the design and use more
|
|
33
50
|
of Ruby's internal methods. Overall performance should be markedly
|
|
@@ -44,7 +61,7 @@ Changes:
|
|
|
44
61
|
* Switch to BSD-2-Clause license.
|
|
45
62
|
|
|
46
63
|
|
|
47
|
-
|
|
64
|
+
## 1.0.0 / 2009-07-05
|
|
48
65
|
|
|
49
66
|
This is the initial standalone release of PQueue, spun-off from the
|
|
50
67
|
Ruby Facets and originally written by K. Komada.
|
data/Index.yml
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name:
|
|
3
|
+
pqueue
|
|
4
|
+
|
|
5
|
+
version:
|
|
6
|
+
2.1.0
|
|
7
|
+
|
|
8
|
+
title:
|
|
9
|
+
PQueue
|
|
10
|
+
|
|
11
|
+
summary:
|
|
12
|
+
Queue of Prioritized Elements
|
|
13
|
+
|
|
14
|
+
description:
|
|
15
|
+
A priority queue is like a standard queue, except that each inserted elements
|
|
16
|
+
is given a certain priority, based on the result of the comparison block given
|
|
17
|
+
at instantiation time. Retrieving an element from the queue will always return
|
|
18
|
+
the one with the highest priority.
|
|
19
|
+
|
|
20
|
+
resources:
|
|
21
|
+
home: http://rubyworks.github.com/pqueue
|
|
22
|
+
code: http://github.com/rubyworks/pqueue
|
|
23
|
+
bugs: http://github.com/rubyworks/pqueue/issues
|
|
24
|
+
|
|
25
|
+
repositories:
|
|
26
|
+
upstream: git://github.com/rubyworks/pqueue.git
|
|
27
|
+
|
|
28
|
+
authors:
|
|
29
|
+
- Trans <transfire@gmail.com>
|
|
30
|
+
- K. Kodama
|
|
31
|
+
- Ronald Butler
|
|
32
|
+
- Olivier Renaud
|
|
33
|
+
- Rick Bradley
|
|
34
|
+
|
|
35
|
+
organization:
|
|
36
|
+
Rubyworks
|
|
37
|
+
|
|
38
|
+
created:
|
|
39
|
+
2001-03-10
|
|
40
|
+
|
|
41
|
+
copyrights:
|
|
42
|
+
- (c) 2009 Rubyworks (BSD-2)
|
|
43
|
+
- (c) 2001 K. Kodama
|
|
44
|
+
|
data/License.txt
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
(BSD-2-Clause License)
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without
|
|
4
|
+
modification, are permitted provided that the following conditions are met:
|
|
5
|
+
|
|
6
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
7
|
+
this list of conditions and the following disclaimer.
|
|
8
|
+
|
|
9
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
10
|
+
notice, this list of conditions and the following disclaimer in the
|
|
11
|
+
documentation and/or other materials provided with the distribution.
|
|
12
|
+
|
|
13
|
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
|
14
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
15
|
+
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
16
|
+
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
17
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
18
|
+
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
19
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
|
20
|
+
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
21
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
22
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
23
|
+
|
data/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# PQueue
|
|
2
|
+
|
|
3
|
+
[](http://badge.fury.io/rb/pqueue)
|
|
4
|
+
[](http://travis-ci.org/rubyworks/pqueue)
|
|
5
|
+
[](http://flattr.com/thing/324911/Rubyworks-Ruby-Development-Fund)
|
|
6
|
+
|
|
7
|
+
[Website](http://rubyworks.github.com/pqueue) ·
|
|
8
|
+
[YARD API](http://rubydoc.info/gems/pqueue) ·
|
|
9
|
+
[Report Issue](http://github.com/rubyworks/pqueue/issues) ·
|
|
10
|
+
[Source Code](http://github.com/rubyworks/pqueue)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## About
|
|
14
|
+
|
|
15
|
+
PQueue is a priority queue with array based heap.
|
|
16
|
+
A priority queue is like a standard queue, except that each inserted
|
|
17
|
+
element is given a certain priority, based on the result of the
|
|
18
|
+
comparison block given at instantiation time. Also, retrieving an element
|
|
19
|
+
from the queue will always return the one with the highest priority
|
|
20
|
+
(see #pop and #top).
|
|
21
|
+
|
|
22
|
+
The default is to compare the elements in respect to their #<=> method.
|
|
23
|
+
For example, Numeric elements with higher values will have higher
|
|
24
|
+
priorities.
|
|
25
|
+
|
|
26
|
+
This library is a rewrite of the original PQueue.rb by K. Kodama and
|
|
27
|
+
Heap.rb by Ronald Butler. The two libraries were later merged
|
|
28
|
+
and generally improved by Olivier Renaud. Then the whole library
|
|
29
|
+
rewritten by Trans using the original as a functional reference.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
Usage is simple enough. Think of it as an array that takes a block, where
|
|
35
|
+
the block decides which element of the array goes first.
|
|
36
|
+
|
|
37
|
+
require 'pqueue'
|
|
38
|
+
|
|
39
|
+
pq = PQueue.new([2,3,1]){ |a,b| a > b }
|
|
40
|
+
|
|
41
|
+
pq.pop #=> 3
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
## Install
|
|
45
|
+
|
|
46
|
+
Using RubyGems:
|
|
47
|
+
|
|
48
|
+
gem install pqueue
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## Acknowledgements
|
|
52
|
+
|
|
53
|
+
Although the library has been completely rewritten since, we still would
|
|
54
|
+
like to acknowledge the efforts of the original PQueue authors and
|
|
55
|
+
contributors.
|
|
56
|
+
|
|
57
|
+
* Olivier Renaud (2007)
|
|
58
|
+
* Rick Bradley (2003)
|
|
59
|
+
* Ronald Butler (2002)
|
|
60
|
+
* K Kodama (2001, original library)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
## License & Copyrights
|
|
64
|
+
|
|
65
|
+
Copyright (c) 2011 Rubyworks
|
|
66
|
+
|
|
67
|
+
PQueue is distributable in accordance with the *BSD-2-Clause* license.
|
|
68
|
+
|
|
69
|
+
PQueue is based on the original PQueue library (c) 2001 by K. Kodama.
|
|
70
|
+
|
|
71
|
+
See the LICENSE.txt file for details.
|
data/lib/pqueue.rb
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
class PQueue
|
|
19
19
|
|
|
20
20
|
#
|
|
21
|
-
VERSION = "2.
|
|
21
|
+
VERSION = "2.1.0" #:erb: VERSION = "<%= version %>"
|
|
22
22
|
|
|
23
23
|
#
|
|
24
24
|
# Returns a new priority queue.
|
|
@@ -78,17 +78,17 @@ class PQueue
|
|
|
78
78
|
end
|
|
79
79
|
|
|
80
80
|
#
|
|
81
|
-
#
|
|
81
|
+
# Traditional alias for #push.
|
|
82
82
|
#
|
|
83
|
-
alias
|
|
83
|
+
alias enq push
|
|
84
84
|
|
|
85
85
|
#
|
|
86
86
|
# Alias of #push.
|
|
87
87
|
#
|
|
88
|
-
alias
|
|
88
|
+
alias :<< :push
|
|
89
89
|
|
|
90
90
|
#
|
|
91
|
-
#
|
|
91
|
+
# Get the element with the highest priority and remove it from
|
|
92
92
|
# the queue.
|
|
93
93
|
#
|
|
94
94
|
# The highest priority is determined by the block given at instantiation
|
|
@@ -104,14 +104,24 @@ class PQueue
|
|
|
104
104
|
end
|
|
105
105
|
|
|
106
106
|
#
|
|
107
|
-
#
|
|
107
|
+
# Traditional alias for #pop.
|
|
108
108
|
#
|
|
109
|
-
alias
|
|
109
|
+
alias deq pop
|
|
110
110
|
|
|
111
|
+
# Get the element with the lowest priority and remove it from
|
|
112
|
+
# the queue.
|
|
113
|
+
#
|
|
114
|
+
# The lowest priority is determined by the block given at instantiation
|
|
115
|
+
# time.
|
|
111
116
|
#
|
|
112
|
-
#
|
|
117
|
+
# The deletion time is O(log n), with n is the size of the queue.
|
|
118
|
+
#
|
|
119
|
+
# Return nil if the queue is empty.
|
|
113
120
|
#
|
|
114
|
-
|
|
121
|
+
def shift
|
|
122
|
+
return nil if empty?
|
|
123
|
+
@que.shift
|
|
124
|
+
end
|
|
115
125
|
|
|
116
126
|
#
|
|
117
127
|
# Returns the element with the highest priority, but
|
|
@@ -122,6 +132,20 @@ class PQueue
|
|
|
122
132
|
return @que.last
|
|
123
133
|
end
|
|
124
134
|
|
|
135
|
+
#
|
|
136
|
+
# Traditional alias for #top.
|
|
137
|
+
#
|
|
138
|
+
alias peek top
|
|
139
|
+
|
|
140
|
+
#
|
|
141
|
+
# Returns the element with the lowest priority, but
|
|
142
|
+
# does not remove it from the queue.
|
|
143
|
+
#
|
|
144
|
+
def bottom
|
|
145
|
+
return nil if empty?
|
|
146
|
+
return @que.first
|
|
147
|
+
end
|
|
148
|
+
|
|
125
149
|
#
|
|
126
150
|
# Add more than one element at the same time. See #push.
|
|
127
151
|
#
|
metadata
CHANGED
|
@@ -1,98 +1,149 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pqueue
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 2.1.0
|
|
6
5
|
platform: ruby
|
|
7
6
|
authors:
|
|
7
|
+
- Trans
|
|
8
8
|
- K. Kodama
|
|
9
9
|
- Ronald Butler
|
|
10
10
|
- Olivier Renaud
|
|
11
11
|
- Rick Bradley
|
|
12
|
-
- Thomas Sawyer
|
|
13
12
|
autorequire:
|
|
14
13
|
bindir: bin
|
|
15
14
|
cert_chain: []
|
|
16
|
-
date:
|
|
15
|
+
date: 2015-03-03 00:00:00.000000000 Z
|
|
17
16
|
dependencies:
|
|
18
17
|
- !ruby/object:Gem::Dependency
|
|
19
|
-
name:
|
|
20
|
-
requirement:
|
|
21
|
-
none: false
|
|
18
|
+
name: microtest
|
|
19
|
+
requirement: !ruby/object:Gem::Requirement
|
|
22
20
|
requirements:
|
|
23
|
-
- -
|
|
21
|
+
- - '>='
|
|
24
22
|
- !ruby/object:Gem::Version
|
|
25
23
|
version: '0'
|
|
26
24
|
type: :development
|
|
27
25
|
prerelease: false
|
|
28
|
-
version_requirements:
|
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
27
|
+
requirements:
|
|
28
|
+
- - '>='
|
|
29
|
+
- !ruby/object:Gem::Version
|
|
30
|
+
version: '0'
|
|
29
31
|
- !ruby/object:Gem::Dependency
|
|
30
|
-
name:
|
|
31
|
-
requirement:
|
|
32
|
-
none: false
|
|
32
|
+
name: ae
|
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
|
33
34
|
requirements:
|
|
34
|
-
- -
|
|
35
|
+
- - '>='
|
|
35
36
|
- !ruby/object:Gem::Version
|
|
36
37
|
version: '0'
|
|
37
38
|
type: :development
|
|
38
39
|
prerelease: false
|
|
39
|
-
version_requirements:
|
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
+
requirements:
|
|
42
|
+
- - '>='
|
|
43
|
+
- !ruby/object:Gem::Version
|
|
44
|
+
version: '0'
|
|
40
45
|
- !ruby/object:Gem::Dependency
|
|
41
|
-
name:
|
|
42
|
-
requirement:
|
|
43
|
-
none: false
|
|
46
|
+
name: rubytest
|
|
47
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
48
|
requirements:
|
|
45
|
-
- -
|
|
49
|
+
- - '>='
|
|
46
50
|
- !ruby/object:Gem::Version
|
|
47
51
|
version: '0'
|
|
48
52
|
type: :development
|
|
49
53
|
prerelease: false
|
|
50
|
-
version_requirements:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
55
|
+
requirements:
|
|
56
|
+
- - '>='
|
|
57
|
+
- !ruby/object:Gem::Version
|
|
58
|
+
version: '0'
|
|
59
|
+
- !ruby/object:Gem::Dependency
|
|
60
|
+
name: rubytest-cli
|
|
61
|
+
requirement: !ruby/object:Gem::Requirement
|
|
62
|
+
requirements:
|
|
63
|
+
- - '>='
|
|
64
|
+
- !ruby/object:Gem::Version
|
|
65
|
+
version: '0'
|
|
66
|
+
type: :development
|
|
67
|
+
prerelease: false
|
|
68
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
69
|
+
requirements:
|
|
70
|
+
- - '>='
|
|
71
|
+
- !ruby/object:Gem::Version
|
|
72
|
+
version: '0'
|
|
73
|
+
- !ruby/object:Gem::Dependency
|
|
74
|
+
name: indexer
|
|
75
|
+
requirement: !ruby/object:Gem::Requirement
|
|
76
|
+
requirements:
|
|
77
|
+
- - '>='
|
|
78
|
+
- !ruby/object:Gem::Version
|
|
79
|
+
version: '0'
|
|
80
|
+
type: :development
|
|
81
|
+
prerelease: false
|
|
82
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
83
|
+
requirements:
|
|
84
|
+
- - '>='
|
|
85
|
+
- !ruby/object:Gem::Version
|
|
86
|
+
version: '0'
|
|
87
|
+
- !ruby/object:Gem::Dependency
|
|
88
|
+
name: mast
|
|
89
|
+
requirement: !ruby/object:Gem::Requirement
|
|
90
|
+
requirements:
|
|
91
|
+
- - '>='
|
|
92
|
+
- !ruby/object:Gem::Version
|
|
93
|
+
version: '0'
|
|
94
|
+
type: :development
|
|
95
|
+
prerelease: false
|
|
96
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
97
|
+
requirements:
|
|
98
|
+
- - '>='
|
|
99
|
+
- !ruby/object:Gem::Version
|
|
100
|
+
version: '0'
|
|
101
|
+
description: A priority queue is like a standard queue, except that each inserted
|
|
102
|
+
elements is given a certain priority, based on the result of the comparison block
|
|
103
|
+
given at instantiation time. Retrieving an element from the queue will always return
|
|
104
|
+
the one with the highest priority.
|
|
59
105
|
email:
|
|
60
106
|
- transfire@gmail.com
|
|
61
107
|
executables: []
|
|
62
108
|
extensions: []
|
|
63
109
|
extra_rdoc_files:
|
|
64
|
-
-
|
|
65
|
-
- README.
|
|
66
|
-
-
|
|
110
|
+
- License.txt
|
|
111
|
+
- README.md
|
|
112
|
+
- History.md
|
|
113
|
+
- Contributing.md
|
|
67
114
|
files:
|
|
68
|
-
- .ruby
|
|
69
115
|
- lib/pqueue.rb
|
|
70
116
|
- test/test_pqueue.rb
|
|
71
|
-
-
|
|
72
|
-
-
|
|
73
|
-
-
|
|
117
|
+
- License.txt
|
|
118
|
+
- Gemfile.lock
|
|
119
|
+
- Index.yml
|
|
120
|
+
- README.md
|
|
121
|
+
- History.md
|
|
122
|
+
- Contributing.md
|
|
74
123
|
homepage: http://rubyworks.github.com/pqueue
|
|
75
|
-
licenses:
|
|
124
|
+
licenses:
|
|
125
|
+
- BSD-2
|
|
126
|
+
metadata: {}
|
|
76
127
|
post_install_message:
|
|
77
128
|
rdoc_options: []
|
|
78
129
|
require_paths:
|
|
79
130
|
- lib
|
|
80
131
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
81
|
-
none: false
|
|
82
132
|
requirements:
|
|
83
|
-
- -
|
|
133
|
+
- - '>='
|
|
84
134
|
- !ruby/object:Gem::Version
|
|
85
135
|
version: '0'
|
|
86
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
|
-
none: false
|
|
88
137
|
requirements:
|
|
89
|
-
- -
|
|
138
|
+
- - '>='
|
|
90
139
|
- !ruby/object:Gem::Version
|
|
91
140
|
version: '0'
|
|
92
141
|
requirements: []
|
|
93
142
|
rubyforge_project:
|
|
94
|
-
rubygems_version:
|
|
143
|
+
rubygems_version: 2.0.3
|
|
95
144
|
signing_key:
|
|
96
|
-
specification_version:
|
|
145
|
+
specification_version: 4
|
|
97
146
|
summary: Queue of Prioritized Elements
|
|
98
|
-
test_files:
|
|
147
|
+
test_files:
|
|
148
|
+
- test/test_pqueue.rb
|
|
149
|
+
has_rdoc:
|
data/.ruby
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
source:
|
|
3
|
-
- meta
|
|
4
|
-
authors:
|
|
5
|
-
- name: K. Kodama
|
|
6
|
-
- name: Ronald Butler
|
|
7
|
-
- name: Olivier Renaud
|
|
8
|
-
- name: Rick Bradley
|
|
9
|
-
- name: Thomas Sawyer
|
|
10
|
-
email: transfire@gmail.com
|
|
11
|
-
copyrights:
|
|
12
|
-
- holder: K. Kodama
|
|
13
|
-
year: '2001'
|
|
14
|
-
replacements: []
|
|
15
|
-
alternatives: []
|
|
16
|
-
requirements:
|
|
17
|
-
- name: detroit
|
|
18
|
-
groups:
|
|
19
|
-
- build
|
|
20
|
-
development: true
|
|
21
|
-
- name: microtest
|
|
22
|
-
groups:
|
|
23
|
-
- test
|
|
24
|
-
development: true
|
|
25
|
-
- name: ae
|
|
26
|
-
groups:
|
|
27
|
-
- test
|
|
28
|
-
development: true
|
|
29
|
-
dependencies: []
|
|
30
|
-
conflicts: []
|
|
31
|
-
repositories:
|
|
32
|
-
- uri: git://github.com/rubyworks/pqueue.git
|
|
33
|
-
scm: git
|
|
34
|
-
name: upstream
|
|
35
|
-
resources:
|
|
36
|
-
home: http://rubyworks.github.com/pqueue
|
|
37
|
-
code: http://github.com/rubyworks/pqueue
|
|
38
|
-
mail: http://groups.google.com/group/rubyworks-mailinglist
|
|
39
|
-
bugs: http://github.com/rubyworks/pqueue/issues
|
|
40
|
-
extra: {}
|
|
41
|
-
load_path:
|
|
42
|
-
- lib
|
|
43
|
-
revision: 0
|
|
44
|
-
created: '2001-03-10'
|
|
45
|
-
summary: Queue of Prioritized Elements
|
|
46
|
-
title: PQueue
|
|
47
|
-
version: 2.0.2
|
|
48
|
-
name: pqueue
|
|
49
|
-
description: ! 'A priority queue is like a standard queue, except that each inserted
|
|
50
|
-
elements
|
|
51
|
-
|
|
52
|
-
is given a certain priority, based on the result of the comparison block given
|
|
53
|
-
|
|
54
|
-
at instantiation time. Retrieving an element from the queue will always return
|
|
55
|
-
|
|
56
|
-
the one with the highest priority.'
|
|
57
|
-
organization: rubyworks
|
|
58
|
-
date: '2011-10-29'
|
data/COPYING.rdoc
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
= COPYRIGHT NOTICES
|
|
2
|
-
|
|
3
|
-
== PQueue
|
|
4
|
-
|
|
5
|
-
Copyright:: (c) 2011 Rubyworks
|
|
6
|
-
License:: BSD-2-Clause
|
|
7
|
-
Website:: http://rubyworks.github.com/pqueue
|
|
8
|
-
|
|
9
|
-
Copyright 2011 Rubyworks. All rights reserved.
|
|
10
|
-
|
|
11
|
-
Redistribution and use in source and binary forms, with or without
|
|
12
|
-
modification, are permitted provided that the following conditions are met:
|
|
13
|
-
|
|
14
|
-
1. Redistributions of source code must retain the above copyright notice,
|
|
15
|
-
this list of conditions and the following disclaimer.
|
|
16
|
-
|
|
17
|
-
2. Redistributions in binary form must reproduce the above copyright
|
|
18
|
-
notice, this list of conditions and the following disclaimer in the
|
|
19
|
-
documentation and/or other materials provided with the distribution.
|
|
20
|
-
|
|
21
|
-
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
|
22
|
-
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
23
|
-
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
24
|
-
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
25
|
-
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
26
|
-
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
27
|
-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
|
28
|
-
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
29
|
-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
30
|
-
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
31
|
-
|
data/README.rdoc
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
= PQueue
|
|
2
|
-
|
|
3
|
-
{Home}[http://rubyworks.github.com/pqueue] |
|
|
4
|
-
{Code}[http://github.com/rubyworks/pqueue] |
|
|
5
|
-
{Docs}[http://rubydoc.info/gems/pqueue/frames] |
|
|
6
|
-
{Mail}[http://groups.google.com/group/rubyworks] | #rubyworks
|
|
7
|
-
|
|
8
|
-
{<img src="http://travis-ci.org/rubyworks/pqueue.png" />}[http://travis-ci.org/rubyworks/pqueue]
|
|
9
|
-
|
|
10
|
-
== DESCRIPTION
|
|
11
|
-
|
|
12
|
-
Priority queue with array based heap.
|
|
13
|
-
|
|
14
|
-
A priority queue is like a standard queue, except that each inserted
|
|
15
|
-
elements is given a certain priority, based on the result of the
|
|
16
|
-
comparison block given at instantiation time. Also, retrieving an element
|
|
17
|
-
from the queue will always return the one with the highest priority
|
|
18
|
-
(see #pop and #top).
|
|
19
|
-
|
|
20
|
-
The default is to compare the elements in respect to their #<=> method.
|
|
21
|
-
For example, Numeric elements with higher values will have higher
|
|
22
|
-
priorities.
|
|
23
|
-
|
|
24
|
-
This library is a rewrite of the original PQueue.rb by K. Kodama and
|
|
25
|
-
Heap.rb by Ronald Butler. The two libraries were later merged
|
|
26
|
-
and generally improved by Olivier Renaud. Then the whole library
|
|
27
|
-
rewritten by Trans using the original as a functional reference.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
== SYNOPSIS
|
|
31
|
-
|
|
32
|
-
require 'pqueue'
|
|
33
|
-
|
|
34
|
-
pq = PQueue.new([2,3,1]){ |a,b| a > b }
|
|
35
|
-
|
|
36
|
-
pq.pop #=> 3
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
== ACKNOWLEDGMENTS
|
|
40
|
-
|
|
41
|
-
Although the library has been completely rewritten since, we still would
|
|
42
|
-
like to acknowledge the efforts of the original PQueue authors and
|
|
43
|
-
contributors.
|
|
44
|
-
|
|
45
|
-
* Olivier Renaud (2007)
|
|
46
|
-
* Rick Bradley (2003)
|
|
47
|
-
* Ronald Butler (2002)
|
|
48
|
-
* K Kodama (2001, original library)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
== COPYRIGHTS
|
|
52
|
-
|
|
53
|
-
Copyright (c) 2011 Rubyworks
|
|
54
|
-
|
|
55
|
-
PQueue is distributable in accordance with the *FreeBSD* license.
|
|
56
|
-
|
|
57
|
-
See the COPYING.rdoc file for details.
|