Refactor: some more comments, and better looking code in VotingBoothImpl.java

vbdev2
Hai Brenner 2016-07-12 15:32:22 +03:00
parent 0956fa98d3
commit 88991ea9ff
1 changed files with 9 additions and 5 deletions

View File

@ -20,11 +20,16 @@ import java.util.Map;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
/** /**
* Created by hai on 28/03/16. * An asynchronous implementation of the VotingBoothController.
* This implementation binds the other components (storage, ui, output device, and crypto manager),
* and runs as its own thread controlling the whole VB process.
* The high level details are that it has a queue of commands to handle in order, and a State object which keeps
* all data from previous tasks which is necessary for the next task.
* It calls executions in the UI and output device asynchronously.
*/ */
public class VotingBoothImpl implements VotingBoothController { public class VotingBoothImpl implements VotingBoothController {
private final Logger logger = LoggerFactory.getLogger(VotingBoothImpl.class);; private final Logger logger = LoggerFactory.getLogger(VotingBoothImpl.class);
// the component interfaces of the Voting Booth // the component interfaces of the Voting Booth
private BallotOutputDevice outputDevice; private BallotOutputDevice outputDevice;
@ -34,7 +39,6 @@ public class VotingBoothImpl implements VotingBoothController {
// election details and info // election details and info
private List<BallotQuestion> questionsForChoosingChannel; private List<BallotQuestion> questionsForChoosingChannel;
private List<BallotQuestion> questions;
private QuestionSelector questionSelector; private QuestionSelector questionSelector;
private Map<String, UIElement> systemMessages; private Map<String, UIElement> systemMessages;
@ -82,8 +86,8 @@ public class VotingBoothImpl implements VotingBoothController {
logger.info("init: setting the election parameters"); logger.info("init: setting the election parameters");
this.questionsForChoosingChannel = electionParams.getChannelChoiceQuestionsList(); this.questionsForChoosingChannel = electionParams.getChannelChoiceQuestionsList();
this.questions = electionParams.getRaceQuestionsList(); List<BallotQuestion> questions = electionParams.getRaceQuestionsList();
this.questionSelector = new SimpleListCategoriesSelector(this.questions, electionParams.getSelectionData()); this.questionSelector = new SimpleListCategoriesSelector(questions, electionParams.getSelectionData());
logger.info("init: setting finished"); logger.info("init: setting finished");
} }