@@ -47,13 +47,10 @@ class ControlDesk extends Thread {
47
47
48
48
/** The collection of Lanes */
49
49
private HashSet lanes ;
50
-
51
50
/** The party wait queue */
52
51
private Queue partyQueue ;
53
-
54
52
/** The number of lanes represented */
55
53
private int numLanes ;
56
-
57
54
/** The collection of subscribers */
58
55
private Vector subscribers ;
59
56
@@ -68,15 +65,11 @@ public ControlDesk(int numLanes) {
68
65
this .numLanes = numLanes ;
69
66
lanes = new HashSet (numLanes );
70
67
partyQueue = new Queue ();
71
-
72
68
subscribers = new Vector ();
73
-
74
69
for (int i = 0 ; i < numLanes ; i ++) {
75
70
lanes .add (new Lane ());
76
71
}
77
-
78
72
this .start ();
79
-
80
73
}
81
74
82
75
/**
@@ -85,9 +78,7 @@ public ControlDesk(int numLanes) {
85
78
*/
86
79
public void run () {
87
80
while (true ) {
88
-
89
81
assignLane ();
90
-
91
82
try {
92
83
sleep (250 );
93
84
} catch (Exception e ) {}
@@ -106,18 +97,14 @@ public void run() {
106
97
107
98
private Bowler registerPatron (String nickName ) {
108
99
Bowler patron = null ;
109
-
110
100
try {
111
101
// only one patron / nick.... no dupes, no checks
112
-
113
102
patron = BowlerFile .getBowlerInfo (nickName );
114
-
115
103
} catch (FileNotFoundException e ) {
116
104
System .err .println ("Error..." + e );
117
105
} catch (IOException e ) {
118
106
System .err .println ("Error..." + e );
119
107
}
120
-
121
108
return patron ;
122
109
}
123
110
@@ -128,10 +115,8 @@ private Bowler registerPatron(String nickName) {
128
115
129
116
public void assignLane () {
130
117
Iterator it = lanes .iterator ();
131
-
132
118
while (it .hasNext () && partyQueue .hasMoreElements ()) {
133
119
Lane curLane = (Lane ) it .next ();
134
-
135
120
if (curLane .isPartyAssigned () == false ) {
136
121
System .out .println ("ok... assigning this party" );
137
122
curLane .assignParty (((Party ) partyQueue .next ()));
0 commit comments