Skip to content
Johan Lindskogen edited this page Dec 2, 2015 · 1 revision

VoteSessionFactory

Methods

  • createVoteSession(candidateNames, vacantEnabled, maxCandidates)

VoteManager

Methods

  • constructor(candidates, vacantCandidates, maximumNbrOfVotes)
  • closeVotingSession()
  • createEmptyVoteResults(candidates, vacantCandidates)
  • castVote(vote)
  • validateVote(vote)
  • isValidAmountOfVotes(vote)
  • allVotesUnique(vote)
  • checkIfAllCandidatesInVoteAreValid(vote)
  • isVacantVotesInIncreasingIndex(vote, voteCount)
  • increaseVoteForCandidate(candidateIndex)

VoteCounter

Methods

  • countVotes(votesCount, maximumNbrOfVotes)
  • groupByVoteValue(votesCount)
  • concatWithCandidates(candidates, spots)
  • pickWinnersWhenSameVoteCount(candidates, spots)
  • moveFromArrayUntilLength(fromArray, toArray, length)
  • isVacant(item)

CodeManager

Methods

  • nextSession()
  • generateCodes(nbrOfUsers, nbrOfCodesPerUser, lengthOfCodes)
  • currentSessionCodes()
  • isValidCode(code)
  • invalidateCode(code)