Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
aeoden96 committed Aug 24, 2022
1 parent 31a5b04 commit cbf1a43
Show file tree
Hide file tree
Showing 8 changed files with 207 additions and 198 deletions.
File renamed without changes
File renamed without changes
File renamed without changes
3 changes: 3 additions & 0 deletions src/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: transactions.MainForm

15 changes: 11 additions & 4 deletions src/transactions/Linker.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,23 @@ public void multicast(IntLinkedList destIds, String tag, String msg){
public Msg receiveMsg(int fromId) throws IOException {
String getline = dataIn[fromId].readLine();

if(textArea != null)
Util.println(" received message " + getline, textArea);
else
Util.println(" received message " + getline);


StringTokenizer st = new StringTokenizer(getline);
int srcId = Integer.parseInt(st.nextToken());
int destId = Integer.parseInt(st.nextToken());
String tag = st.nextToken();
String msg = st.nextToken("#");

if(textArea != null)
Util.println(" ⟶⟶⟶ received message\n"
+ " source: " + srcId + "\n"
+ " destination: " + destId + "\n"
+ " tag: " + tag + "\n"
+ " message: " + msg + "\n", textArea);
else
Util.println(" received message " + getline);

return new Msg(srcId, destId, tag, msg);
}
public int getMyId() { return myId; }
Expand Down
149 changes: 91 additions & 58 deletions src/transactions/MainForm.form
Original file line number Diff line number Diff line change
@@ -1,51 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="transactions.MainForm">
<grid id="27dc6" binding="panel1" default-binding="true" layout-manager="GridLayoutManager" row-count="3" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="panel1" default-binding="true" layout-manager="GridLayoutManager" row-count="4" column-count="8" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="20" bottom="20" right="20"/>
<constraints>
<xy x="20" y="20" width="831" height="688"/>
<xy x="20" y="20" width="786" height="688"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="fcd8f" class="javax.swing.JRadioButton" binding="nameServerRadioButton" default-binding="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="NameServer"/>
</properties>
</component>
<grid id="25137" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="25137" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="4" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="-1" height="100"/>
</grid>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="be482" class="javax.swing.JTextArea" binding="textArea1" default-binding="true">
<constraints>
<grid row="0" column="1" row-span="4" col-span="1" vsize-policy="6" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="d57b3" class="javax.swing.JRadioButton" binding="responseOKRadioButton" default-binding="true">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Response OK"/>
<text value="Response YES"/>
</properties>
</component>
<component id="93e54" class="javax.swing.JRadioButton" binding="responseFRadioButton" default-binding="true">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Response F"/>
<text value="Response NO"/>
</properties>
</component>
<component id="4b719" class="javax.swing.JRadioButton" binding="noResponseRadioButton" default-binding="true">
Expand All @@ -56,95 +42,142 @@
<text value="No response"/>
</properties>
</component>
<grid id="79ef6" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="8d568" layout-manager="GridLayoutManager" row-count="6" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="-1" height="100"/>
<maximum-size width="100" height="100"/>
</grid>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="2123a" class="javax.swing.JLabel" binding="labelID">
<component id="7cf23" class="javax.swing.JLabel" binding="participantReplyLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="4" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="ID"/>
<text value="Participant reply"/>
</properties>
</component>
<component id="51e91" class="javax.swing.JLabel" binding="labelNum">
<component id="85745" class="javax.swing.JProgressBar" binding="participantReply">
<constraints>
<grid row="1" column="0" row-span="3" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="-1" height="100"/>
<grid row="4" column="2" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="20" height="20"/>
<maximum-size width="20" height="20"/>
</grid>
</constraints>
<properties/>
</component>
<component id="6bfa2" class="javax.swing.JLabel" binding="statusLabel">
<constraints>
<grid row="5" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="#"/>
<text value="Status"/>
</properties>
</component>
<component id="4f9a4" class="javax.swing.JTextField" binding="processId">
<component id="45426" class="javax.swing.JProgressBar" binding="statusCheck">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="20" height="-1"/>
<grid row="5" column="2" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="20" height="20"/>
<maximum-size width="20" height="20"/>
</grid>
</constraints>
<properties/>
</component>
<component id="38af7" class="javax.swing.JTextField" binding="numOfProcesess">
<component id="2123a" class="javax.swing.JLabel" binding="labelID">
<constraints>
<grid row="1" column="1" row-span="3" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="20" height="-1"/>
</grid>
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="2" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="ID"/>
</properties>
</component>
<component id="50f2d" class="javax.swing.JLabel" binding="labelNum">
<constraints>
<grid row="0" column="2" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="2" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value=""/>
<text value="Num of participants"/>
</properties>
</component>
<component id="5b6f" class="javax.swing.JSpinner" binding="processId">
<constraints>
<grid row="1" column="0" row-span="3" col-span="2" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="1bf77" class="javax.swing.JSpinner" binding="numOfProcesess">
<constraints>
<grid row="1" column="2" row-span="3" col-span="2" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
</children>
</grid>
</children>
</grid>
<component id="94c42" class="javax.swing.JRadioButton" binding="masterRadioButton" default-binding="true">
<component id="73779" class="javax.swing.JButton" binding="startButton" default-binding="true">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="2" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Master"/>
<text value="Start"/>
</properties>
</component>
<component id="394fc" class="javax.swing.JRadioButton" binding="slaveRadioButton" default-binding="true">
<component id="ee39c" class="javax.swing.JProgressBar" binding="progressBar1" default-binding="true">
<constraints>
<grid row="3" column="1" row-span="1" col-span="7" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="8c696" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="2" column="1" row-span="1" col-span="7" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Slave"/>
<text value="Progress"/>
</properties>
</component>
<component id="73779" class="javax.swing.JButton" binding="startButton" default-binding="true">
<scrollpane id="404d3">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="2" fill="1" indent="0" use-parent-layout="false"/>
<grid row="1" column="1" row-span="1" col-span="7" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="be482" class="javax.swing.JTextArea" binding="textArea1" default-binding="true">
<constraints/>
<properties>
<disabledTextColor color="-16777216"/>
<editable value="false"/>
<enabled value="false"/>
</properties>
</component>
</children>
</scrollpane>
<component id="fcd8f" class="javax.swing.JRadioButton" binding="nameServerRadioButton" default-binding="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Start"/>
<text value="NameServer"/>
</properties>
</component>
<component id="ee39c" class="javax.swing.JProgressBar" binding="progressBar1" default-binding="true">
<component id="94c42" class="javax.swing.JRadioButton" binding="masterRadioButton" default-binding="true">
<constraints>
<grid row="2" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="2" fill="1" indent="0" use-parent-layout="false"/>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<properties>
<text value="Coordinator"/>
</properties>
</component>
<component id="45426" class="javax.swing.JProgressBar" binding="statusCheck">
<component id="394fc" class="javax.swing.JRadioButton" binding="slaveRadioButton" default-binding="true">
<constraints>
<grid row="2" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="2" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="20" height="20"/>
<maximum-size width="20" height="20"/>
</grid>
<grid row="0" column="2" row-span="1" col-span="6" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<properties>
<text value="Participant"/>
</properties>
</component>
</children>
</grid>
Expand Down
Loading

0 comments on commit cbf1a43

Please sign in to comment.