Skip to content

Commit a23cd15

Browse files
committed
Merge pull request #7 from RX14/master
Added support for TLEs where the name line starts with 0
2 parents 1a57a82 + b28a18d commit a23cd15

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

src/main/java/uk/me/g4dpz/satellite/TLE.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,21 @@ public TLE(final TLE tle) {
124124
this.createddate = tle.createddate;
125125
}
126126

127+
public TLE(final String[] tle) throws IllegalArgumentException {
128+
this(tle, false);
129+
}
130+
127131
/**
128132
* Constructor.
129133
*
130134
* @param tle the three line elements
131135
* @throws IllegalArgumentException here was something wrong with the TLE
132136
*/
133-
public TLE(final String[] tle) throws IllegalArgumentException {
137+
public TLE(final String[] tle, boolean nilStart) throws IllegalArgumentException {
138+
139+
if (nilStart) {
140+
tle[0] = tle[0].substring(2);
141+
}
134142

135143
if (null == tle) {
136144
throw new IllegalArgumentException("TLE was null");

src/test/java/uk/me/g4dpz/satellite/AbstractSatelliteTestBase.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ protected AbstractSatelliteTestBase() {
8080
"1 33139U 06026MX 09359.84164805 .10408321 74078-5 34039-2 0 6397",
8181
"2 33139 064.8768 254.5588 0010700 285.2081 074.8503 16.45000000 91112"};
8282

83+
protected static final String[] NIL_START_TLE = {
84+
"0 AO-51 [+]",
85+
"1 28375U 04025K 09105.66391970 .00000003 00000-0 13761-4 0 3643",
86+
"2 28375 098.0551 118.9086 0084159 315.8041 043.6444 14.40638450251959"};
87+
8388
protected static final String LATITUDE = "52.4670";
8489
protected static final String LONGITUDE = "-2.022";
8590
protected static final int HEIGHT_AMSL = 200;

src/test/java/uk/me/g4dpz/satellite/TLETest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ public void testCopyConstructor() {
7272
checkData(tleCopy);
7373
}
7474

75+
@Test
76+
public void testNilStartTLE() {
77+
78+
final TLE tle = new TLE(NIL_START_TLE, true);
79+
checkData(tle);
80+
}
81+
7582
@Test
7683
public void testTLEReadDeepSpace() {
7784
final String[] theTLE = {

0 commit comments

Comments
 (0)