Created
March 31, 2015 16:25
-
-
Save dat-vikash/d887af0fef06df61ceef to your computer and use it in GitHub Desktop.
SIM Distribution: fitSenatorsBasedOnRarity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[1] def fitSenatorsBasedOnRarity(committeesWithIssueConfs: Map[Committee, mutable.Queue[String]], senators: Set[Senator], party: String) = | |
{ | |
[2] var takenSenators: mutable.Set[Senator] = senators.to[mutable.Set] | |
[3] committeesWithIssueConfs.foreach(committee => | |
committee._2.foreach(issue => { | |
// get a senator from each faction | |
[4] val tmpSenatorDem = takenSenators.find(s => s.faction.name.equalsIgnoreCase(party) && doesMatchPositionRule(issue, s)) | |
[5] tmpSenatorDem match { | |
case None => // do nothing | |
case Some(senator) => { | |
[6] addSenatorToCommitteeForIssueConference(senator,committee._1,issue) | |
[7] takenSenators = takenSenators - senator | |
} | |
} | |
}) | |
) | |
[8] takenSenators | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment