Skip to content

Commit

Permalink
minor style improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
artoonie committed Jan 14, 2025
1 parent e2ec8be commit cd8fef5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/main/java/network/brightspots/rcv/BaseCvrReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void runAdditionalValidations(List<CastVoteRecord> castVoteRecords)
// Some CVRs have a list of candidates in the file. Read that list and return it.
// This will be used in tandem with gatherUnknownCandidateCounts, which only looks for candidates
// that have at least one vote.
public List<String> readCandidateListFromCvr(List<CastVoteRecord> castVoteRecords)
public List<String> readCandidateListFromCvr()
throws IOException {
return new ArrayList<>();
}
Expand Down Expand Up @@ -100,7 +100,7 @@ public Map<Candidate, Integer> gatherUnknownCandidateCounts(
// during auto-load candidates and just use readCandidateListFromCvr.
List<String> allCandidates = new ArrayList<>();
try {
allCandidates = readCandidateListFromCvr(castVoteRecords);
allCandidates = readCandidateListFromCvr();
} catch (IOException e) {
// If we can't read the candidate list, we can't check for unrecognized candidates.
Logger.warning("IOException reading candidate list from CVR: %s", e.getMessage());
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/network/brightspots/rcv/CsvCvrReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public String readerName() {
}

@Override
public List<String> readCandidateListFromCvr(List<CastVoteRecord> castVoteRecords)
public List<String> readCandidateListFromCvr()
throws IOException {
try (FileInputStream inputStream = new FileInputStream(Path.of(cvrPath).toFile())) {
return getCandidateNamesAndInitializeParser(getCsvParser(inputStream));
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/network/brightspots/rcv/TabulatorSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import network.brightspots.rcv.ContestConfig.UnrecognizedProviderException;
import network.brightspots.rcv.FileUtils.UnableToCreateDirectoryException;
import network.brightspots.rcv.OutputWriter.RoundSnapshotDataMissingException;
import network.brightspots.rcv.RawContestConfig.Candidate;
import network.brightspots.rcv.Tabulator.TabulationAbortedException;

@SuppressWarnings("RedundantSuppression")
Expand Down Expand Up @@ -357,7 +358,7 @@ private LoadedCvrData parseCastVoteRecords(
source, reader, sourceIndex, startIndex, castVoteRecords.size() - 1));

// Check for unrecognized candidates
Map<RawContestConfig.Candidate, Integer> unrecognizedCandidateCounts =
Map<Candidate, Integer> unrecognizedCandidateCounts =
reader.gatherUnknownCandidateCounts(castVoteRecords, false);

if (!unrecognizedCandidateCounts.isEmpty()) {
Expand Down Expand Up @@ -440,9 +441,9 @@ private LoadedCvrData parseCastVoteRecords(
static class UnrecognizedCandidatesException extends Exception {

// count of how many times each unrecognized candidate was encountered during CVR parsing
final Map<RawContestConfig.Candidate, Integer> candidateCounts;
final Map<Candidate, Integer> candidateCounts;

UnrecognizedCandidatesException(Map<RawContestConfig.Candidate, Integer> candidateCounts) {
UnrecognizedCandidatesException(Map<Candidate, Integer> candidateCounts) {
this.candidateCounts = candidateCounts;
}
}
Expand Down

0 comments on commit cd8fef5

Please sign in to comment.