-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStar.java
More file actions
308 lines (273 loc) · 6.52 KB
/
Star.java
File metadata and controls
308 lines (273 loc) · 6.52 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
package edu.easternct.bigdata;
import java.io.Serializable;
import java.math.BigDecimal;
import java.math.MathContext;
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 Star implements Serializable, Comparable<Star>{
/**
*
*/
private static final long serialVersionUID = 8332314307058700472L;
/**
*
*/
// private static final long serialVersionUID = 8332314307058700472L;
private String tychoId;
private String meanFlag;
private Double raMdeg;
private Double deMdeg;
private BigDecimal btMag;
private BigDecimal vtMag;
private String hipNum;
private BigDecimal bMinV;
private Integer raBin;
private Integer colorInd;
private Double v;
/** This method is the default constructor for the star class
* @param it takes in no data
* @return it returns no data*/
public Star() {
this.tychoId = "";
this.raMdeg = 0.0;
this.deMdeg = 0.0;
this.btMag = new BigDecimal(0.0);
this.vtMag = new BigDecimal(0.0);
this.hipNum = "";
this.bMinV = new BigDecimal(0.0);
}
/** This method is the constructor for the star class
*
*/
public Star(String tychoId, String meanFlag, Double raMdeg, Double deMdeg, BigDecimal btMag, BigDecimal vtMag, String hipNum) {
this.tychoId = tychoId;
this.meanFlag = meanFlag;
this.raMdeg = raMdeg;
this.deMdeg = deMdeg;
this.btMag = btMag;
this.vtMag = vtMag;
this.hipNum = hipNum;
this.bMinV = new BigDecimal(0.0);
}
/**
* @return the tychoId
*/
public String getTychoId() {
return tychoId;
}
/**
* @param tychoId the tychoId to set
*/
public void setTychoId(String tychoId) {
this.tychoId = tychoId;
}
/**
* @return the meanFlag
*/
public String getMeanFlag() {
return meanFlag;
}
/**
* @param meanFlag the meanFlag to set
*/
public void setMeanFlag(String meanFlag) {
this.meanFlag = meanFlag;
}
/**
* @return the raMdeg
*/
public Double getRaMdeg() {
return raMdeg;
}
/**
* @param raMdeg the raMdeg to set
*/
public void setRaMdeg(Double raMdeg) {
this.raMdeg = raMdeg;
}
/**
* @return the deMdeg
*/
public Double getDeMdeg() {
return deMdeg;
}
/**
* @param deMdeg the deMdeg to set
*/
public void setDeMdeg(Double deMdeg) {
this.deMdeg = deMdeg;
}
/**
* @return the btMag
*/
public BigDecimal getBtMag() {
return btMag;
}
/**
* @param btMag the btMag to set
*/
public void setBtMag(BigDecimal btMag) {
this.btMag = btMag;
}
/**
* @return the vtMag
*/
public BigDecimal getVtMag() {
return vtMag;
}
/**
* @param vtMag the vtMag to set
*/
public void setVtMag(BigDecimal vtMag) {
this.vtMag = vtMag;
}
/**
* @return the hipNum
*/
public String getHipNum() {
return hipNum;
}
/**
* @param hipNum the hipNum to set
*/
public void setHipNum(String hipNum) {
this.hipNum = hipNum;
}
/**
* @return the bMinV
*/
public BigDecimal getBMinV() {
return bMinV;
}
/**
* @param bMinV the bMinV to set
*/
public void setBMinV(BigDecimal bMinV) {
this.bMinV = bMinV;
}
/**
* @param none
*/
public void setBMinV() {
this.bMinV = btMag.subtract(vtMag,new MathContext(6)).multiply(new BigDecimal(.850),new MathContext(6));
double temp = bMinV.doubleValue();
if (temp >= 1.4) colorInd = 5;
else if (temp >= .82) colorInd = 4;
else if (temp >= .31) colorInd = 3;
else if (temp >= .00) colorInd = 2;
else colorInd = 1;
// v = vtMag - .090 * (btMag - vtMag);
}
/**
* @return the raBin
*/
public Integer getRaBin() {
return raBin;
}
/**
* @param raBin the raBin to set
*/
public void setRaBin(int raBin) {
this.raBin = raBin;
}
/**
* @param raBin the raBin to set
*/
public void setRaBin() {
if (deMdeg > 0)
{
Double tempRaBin = raMdeg/1;
Double tempLeftover = raMdeg % 1;
if (tempLeftover > 0)
this.raBin = tempRaBin.intValue() + 1;
else
this.raBin = tempRaBin.intValue();
}
else
raBin = 0;
}
/**
* @return the colorInd
*/
public Integer getColorInd() {
return colorInd;
}
/**
* @param colorInd the colorInd to set
*/
public void setColorInd(Integer colorInd) {
this.colorInd = colorInd;
}
/**
* @return the v
*/
public Double getV() {
return v;
}
/**
* @param v the v to set
*/
public void setV(Double v) {
this.v = v;
}
/** This method compares ther passed Person object with the called.
* @param a person object
* @returns 0, if the the two are equal
* returns -1, if the passed is greater
* returns 1, if the passed is less*/
public int compareTo(Star star) {
if (this == star)
return 0;
return this.tychoId.compareTo(star.tychoId);
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((tychoId == null) ? 0 : tychoId.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;
Star other = (Star) obj;
if (tychoId == null) {
if (other.tychoId != null)
return false;
} else if (!tychoId.equals(other.tychoId))
return false;
return true;
}
/** 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 ("Id: " + getTychoId() + " RA Mag Degree: " + getRaMdeg() + "De Mag Degree: " + getDeMdeg() + " " + " BT Mag: " + getBtMag() +
" " + " VT Mag: " + " " + getVtMag() + " Hip Num: " + " " + getHipNum() + " B-V: " + " " + getBMinV());
}
public String toString() {
StringBuffer tempString = new StringBuffer(100);
tempString.append(this.getTychoId() + ",");
tempString.append(this.getRaMdeg() + ",");
tempString.append(this.getDeMdeg() + ",");
tempString.append(this.getBtMag() + ",");
tempString.append(this.getVtMag() + ",");
tempString.append(this.getHipNum() + ",");
tempString.append(this.getBMinV() + ",");
tempString.append(this.getRaBin());
return tempString.toString();
}
}