-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRaBin(1).java
More file actions
379 lines (353 loc) · 9.64 KB
/
RaBin(1).java
File metadata and controls
379 lines (353 loc) · 9.64 KB
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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
package edu.easternct.bigdata;
import java.io.Serializable;
import java.math.BigDecimal;
import java.math.RoundingMode;
/** This class manages a star object. It allows you to manage and retrieve
* the data needed to be stored about a star
*/
public class RaBin implements Serializable, Comparable<RaBin>{
/**
*
*/
private static final long serialVersionUID = 8332314307058700472L;
/**
*
*/
// private static final long serialVersionUID = 8332314307058700472L;
private Integer binNum;
private Integer starCount;
private BigDecimal totBMinV;
private BigDecimal avgBMinV;
private BigDecimal median;
private BigDecimal mean;
private BigDecimal standD;
private BigDecimal minumum;
private BigDecimal maximum;
private Integer spectralOcount;
private Integer spectralBcount;
private Integer spectralAcount;
private Integer spectralFcount;
private Integer spectralGcount;
private Integer spectralKcount;
private Integer spectralMcount;
/** This method is the default constructor for the star class
* @param it takes in no data
* @return it returns no data*/
public RaBin() {
this.binNum = 0;
this.starCount = 0;
this.avgBMinV = new BigDecimal("0.0");
this.totBMinV = new BigDecimal("0.0");
this.mean = new BigDecimal("0.0");
this.median = new BigDecimal("0.0");
this.standD = new BigDecimal("0.0");
this.maximum = new BigDecimal("0.0");
this.minumum = new BigDecimal("0.0");
this.spectralOcount = 0;
this.spectralBcount = 0;
this.spectralAcount = 0;
this.spectralFcount = 0;
this.spectralGcount = 0;
this.spectralKcount = 0;
this.spectralMcount = 0;
}
/** This method is the constructor for the star class
*
*/
public RaBin(Integer binNum, Integer starCount, BigDecimal totBMinV) {
this.binNum = binNum;
this.starCount = starCount;
this.totBMinV = totBMinV;
if (starCount > 0)
avgBMinV = totBMinV.divide(new BigDecimal(starCount),6,RoundingMode.HALF_UP);
else
this.avgBMinV = new BigDecimal("0.0");
this.mean = new BigDecimal("0.0");
this.median = new BigDecimal("0.0");
this.standD = new BigDecimal("0.0");
this.maximum = new BigDecimal("0.0");
this.minumum = new BigDecimal("0.0");
this.spectralOcount = 0;
this.spectralBcount = 0;
this.spectralAcount = 0;
this.spectralFcount = 0;
this.spectralGcount = 0;
this.spectralKcount = 0;
this.spectralMcount = 0;
}
public RaBin(Integer binNum, Integer starCount, BigDecimal totBMinV, BigDecimal mean, BigDecimal median,
BigDecimal standD, BigDecimal minumum, BigDecimal maximum, Integer spectralOcount, Integer spectralBcount,
Integer spectralAcount, Integer spectralFcount, Integer spectralGcount, Integer spectralKcount, Integer spectralMcount) {
this.binNum = binNum;
this.starCount = starCount;
this.totBMinV = totBMinV.setScale(6, RoundingMode.HALF_UP);
if (starCount > 0)
avgBMinV = totBMinV.divide(new BigDecimal(starCount),6,RoundingMode.HALF_UP);
else
this.avgBMinV = new BigDecimal("0.0").setScale(6);
this.mean = mean.setScale(6, RoundingMode.HALF_UP);
this.median = median.setScale(6, RoundingMode.HALF_UP);
this.standD = standD.setScale(6, RoundingMode.HALF_UP);
this.maximum = maximum.setScale(6, RoundingMode.HALF_UP);
this.minumum = minumum.setScale(6, RoundingMode.HALF_UP);
this.spectralOcount = spectralOcount;
this.spectralBcount = spectralBcount;
this.spectralAcount = spectralAcount;
this.spectralFcount = spectralFcount;
this.spectralGcount = spectralGcount;
this.spectralKcount = spectralKcount;
this.spectralMcount = spectralMcount;
}
/**
* @return the binNum
*/
public Integer getBinNum() {
return binNum;
}
/**
* @param binNum the binNum to set
*/
public void setBinNum(Integer binNum) {
this.binNum = binNum;
}
/**
* @return the starCount
*/
public Integer getStarCount() {
return starCount;
}
/**
* @param starCount the starCount to set
*/
public void setStarCount(Integer starCount) {
this.starCount = starCount;
}
/**
* @return the totBMinV
*/
public BigDecimal getTotBMinV() {
return totBMinV;
}
/**
* @param totBMinV the totBMinV to set
*/
public void setTotBMinV(BigDecimal totBMinV) {
this.totBMinV = totBMinV;
}
/**
* @return the avgBMinV
*/
public BigDecimal getAvgBMinV() {
return avgBMinV;
}
/**
* @param avgBMinV the avgBMinV to set
*/
public void setAvgBMinV(BigDecimal avgBMinV) {
this.avgBMinV = avgBMinV;
}
/**
* @return the median
*/
public BigDecimal getMedian() {
return median;
}
/**
* @param median the median to set
*/
public void setMedian(BigDecimal median) {
this.median = median;
}
/**
* @return the mean
*/
public BigDecimal getMean() {
return mean;
}
/**
* @param mean the mean to set
*/
public void setMean(BigDecimal mean) {
this.mean = mean;
}
/**
* @return the standD
*/
public BigDecimal getStandD() {
return standD;
}
/**
* @param standD the standD to set
*/
public void setStandD(BigDecimal standD) {
this.standD = standD;
}
/**
* @return the minumum
*/
public BigDecimal getMinumum() {
return minumum;
}
/**
* @param minumum the minumum to set
*/
public void setMinumum(BigDecimal minumum) {
this.minumum = minumum;
}
/**
* @return the maximum
*/
public BigDecimal getMaximum() {
return maximum;
}
/**
* @param maximum the maximum to set
*/
public void setMaximum(BigDecimal maximum) {
this.maximum = maximum;
}
/**
* @return the spectralOcount
*/
public Integer getSpectralOcount() {
return spectralOcount;
}
/**
* @param spectralOcount the spectralOcount to set
*/
public void setSpectralOcount(Integer spectralOcount) {
this.spectralOcount = spectralOcount;
}
/**
* @return the spectralBcount
*/
public Integer getSpectralBcount() {
return spectralBcount;
}
/**
* @param spectralBcount the spectralBcount to set
*/
public void setSpectralBcount(Integer spectralBcount) {
this.spectralBcount = spectralBcount;
}
/**
* @return the spectralAcount
*/
public Integer getSpectralAcount() {
return spectralAcount;
}
/**
* @param spectralAcount the spectralAcount to set
*/
public void setSpectralAcount(Integer spectralAcount) {
this.spectralAcount = spectralAcount;
}
/**
* @return the spectralFcount
*/
public Integer getSpectralFcount() {
return spectralFcount;
}
/**
* @param spectralFcount the spectralFcount to set
*/
public void setSpectralFcount(Integer spectralFcount) {
this.spectralFcount = spectralFcount;
}
/**
* @return the spectralGcount
*/
public Integer getSpectralGcount() {
return spectralGcount;
}
/**
* @param spectralGcount the spectralGcount to set
*/
public void setSpectralGcount(Integer spectralGcount) {
this.spectralGcount = spectralGcount;
}
/**
* @return the spectralKcount
*/
public Integer getSpectralKcount() {
return spectralKcount;
}
/**
* @param spectralKcount the spectralKcount to set
*/
public void setSpectralKcount(Integer spectralKcount) {
this.spectralKcount = spectralKcount;
}
/**
* @return the spectralMcount
*/
public Integer getSpectralMcount() {
return spectralMcount;
}
/**
* @param spectralMcount the spectralMcount to set
*/
public void setSpectralMcount(Integer spectralMcount) {
this.spectralMcount = spectralMcount;
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((binNum == null) ? 0 : binNum.hashCode());
return result;
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
RaBin other = (RaBin) obj;
if (binNum == null) {
if (other.binNum != null)
return false;
} else if (!binNum.equals(other.binNum))
return false;
return true;
}
public int compareTo(RaBin bin) {
if (this == bin)
return 0;
return this.binNum.compareTo(bin.binNum);
}
/** This method returns a String display of the person's instance variables.
* @param it receives no input
* @return personData it returns a string of data*/
public String toFormattedString() {
return ("Bin Num #: " + getBinNum() + " Star Count: " + getStarCount() + " Tot B-V: " + getTotBMinV() + " " + " Avg B-V: " + getAvgBMinV()
+" Mean: " + getMean() + " Median: " + getMean() + " StandD: " + getStandD() + " Minimum: " + getMinumum() + " Max: " + getMaximum());
}
public String toString() {
StringBuffer tempString = new StringBuffer(100);
tempString.append(this.getBinNum() + ",");
tempString.append(this.getStarCount() + ",");
tempString.append(this.getMean() + ",");
tempString.append(this.getMedian() + ",");
tempString.append(this.getStandD() + ",");
tempString.append(this.getMinumum() + ",");
tempString.append(this.getMaximum() + ",");
tempString.append(this.getAvgBMinV() + ",");
tempString.append(this.getSpectralOcount() + ",");
tempString.append(this.getSpectralBcount() + ",");
tempString.append(this.getSpectralAcount() + ",");
tempString.append(this.getSpectralFcount() + ",");
tempString.append(this.getSpectralGcount() + ",");
tempString.append(this.getSpectralKcount() + ",");
tempString.append(this.getSpectralMcount());
return tempString.toString();
}
}