HW1: mandatory part done
This commit is contained in:
parent
a483b4b08b
commit
9a0c17edb7
15 changed files with 920 additions and 87 deletions
|
@ -2,11 +2,17 @@
|
|||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="d712734b-6034-468c-b553-7e4d8f6128c3" name="Default Changelist" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/.idea/Ex1.iml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../../IE1/.idea/compiler.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../../IE1/.idea/libraries/Maven__junit_junit_4_12.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../../IE1/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../../IE1/.idea/misc.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../../IE1/.idea/modules.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../../IE1/.idea/vcs.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../../IE1/IE1.iml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../../IE1/pom.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../../IE1/src/semaphore/MyBulkSemaphore.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../../IE1/src/semaphore/MySemaphore.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
</list>
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
|
@ -19,7 +25,7 @@
|
|||
<option name="delegatedBuild" value="true" />
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf>
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/sequential/SequentialSum.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
|
@ -32,9 +38,10 @@
|
|||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/synchronized1/MultipleUpdatesPerThreadSynch.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="317">
|
||||
<state relative-caret-position="420">
|
||||
<caret line="28" column="9" selection-start-line="19" selection-start-column="8" selection-end-line="28" selection-end-column="9" />
|
||||
<folding>
|
||||
<element signature="e#277#278#0" expanded="true" />
|
||||
<element signature="e#301#302#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
|
@ -44,17 +51,17 @@
|
|||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/simple1/MultipleUpdatesPerThread.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="75">
|
||||
<state relative-caret-position="195">
|
||||
<caret line="13" column="18" selection-start-line="13" selection-start-column="18" selection-end-line="13" selection-end-column="18" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/atomic1/MultipleUpdatesPerThreadAtomic.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="450">
|
||||
<caret line="31" lean-forward="true" selection-start-line="31" selection-end-line="31" />
|
||||
<caret line="31" selection-start-line="31" selection-end-line="31" />
|
||||
<folding>
|
||||
<element signature="e#312#313#0" expanded="true" />
|
||||
<element signature="e#344#345#0" expanded="true" />
|
||||
|
@ -66,8 +73,8 @@
|
|||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/test/Test.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="175">
|
||||
<caret line="61" column="8" lean-forward="true" selection-start-line="61" selection-start-column="8" selection-end-line="61" selection-end-column="8" />
|
||||
<state relative-caret-position="528">
|
||||
<caret line="63" column="22" selection-start-line="63" selection-start-column="22" selection-end-line="63" selection-end-column="22" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
@ -75,8 +82,8 @@
|
|||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/parallel/CollectingResults.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="30">
|
||||
<caret line="2" column="17" lean-forward="true" selection-start-line="2" selection-start-column="17" selection-end-line="2" selection-end-column="17" />
|
||||
<state relative-caret-position="75">
|
||||
<caret line="5" column="13" selection-start-line="5" selection-start-column="13" selection-end-line="5" selection-end-column="13" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
@ -99,15 +106,11 @@
|
|||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/atomic2/SingleUpdatePerThreadAtomic.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="175">
|
||||
<caret line="29" column="8" selection-start-line="29" selection-start-column="8" selection-end-line="29" selection-end-column="8" />
|
||||
<folding>
|
||||
<element signature="e#300#301#0" expanded="true" />
|
||||
<element signature="e#324#325#0" expanded="true" />
|
||||
</folding>
|
||||
<state relative-caret-position="360">
|
||||
<caret line="27" column="18" lean-forward="true" selection-start-line="27" selection-start-column="18" selection-end-line="27" selection-end-column="18" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
@ -140,8 +143,6 @@
|
|||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="PackagesPane" />
|
||||
<pane id="Scope" />
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
|
@ -212,6 +213,8 @@
|
|||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="Scope" />
|
||||
<pane id="PackagesPane" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
|
@ -268,29 +271,25 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1570613444806</updated>
|
||||
<workItem from="1570613448664" duration="3062000" />
|
||||
<workItem from="1571121333128" duration="19000" />
|
||||
<workItem from="1571164782533" duration="707000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TimeTrackingManager">
|
||||
<option name="totallyTimeSpent" value="3062000" />
|
||||
<option name="totallyTimeSpent" value="3788000" />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="0" y="0" width="1059" height="1050" extended-state="0" />
|
||||
<frame x="0" y="0" width="1680" height="1050" extended-state="0" />
|
||||
<layout>
|
||||
<window_info id="Designer" />
|
||||
<window_info id="Image Layers" />
|
||||
<window_info id="Capture Tool" />
|
||||
<window_info id="UI Designer" />
|
||||
<window_info id="Favorites" side_tool="true" />
|
||||
<window_info id="Learn" />
|
||||
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.23500492" />
|
||||
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.23992674" />
|
||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Terminal" />
|
||||
<window_info anchor="bottom" id="Docker" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" id="Event Log" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Database Changes" />
|
||||
<window_info anchor="bottom" id="Version Control" />
|
||||
<window_info anchor="bottom" id="Messages" />
|
||||
<window_info id="Designer" order="2" />
|
||||
<window_info id="Image Layers" order="3" />
|
||||
<window_info id="Capture Tool" order="4" />
|
||||
<window_info id="UI Designer" order="5" />
|
||||
<window_info id="Favorites" order="6" side_tool="true" />
|
||||
<window_info id="Learn" order="7" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Find" order="1" />
|
||||
<window_info anchor="bottom" id="Run" order="2" weight="0.32959184" />
|
||||
|
@ -298,15 +297,21 @@
|
|||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||
<window_info anchor="bottom" id="TODO" order="6" />
|
||||
<window_info anchor="right" id="Maven" />
|
||||
<window_info anchor="right" id="Palette" />
|
||||
<window_info anchor="right" id="Capture Analysis" />
|
||||
<window_info anchor="right" id="Database" />
|
||||
<window_info anchor="right" id="Palette	" />
|
||||
<window_info anchor="right" id="Theme Preview" />
|
||||
<window_info anchor="bottom" id="Terminal" order="7" />
|
||||
<window_info anchor="bottom" id="Docker" order="8" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" id="Event Log" order="9" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Messages" order="10" />
|
||||
<window_info anchor="bottom" id="Database Changes" order="11" />
|
||||
<window_info anchor="bottom" id="Version Control" order="12" />
|
||||
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||
<window_info anchor="right" id="Maven" order="3" />
|
||||
<window_info anchor="right" id="Palette" order="4" />
|
||||
<window_info anchor="right" id="Capture Analysis" order="5" />
|
||||
<window_info anchor="right" id="Database" order="6" />
|
||||
<window_info anchor="right" id="Palette	" order="7" />
|
||||
<window_info anchor="right" id="Theme Preview" order="8" />
|
||||
</layout>
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
|
@ -320,6 +325,24 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/synchronized1/MultipleUpdatesPerThreadSynch.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="420">
|
||||
<caret line="28" column="9" selection-start-line="19" selection-start-column="8" selection-end-line="28" selection-end-column="9" />
|
||||
<folding>
|
||||
<element signature="e#277#278#0" expanded="true" />
|
||||
<element signature="e#301#302#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/simple1/MultipleUpdatesPerThread.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="195">
|
||||
<caret line="13" column="18" selection-start-line="13" selection-start-column="18" selection-end-line="13" selection-end-column="18" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/simple2/SingleUpdatePerThread.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="285">
|
||||
|
@ -334,52 +357,24 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/simple1/MultipleUpdatesPerThread.java">
|
||||
<entry file="file://$PROJECT_DIR$/src/test/Test.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="75">
|
||||
<caret line="13" column="18" selection-start-line="13" selection-start-column="18" selection-end-line="13" selection-end-column="18" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/atomic2/SingleUpdatePerThreadAtomic.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="175">
|
||||
<caret line="29" column="8" selection-start-line="29" selection-start-column="8" selection-end-line="29" selection-end-column="8" />
|
||||
<folding>
|
||||
<element signature="e#300#301#0" expanded="true" />
|
||||
<element signature="e#324#325#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/synchronized1/MultipleUpdatesPerThreadSynch.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="317">
|
||||
<caret line="28" column="9" selection-start-line="19" selection-start-column="8" selection-end-line="28" selection-end-column="9" />
|
||||
<folding>
|
||||
<element signature="e#301#302#0" expanded="true" />
|
||||
</folding>
|
||||
<state relative-caret-position="528">
|
||||
<caret line="63" column="22" selection-start-line="63" selection-start-column="22" selection-end-line="63" selection-end-column="22" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/parallel/CollectingResults.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="30">
|
||||
<caret line="2" column="17" lean-forward="true" selection-start-line="2" selection-start-column="17" selection-end-line="2" selection-end-column="17" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/test/Test.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="175">
|
||||
<caret line="61" column="8" lean-forward="true" selection-start-line="61" selection-start-column="8" selection-end-line="61" selection-end-column="8" />
|
||||
<state relative-caret-position="75">
|
||||
<caret line="5" column="13" selection-start-line="5" selection-start-column="13" selection-end-line="5" selection-end-column="13" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/atomic1/MultipleUpdatesPerThreadAtomic.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="450">
|
||||
<caret line="31" lean-forward="true" selection-start-line="31" selection-end-line="31" />
|
||||
<caret line="31" selection-start-line="31" selection-end-line="31" />
|
||||
<folding>
|
||||
<element signature="e#312#313#0" expanded="true" />
|
||||
<element signature="e#344#345#0" expanded="true" />
|
||||
|
@ -387,6 +382,13 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/atomic2/SingleUpdatePerThreadAtomic.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="360">
|
||||
<caret line="27" column="18" lean-forward="true" selection-start-line="27" selection-start-column="18" selection-end-line="27" selection-end-column="18" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</component>
|
||||
<component name="masterDetails">
|
||||
<states>
|
||||
|
|
11
hw1/Ex2/.idea/Ex2.iml
Normal file
11
hw1/Ex2/.idea/Ex2.iml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
9
hw1/Ex2/.idea/misc.xml
Normal file
9
hw1/Ex2/.idea/misc.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JavaScriptSettings">
|
||||
<option name="languageLevel" value="ES6" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_12" default="false" project-jdk-name="12.0.1" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
8
hw1/Ex2/.idea/modules.xml
Normal file
8
hw1/Ex2/.idea/modules.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/Ex2.iml" filepath="$PROJECT_DIR$/.idea/Ex2.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
124
hw1/Ex2/.idea/uiDesigner.xml
Normal file
124
hw1/Ex2/.idea/uiDesigner.xml
Normal file
|
@ -0,0 +1,124 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
6
hw1/Ex2/.idea/vcs.xml
Normal file
6
hw1/Ex2/.idea/vcs.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
476
hw1/Ex2/.idea/workspace.xml
Normal file
476
hw1/Ex2/.idea/workspace.xml
Normal file
|
@ -0,0 +1,476 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="b097df70-ddbc-49a8-ab62-9674f3f49e84" name="Default Changelist" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/../../IE1/.idea/compiler.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../../IE1/.idea/libraries/Maven__junit_junit_4_12.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../../IE1/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../../IE1/.idea/misc.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../../IE1/.idea/modules.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../../IE1/.idea/vcs.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../../IE1/IE1.iml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../../IE1/pom.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../../IE1/src/semaphore/MyBulkSemaphore.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../../IE1/src/semaphore/MySemaphore.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/Ex2.iml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/explicit/ExplicitValetQueue.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/explicit/Main.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/implicit/ImplicitValetQueue.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/implicit/Main.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../Ex1/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../Ex1/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/semaphore/Car.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/semaphore/Car.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/semaphore/Main.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/semaphore/Main.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/semaphore/ValetQueue.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/semaphore/ValetQueue.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../submission.tex" beforeDir="false" afterPath="$PROJECT_DIR$/../submission.tex" afterDir="false" />
|
||||
</list>
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="DefaultGradleProjectSettings">
|
||||
<option name="testRunner" value="GRADLE" />
|
||||
<option name="delegatedBuild" value="true" />
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/semaphore/Car.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="315">
|
||||
<caret line="25" column="13" lean-forward="true" selection-start-line="25" selection-start-column="13" selection-end-line="25" selection-end-column="13" />
|
||||
<folding>
|
||||
<element signature="e#502#503#0" expanded="true" />
|
||||
<element signature="e#532#533#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/semaphore/ValetQueue.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="195">
|
||||
<caret line="15" column="32" lean-forward="true" selection-start-line="15" selection-start-column="32" selection-end-line="15" selection-end-column="32" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/implicit/ImplicitValetQueue.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="60">
|
||||
<caret line="9" column="13" selection-start-line="9" selection-start-column="13" selection-end-line="9" selection-end-column="13" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/semaphore/ValetSimulation.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="30">
|
||||
<caret line="2" column="13" selection-start-line="2" selection-start-column="13" selection-end-line="2" selection-end-column="13" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/semaphore/Main.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="195">
|
||||
<caret line="13" column="65" selection-start-line="13" selection-start-column="65" selection-end-line="13" selection-end-column="65" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/explicit/Main.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="225">
|
||||
<caret line="15" lean-forward="true" selection-start-line="15" selection-end-line="15" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/implicit/Main.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="195">
|
||||
<caret line="16" column="27" selection-start-line="16" selection-start-column="27" selection-end-line="16" selection-end-column="27" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/explicit/ExplicitValetQueue.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="70">
|
||||
<caret line="36" column="62" selection-start-line="36" selection-start-column="62" selection-end-line="36" selection-end-column="62" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/semaphore/CarSimulation.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="30">
|
||||
<caret line="2" column="13" selection-start-line="2" selection-start-column="13" selection-end-line="2" selection-end-column="13" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
</leaf>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../.." />
|
||||
</component>
|
||||
<component name="IdeDocumentHistory">
|
||||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/src/semaphore/Car.java" />
|
||||
<option value="$PROJECT_DIR$/src/semaphore/ImplicitValetQueue.java" />
|
||||
<option value="$PROJECT_DIR$/src/semaphore/ValetQueue.java" />
|
||||
<option value="$PROJECT_DIR$/src/semaphore/ExplicitValetQueue.java" />
|
||||
<option value="$PROJECT_DIR$/src/semaphore/Main.java" />
|
||||
<option value="$PROJECT_DIR$/src/explicit/Main.java" />
|
||||
<option value="$PROJECT_DIR$/src/implicit/Main.java" />
|
||||
<option value="$PROJECT_DIR$/src/explicit/ExplicitValetQueue.java" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectConfigurationFiles">
|
||||
<option name="files">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/.idea/Ex2.iml" />
|
||||
<option value="$PROJECT_DIR$/.idea/misc.xml" />
|
||||
<option value="$PROJECT_DIR$/.idea/vcs.xml" />
|
||||
<option value="$PROJECT_DIR$/.idea/modules.xml" />
|
||||
<option value="$PROJECT_DIR$/.idea/uiDesigner.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectFrameBounds" extendedState="6">
|
||||
<option name="width" value="1680" />
|
||||
<option name="height" value="1050" />
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||
<component name="ProjectView">
|
||||
<navigator proportions="" version="1">
|
||||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="Scope" />
|
||||
<pane id="PackagesPane" />
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
<path>
|
||||
<item name="Ex2" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="Ex2" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="Ex2" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="Ex2" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="Ex2" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="Ex2" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="explicit" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="Ex2" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="Ex2" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="implicit" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="Ex2" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="Ex2" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="semaphore" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="aspect.path.notification.shown" value="true" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
|
||||
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
|
||||
<property name="project.structure.last.edited" value="Modules" />
|
||||
<property name="project.structure.proportion" value="0.0" />
|
||||
<property name="project.structure.side.proportion" value="0.2" />
|
||||
</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyClassDialog.RECENTS_KEY">
|
||||
<recent name="explicit" />
|
||||
<recent name="implicit" />
|
||||
<recent name="semaphore" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
<option name="ruleStates">
|
||||
<list>
|
||||
<RuleState>
|
||||
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
<RuleState>
|
||||
<option name="name" value="StatusDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="RunManager" selected="Application.Main (1)">
|
||||
<configuration name="Main (1)" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="explicit.Main" />
|
||||
<module name="Ex2" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="explicit.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="Main" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="semaphore.Main" />
|
||||
<module name="Ex2" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="implicit.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Application.Main (1)" />
|
||||
<item itemvalue="Application.Main" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SvnConfiguration">
|
||||
<configuration />
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="b097df70-ddbc-49a8-ab62-9674f3f49e84" name="Default Changelist" comment="" />
|
||||
<created>1571167105834</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1571167105834</updated>
|
||||
<workItem from="1571167107083" duration="2054000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TimeTrackingManager">
|
||||
<option name="totallyTimeSpent" value="2054000" />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="0" y="23" width="1680" height="1027" extended-state="6" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info id="Designer" />
|
||||
<window_info id="Image Layers" />
|
||||
<window_info id="Capture Tool" />
|
||||
<window_info id="UI Designer" />
|
||||
<window_info id="Favorites" side_tool="true" />
|
||||
<window_info id="Learn" />
|
||||
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.24969475" />
|
||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Terminal" />
|
||||
<window_info anchor="bottom" id="Docker" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" id="Event Log" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Database Changes" />
|
||||
<window_info anchor="bottom" id="Version Control" />
|
||||
<window_info anchor="bottom" id="Messages" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Find" order="1" />
|
||||
<window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.32941177" />
|
||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||
<window_info anchor="bottom" id="TODO" order="6" />
|
||||
<window_info anchor="right" id="Maven" />
|
||||
<window_info anchor="right" id="Palette" />
|
||||
<window_info anchor="right" id="Capture Analysis" />
|
||||
<window_info anchor="right" id="Database" />
|
||||
<window_info anchor="right" id="Palette	" />
|
||||
<window_info anchor="right" id="Theme Preview" />
|
||||
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||
</layout>
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="1" />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/src/semaphore/CarSimulation.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="30">
|
||||
<caret line="2" column="13" selection-start-line="2" selection-start-column="13" selection-end-line="2" selection-end-column="13" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/semaphore/ValetSimulation.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="30">
|
||||
<caret line="2" column="13" selection-start-line="2" selection-start-column="13" selection-end-line="2" selection-end-column="13" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/semaphore/Car.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="315">
|
||||
<caret line="25" column="13" lean-forward="true" selection-start-line="25" selection-start-column="13" selection-end-line="25" selection-end-column="13" />
|
||||
<folding>
|
||||
<element signature="e#502#503#0" expanded="true" />
|
||||
<element signature="e#532#533#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/semaphore/Main.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="195">
|
||||
<caret line="13" column="65" selection-start-line="13" selection-start-column="65" selection-end-line="13" selection-end-column="65" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/semaphore/ValetQueue.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="195">
|
||||
<caret line="15" column="32" lean-forward="true" selection-start-line="15" selection-start-column="32" selection-end-line="15" selection-end-column="32" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/implicit/ImplicitValetQueue.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="60">
|
||||
<caret line="9" column="13" selection-start-line="9" selection-start-column="13" selection-end-line="9" selection-end-column="13" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/implicit/Main.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="195">
|
||||
<caret line="16" column="27" selection-start-line="16" selection-start-column="27" selection-end-line="16" selection-end-column="27" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/explicit/Main.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="225">
|
||||
<caret line="15" lean-forward="true" selection-start-line="15" selection-end-line="15" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="jar:///Library/Java/JavaVirtualMachines/openjdk-12.0.1.jdk/Contents/Home/lib/src.zip!/java.base/java/util/concurrent/locks/ReentrantLock.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="200">
|
||||
<caret line="148" column="22" selection-start-line="148" selection-start-column="22" selection-end-line="148" selection-end-column="22" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/explicit/ExplicitValetQueue.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="70">
|
||||
<caret line="36" column="62" selection-start-line="36" selection-start-column="62" selection-end-line="36" selection-end-column="62" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</component>
|
||||
<component name="masterDetails">
|
||||
<states>
|
||||
<state key="ArtifactsStructureConfigurable.UI">
|
||||
<settings>
|
||||
<artifact-editor />
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
<state key="FacetStructureConfigurable.UI">
|
||||
<settings>
|
||||
<last-edited>No facets are configured</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
<state key="GlobalLibrariesConfigurable.UI">
|
||||
<settings>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
<state key="JdkListConfigurable.UI">
|
||||
<settings>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
<state key="ModuleStructureConfigurable.UI">
|
||||
<settings>
|
||||
<last-edited>Ex2</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
<option value="0.6" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
<state key="ProjectLibrariesConfigurable.UI">
|
||||
<settings>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
</states>
|
||||
</component>
|
||||
</project>
|
64
hw1/Ex2/src/explicit/ExplicitValetQueue.java
Normal file
64
hw1/Ex2/src/explicit/ExplicitValetQueue.java
Normal file
|
@ -0,0 +1,64 @@
|
|||
package explicit;
|
||||
|
||||
import semaphore.Car;
|
||||
import semaphore.Queue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Semaphore;
|
||||
import java.util.concurrent.locks.Condition;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
public class ExplicitValetQueue implements Queue<Car> {
|
||||
private final List<Car> waitingCars;
|
||||
private final int queueMaxSize;
|
||||
private final ReentrantLock lock;
|
||||
private final Condition full, empty;
|
||||
|
||||
|
||||
public ExplicitValetQueue(int queueMaxSize) {
|
||||
this.queueMaxSize = queueMaxSize;
|
||||
waitingCars = new ArrayList<>(this.queueMaxSize);
|
||||
lock = new ReentrantLock();
|
||||
full = lock.newCondition();
|
||||
empty = lock.newCondition();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(Car element) throws InterruptedException {
|
||||
lock.lock();
|
||||
try {
|
||||
while (waitingCars.size() >= this.queueMaxSize) {
|
||||
full.await();
|
||||
}
|
||||
|
||||
waitingCars.add(element);
|
||||
System.out.println("Car with plate " + element.getPlate() + " in queue");
|
||||
System.out.println("Now waiting: " + waitingCars);
|
||||
|
||||
empty.signal();
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Car take() throws InterruptedException {
|
||||
final Car c;
|
||||
lock.lock();
|
||||
try {
|
||||
while (waitingCars.isEmpty()) {
|
||||
empty.await();
|
||||
}
|
||||
|
||||
c = waitingCars.remove(waitingCars.size() - 1);
|
||||
System.out.println("Car with plate " + c.getPlate() + " will be parked now");
|
||||
System.out.println("Now waiting: " + waitingCars);
|
||||
|
||||
full.signal();
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
return c;
|
||||
}
|
||||
}
|
28
hw1/Ex2/src/explicit/Main.java
Normal file
28
hw1/Ex2/src/explicit/Main.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
package explicit;
|
||||
|
||||
import semaphore.Car;
|
||||
import semaphore.CarSimulation;
|
||||
import semaphore.Queue;
|
||||
import semaphore.ValetSimulation;
|
||||
|
||||
public class Main {
|
||||
// Maximum number of cars on the queue for a valet parking service
|
||||
private static final int QUEUE_SIZE = 10;
|
||||
// Simulated number of cars
|
||||
public static final int NUM_CARS = 150;
|
||||
// Simulated number of valets
|
||||
private static final int NUM_VALETS = 5;
|
||||
|
||||
public static void main(String[] args) {
|
||||
// The shared queue
|
||||
final Queue<Car> valetQueue = new ExplicitValetQueue(QUEUE_SIZE);
|
||||
// Starting the threads simulating the cars
|
||||
for (int i = 0; i < NUM_CARS; i++) {
|
||||
new Thread(new CarSimulation(valetQueue, new Car(i))).start();
|
||||
}
|
||||
// Starting the threads simulating the valets
|
||||
for (int i = 0; i < NUM_VALETS; i++) {
|
||||
new Thread(new ValetSimulation(valetQueue), "Valet " + i ).start();
|
||||
}
|
||||
}
|
||||
}
|
42
hw1/Ex2/src/implicit/ImplicitValetQueue.java
Normal file
42
hw1/Ex2/src/implicit/ImplicitValetQueue.java
Normal file
|
@ -0,0 +1,42 @@
|
|||
package implicit;
|
||||
|
||||
import semaphore.Car;
|
||||
import semaphore.Queue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Semaphore;
|
||||
|
||||
public class ImplicitValetQueue implements Queue<Car> {
|
||||
private final List<Car> waitingCars;
|
||||
private final int queueMaxSize;
|
||||
|
||||
public ImplicitValetQueue(int queueMaxSize) {
|
||||
this.queueMaxSize = queueMaxSize;
|
||||
waitingCars = new ArrayList<>(this.queueMaxSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void put(Car element) throws InterruptedException {
|
||||
while (waitingCars.size() >= queueMaxSize) {
|
||||
wait();
|
||||
}
|
||||
|
||||
waitingCars.add(element);
|
||||
System.out.println("Car with plate " + element.getPlate() + " in queue");
|
||||
System.out.println("Now waiting: " + waitingCars);
|
||||
notifyAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Car take() throws InterruptedException {
|
||||
while (waitingCars.isEmpty()) {
|
||||
wait();
|
||||
}
|
||||
Car c = waitingCars.remove(waitingCars.size() - 1);
|
||||
System.out.println("Car with plate " + c.getPlate() + " will be parked now");
|
||||
System.out.println("Now waiting: " + waitingCars);
|
||||
notifyAll();
|
||||
return c;
|
||||
}
|
||||
}
|
28
hw1/Ex2/src/implicit/Main.java
Normal file
28
hw1/Ex2/src/implicit/Main.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
package implicit;
|
||||
|
||||
import semaphore.Car;
|
||||
import semaphore.CarSimulation;
|
||||
import semaphore.Queue;
|
||||
import semaphore.ValetSimulation;
|
||||
|
||||
public class Main {
|
||||
// Maximum number of cars on the queue for a valet parking service
|
||||
private static final int QUEUE_SIZE = 10;
|
||||
// Simulated number of cars
|
||||
public static final int NUM_CARS = 150;
|
||||
// Simulated number of valets
|
||||
private static final int NUM_VALETS = 5;
|
||||
|
||||
public static void main(String[] args) {
|
||||
// The shared queue
|
||||
final Queue<Car> valetQueue = new ImplicitValetQueue(QUEUE_SIZE);
|
||||
// Starting the threads simulating the cars
|
||||
for (int i = 0; i < NUM_CARS; i++) {
|
||||
new Thread(new CarSimulation(valetQueue, new Car(i))).start();
|
||||
}
|
||||
// Starting the threads simulating the valets
|
||||
for (int i = 0; i < NUM_VALETS; i++) {
|
||||
new Thread(new ValetSimulation(valetQueue), "Valet " + i ).start();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -22,4 +22,9 @@ public class Car {
|
|||
int time = generator.nextInt(MAX_PARKING_TIME);
|
||||
Thread.sleep(time);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "" + plate;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package semaphore;
|
||||
|
||||
|
||||
public class Main {
|
||||
// Maximum number of cars on the queue for a valet parking service
|
||||
private static final int QUEUE_SIZE = 10;
|
||||
|
|
|
@ -11,14 +11,33 @@ public class ValetQueue implements Queue<Car> {
|
|||
|
||||
public ValetQueue(int queueMaxSize) {
|
||||
this.queueMaxSize = queueMaxSize;
|
||||
waitingCars = new ArrayList<>(queueMaxSize);
|
||||
empty = new Semaphore (queueMaxSize);
|
||||
waitingCars = new ArrayList<>(this.queueMaxSize);
|
||||
empty = new Semaphore (this.queueMaxSize);
|
||||
full = new Semaphore(0);
|
||||
mutex = new Semaphore(1);
|
||||
}
|
||||
|
||||
// TODO: Implement method put
|
||||
|
||||
// TODO: Implement method take
|
||||
@Override
|
||||
public void put(Car element) throws InterruptedException {
|
||||
empty.acquire();
|
||||
mutex.acquire();
|
||||
waitingCars.add(element);
|
||||
System.out.println("Car with plate " + element.getPlate() + " in queue");
|
||||
System.out.println("Now waiting: " + waitingCars);
|
||||
mutex.release();
|
||||
full.release();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Car take() throws InterruptedException {
|
||||
final Car c;
|
||||
full.acquire();
|
||||
mutex.acquire();
|
||||
c = waitingCars.remove(waitingCars.size() - 1);
|
||||
System.out.println("Car with plate " + c.getPlate() + " will be parked now");
|
||||
System.out.println("Now waiting: " + waitingCars);
|
||||
mutex.release();
|
||||
empty.release();
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
\documentclass[12pt]{article}
|
||||
|
||||
\usepackage[utf8]{inputenc}
|
||||
%\usepackage[margin=2cm]{geometry}
|
||||
\usepackage[margin=2cm]{geometry}
|
||||
|
||||
\title{Howework 1 -- Programming Fundamentals 3}
|
||||
\author{Claudio Maggioni}
|
||||
|
||||
\begin{document}
|
||||
\maketitle
|
||||
\tableofcontents
|
||||
\section{Exercise 1}
|
||||
\subsection{Question 1}
|
||||
\texttt{MultipleUpdatesPerThread} is neither correct nor efficient. The reason for its uncorrectness is the unsynchronized access
|
||||
of \emph{result}, which assigns unconsistent values to it: non-atomic evaluation of the statement \texttt{result += partialSum;}
|
||||
\texttt{MultipleUpdatesPerThread} is neither correct nor efficient. The reason for its non-correctness is the unsynchronized access
|
||||
of \emph{result}, which assigns non-consistent values to it: non-atomic evaluation of the statement \texttt{result += partialSum;}
|
||||
can make one thread evaluate the new value for \emph{result} before another has finished writing to it, thus producing incorrect
|
||||
results.
|
||||
|
||||
|
@ -26,7 +27,16 @@ results.
|
|||
\texttt{CollectingResults} is the only Thread-safe implementation because it is the only one not to use a static field to compute
|
||||
the final result. If multiple threads use anyone of the other classes concurrently, \emph{result} will be shared between the
|
||||
threads and all the results will be inconsistent. In order to solve this problem, either the entire \texttt{sum(...)} method must
|
||||
be considered a critical section (defeating the point of concurrent access to the summing class) or the scope of result must be
|
||||
be considered synchronised to \textit{this.class}, (defeating the point of concurrent access to the summing class) or the scope of result must be
|
||||
bound to the thread (e.g. by making \emph{result} either a private field and making the inner classes non-static, or by making it
|
||||
a local variable, as \texttt{CollectingResults} does).
|
||||
\subsection{Question 7}
|
||||
The slowest implementations are \texttt{MultipleUpdatesPerThreadSynch} and \linebreak[4] \texttt{MultipleUpdatesPerThreadAtomic} since, as discussed before for \textit{Question 1}, their execution is basically sequential since all the computation required for the sum is synchronized, making them even worse than a sequential algorithm due to the synchronization overhead.
|
||||
|
||||
\texttt{SingleUpdatesPerThreadSynch}, \texttt{CollectingResults} and \texttt{SingleUpdatesPerThreadAtomic} are better, with the \textit{Atomic} version being marginally faster due to ISA-level optimization for the synchronization of \texttt{result}. They are faster than the previous couple since they actually make the computation of the sum parallel. This advantage holds only for a reasonable value for \texttt{NUM\_THREADS} (not too few, but not too close from below to the number of elements in the array).
|
||||
\subsection{Question 8}
|
||||
The sequential sum implementation always performs better than the \textit{MultipleUpdates*} implementations.
|
||||
|
||||
In addition, this implementation is better performing than the other three implementations when
|
||||
\texttt{NUM\_THREADS} is close to or bigger than the array length, since each thread in the parallel algorithms will sum few elements making the computation less parallel (since the final sum of \texttt{partialResult}s is sequential).
|
||||
\end{document}
|
Reference in a new issue