Question: Part 1 : Concurrency ( 5 0 % ) 1 . Make Event implements Runnable so that each type of event provides its own timing.
Part : Concurrency Make Event implements Runnable so that each type of event provides its own timing. Each event file should be a class of its own. Change the rest of the design to simplify this model. Provide the means to create the event classes from their names see the Constructor class in java.lang.reflect and getConstructor in the Class Class Use the same capability to be able to add new Event classes and modify Event classes without recompiling GreenhouseControls.java remove all the classes as inner classes and make them public classes in their own file Start the Event thread right after you have successfully created the Event object. Make whatever changes are required to the overall design. Events should be started once they are created. Devise a mechanism for GreenhouseControls to suspend and resume the Event threads. To do this GreenhouseControls needs to keep a collection of threads of all events. Remove all existing states variables in GreenhouseControls and replace them by using a collection of TwoTuple See examples in TIJ pages to Each time an event runs it should add an entry that identifies the variable the event is modifying as key, and another object to this structure as the value the event is setting. Create a method in GreenhouseControls called setVariable to handle updating to this collection. Use the synchronization feature in java to ensure that two Event classes are not trying to add to the structure at the same time. Again make whatever changes are required to the overall design. Provide adequate methods to access the state variables. Design and implement a mechanism for each event to output the description to a GUI interface see Part Part : GUI This part aims to develop a Graphical User Interface used to control a GreenhouseControls object. You are free to design the layout of the interface. In case you are not sure you may develop the interface that looks like this, this or this. The minimum number of components and their functionalities of the GUI are: Each window of the GUI must have a scrollable text area, a set of buttons, a pulldown menu and a popup menu. The pulldown menu consists of the following sub menus: New window creates a new GUI window. The new GUI window should associate with another GreenhouseControls object. Close window closes the current window. If the GreenhouseControls object is running, a warning message should be displayed to ask the user to confirm closing of the window. If the current window is the only window opened, exit the application. Open Events opens an events file. It should bring up a file dialog and let the user chooses an event file. If the chosen file is not a valid event file, display an appropriate error message. Restore opens a dump.out file and restore the GreenhouseControls object. It should bring up a file dialog and let the user choose a dump.out file. If the chosen file is not a valid dump.out file, display an appropriate error message. This option should be disabled if the GreenhouseControls is running. Exit exit the application. If any of the opened GUIs is running a GreenhouseControls object, display a warning message to ask the user to confirm the exit. Associate a keyboard shortcut with each of the above menu items. The buttons: Start start to run a GreenhouseControls object. This button should be disabled if the GreenhouseControls object is running. Restart add a Restart object to rerun the current event file. This button should be disabled if no events file is read, or if the GreenhouseControls object is running.
Terminate add a Terminate event to the running GreenhouseControls object. It should bring up a dialog to prompt for the delay time in milliseconds. This button should be disabled if the GreenhouseControls object is not running.
Suspend suspends all running event threads. This button should be disabled if the GreenhouseControls object is not running.
Resume resume all suspended event threads. This button should be disabled if the GreenhouseControls object is running.
The popup menu should contain the following submenus: Start, Restart, Terminate, Suspend, and Resume, with the same functionalities as the buttons.
In addition to the above components, you are free to add as many components as necessary to make the GUI look nice.
###Please give the complete code solution for this PART and PART both
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
