-
Notifications
You must be signed in to change notification settings - Fork 0
/
OnePEB.java
executable file
·229 lines (205 loc) · 6.84 KB
/
OnePEB.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
import java.util.ArrayList;
/*********************************************************************
* Class to handle a single instance of a PEB.
*
* @author Duncan A. Buell
* Copyright (c) 2010-2012 Duncan A. Buell
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
**/
public class OnePEB
{
/*********************************************************************
* Instance variables for the class.
**/
// private static final String TAG = "OnePEB: "; // for testing
private boolean usedForClosing;
private boolean foundInSystemLog;
private String pebNumber;
private String type;
private ArrayList<String> voteCollectionTime;
/*********************************************************************
* Constructor.
**/
public OnePEB()
{
this.usedForClosing = false;
this.foundInSystemLog = false;
this.pebNumber = "dummypebnumber";
this.type = "dummytype";
this.voteCollectionTime = new ArrayList<String>();
} // public OnePEB()
/*********************************************************************
* Constructor.
**/
public OnePEB(String number)
{
this.usedForClosing = false;
this.foundInSystemLog = false;
this.pebNumber = number.trim();
this.type = "dummytype";
this.voteCollectionTime = new ArrayList<String>();
} // public OnePEB(String number)
/*********************************************************************
* Constructor.
**/
public OnePEB(String number, String type)
{
this.usedForClosing = false;
this.foundInSystemLog = false;
this.pebNumber = number.trim();
this.type = type;
this.voteCollectionTime = new ArrayList<String>();
} // public OnePEB(String number, String type)
/*********************************************************************
* Accessors and mutators.
**/
/*********************************************************************
* Accessor for <code>foundInSystemLog</code>.
*
* @return the value of <code>foundInSystemLog</code>
**/
public boolean getFoundInSystemLog()
{
return this.foundInSystemLog;
} // public boolean getFoundInSystemLog()
/*********************************************************************
* Mutator for <code>foundInSystemLog</code>.
*
* @param the value of <code>foundInSystemLog</code>
**/
public void setFoundInSystemLog(boolean what)
{
this.foundInSystemLog = what;
} // public void setFoundInSystemLog(boolean what)
/*********************************************************************
* Accessor for <code>pebNumber</code>.
*
* @return the value of <code>pebNumber</code>
**/
public String getPebNumber()
{
return this.pebNumber;
} // public String getPebNumber()
/*********************************************************************
* Mutator for <code>pebNumber</code>.
*
* @param the value of <code>pebNumber</code>
**/
public void setPebNumber(String what)
{
this.pebNumber = what;
} // public void setPebNumber(String what)
/*********************************************************************
* Accessor for <code>type</code>.
*
* @return the value of <code>type</code>
**/
public String getType()
{
return this.type;
} // public String getType()
/*********************************************************************
* Mutator for <code>type</code>.
*
* @param the value of <code>type</code>
**/
public void setType(String what)
{
this.type = what;
} // public void setType(String what)
/*********************************************************************
* Accessor for <code>usedForClosing</code>.
*
* @return the value of <code>usedForClosing</code>
**/
public boolean getUsedForClosing()
{
return this.usedForClosing;
} // public boolean getUsedForClosing()
/*********************************************************************
* Mutator for <code>usedForClosing</code>.
*
* @param the value of <code>usedForClosing</code>
**/
public void setUsedForClosing(boolean what)
{
this.usedForClosing = what;
} // public void setUsedForClosing(boolean what)
/*********************************************************************
* Accessor for <code>voteCollectionTime</code>.
*
* @return the value of <code>voteCollectionTime</code>
**/
public ArrayList<String> getVoteCollectionTime()
{
return this.voteCollectionTime;
} // public ArrayList<String> getVoteCollectionTime()
/*********************************************************************
* Mutator for <code>voteCollectionTime</code>.
*
* We only record the first collection time.
*
* @param the value of <code>voteCollectionTime</code>
**/
public void setVoteCollectionTime(String what)
{
this.voteCollectionTime.add(what);
} // public void setVoteCollectionTime(String what)
/*********************************************************************
* General methods.
**/
/*********************************************************************
* Method to convert a <code>PEB</code> to a
* <code>String</code>.
*
* @return the formatted <code>String</code> value.
**/
public String toString()
{
String s = "";
s += String.format("%7s", this.pebNumber);
s += String.format(" %3s", this.type);
s += String.format(" Closing in 152, In 68A: ");
if(this.usedForClosing)
s += String.format("YES ");
else
s += String.format("NO ");
if(this.foundInSystemLog)
s += String.format("YES %s", this.toStringVoteCollectionTime());
else
s += String.format("NO ");
return s;
} // public String toString()
/*********************************************************************
* Method to toString the the vote collection times.
*
* @return the formatted <code>String</code> value.
**/
public String toStringVoteCollectionTime()
{
String s = "";
for(String vct: voteCollectionTime)
s += String.format("(%s)", vct);
return s;
} // public String toStringVoteCollectionTime()
} // public class OnePEB