projects
/
rubyvote
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added get_full_results method that returns a ranked list of candidates.
[rubyvote]
/
lib
/
rubyvote
/
condorcet.rb
diff --git
a/lib/rubyvote/condorcet.rb
b/lib/rubyvote/condorcet.rb
index b3bdcd6d71a253671b795a59c70f471d73c1ab15..5f103fb7f659f90e7fe0e01f9f049420afc77cbd 100644
(file)
--- a/
lib/rubyvote/condorcet.rb
+++ b/
lib/rubyvote/condorcet.rb
@@
-62,23
+62,33
@@
class CondorcetVote < ElectionVote
end
end
end
end
+ def result
+ top_result = resultFactory( self )
+ until @candidates.empty?
+ aResult = resultFactory( self )
+ top_result.full_results << aResult
+ filter_out(aResult)
+ end
+ top_result
+ end
+
protected
def verify_vote(vote=nil)
vote.instance_of?( Array ) and
vote == vote.uniq
end
protected
def verify_vote(vote=nil)
vote.instance_of?( Array ) and
vote == vote.uniq
end
-
+
end
class PureCondorcetVote < CondorcetVote
end
class PureCondorcetVote < CondorcetVote
- def result
- PureCondorcetResult.new(
self
)
+ def result
Factory(init)
+ PureCondorcetResult.new(
init
)
end
end
class CloneproofSSDVote < CondorcetVote
end
end
class CloneproofSSDVote < CondorcetVote
- def result
- CloneproofSSDResult.new(
self
)
+ def result
Factory(init)
+ CloneproofSSDResult.new(
init
)
end
end
end
end
Benjamin Mako Hill
||
Want to submit a patch?