A new CommandPend class is introduced. It functions basically as
an ArrayBlockingQueue of size 1.
Difference is that it can handle two functions from two different threads
- trample(cmd): removes the previously kept command (if there is such) and overrides it with the next command
- offer(cmd): keeps the given command, but only if it doesn't currently keeps an older one
This new functionality is used so the UI can get commands from the controller
(but only take into account the latest one). At the same time it gets tick commands
from its clock ticker, but only keep and handle those if it doesn't have
a real controller command to handle.
rather than just 'data' attribute
2. Implemented a NetworkVirtualPrinter output device, and now both
this class and the previous SystemConsoleOutputDevice extend the same
new abstract class AsyncRunnableOutputDevice which supplies default
implementations for the interface methods.
Specifically:
1. now handling exceptions in the encryption process (according to voter's choice)
2. handling files in storage manager (now reading election parameters and system messages from files)
3. Controller's init() now already sets all the info and parameters. No need to call extra functions
4. some more changes to the method structure
Still missing components:
1. An implementation of the encryptor (currently program crashes when trying to encrypt the PlaintextBallot)
2. The output device implementation should change to a runnable thread (with commands queue as the ui)
Also needs to add comments EVERYWHERE.
Interfaces were now shortened even more.
Many changes were made according to Arbel's instructions.
Most important change is now that the controller passes ALL questions for UI
to ask voter, instead of chunks of questions and back-and-forth messages
between the controller and UI which were always quite redundant.
1. Especially tried to fix the callback mechanism I previously used.
2. 'long sessionID' changed to 'int requestId'
3. Introduced a generic class VotingBoothResult
4. Quite some other local changes
Summary:
Planned some basic interfaces for my revised Voting Booth componenets.
No implementation yet, though...
Test Plan: There are none, yet
Reviewers: arbel.peled
Differential Revision: https://proj-cs.idc.ac.il/D2