Removed NonNull annotations

This commit is contained in:
Jim Martens
2023-08-01 15:51:51 +02:00
parent 792d8a1aa4
commit bb525b8815
@@ -2,7 +2,6 @@ package de.twomartens.wahlrecht.service
import de.twomartens.wahlrecht.model.internal.* import de.twomartens.wahlrecht.model.internal.*
import mu.KotlinLogging import mu.KotlinLogging
import org.springframework.lang.NonNull
import org.springframework.stereotype.Service import org.springframework.stereotype.Service
import org.springframework.util.StopWatch import org.springframework.util.StopWatch
import kotlin.math.roundToInt import kotlin.math.roundToInt
@@ -133,8 +132,8 @@ class CalculationService(
} }
private fun passesVotingThreshold( private fun passesVotingThreshold(
@NonNull election: Election, totalVotes: Int, election: Election, totalVotes: Int,
@NonNull votingResult: VotingResult votingResult: VotingResult
): Boolean { ): Boolean {
return (totalVotes * election.votingThreshold.multiplier return (totalVotes * election.votingThreshold.multiplier
<= votingResult.totalVotes) <= votingResult.totalVotes)
@@ -146,9 +145,8 @@ class CalculationService(
* @param assignedSeatsPerNomination Map of seats to allocate for a voting result * @param assignedSeatsPerNomination Map of seats to allocate for a voting result
* @param alreadyElectedCandidates Map of already elected candidates per party * @param alreadyElectedCandidates Map of already elected candidates per party
*/ */
@NonNull
private fun findElectedCandidates( private fun findElectedCandidates(
@NonNull assignedSeatsPerNomination: Map<VotingResult, Int>, assignedSeatsPerNomination: Map<VotingResult, Int>,
alreadyElectedCandidates: Map<String, Collection<ElectedCandidate>> alreadyElectedCandidates: Map<String, Collection<ElectedCandidate>>
): Map<VotingResult, Collection<ElectedCandidate>> { ): Map<VotingResult, Collection<ElectedCandidate>> {
val electedCandidates: MutableMap<VotingResult, Collection<ElectedCandidate>> = HashMap() val electedCandidates: MutableMap<VotingResult, Collection<ElectedCandidate>> = HashMap()
@@ -172,10 +170,9 @@ class CalculationService(
* @param numberOfSeats Number of seats to allocate * @param numberOfSeats Number of seats to allocate
* @param alreadyElectedCandidates Candidates already elected previously * @param alreadyElectedCandidates Candidates already elected previously
*/ */
@NonNull
private fun findCandidates( private fun findCandidates(
@NonNull votingResult: VotingResult, votingResult: VotingResult,
numberOfSeats: Int, @NonNull alreadyElectedCandidates: Collection<ElectedCandidate> numberOfSeats: Int, alreadyElectedCandidates: Collection<ElectedCandidate>
): Collection<ElectedCandidate> { ): Collection<ElectedCandidate> {
log.info( log.info(
"Find elected candidates on nomination: {}", "Find elected candidates on nomination: {}",