...
 
Commits (2)
......@@ -1400,9 +1400,18 @@ public class InstrumentResponse {
final String TWO_SPACES = " ";
DecimalFormat formatter = new DecimalFormat("+0.00000E00;-0.00000E00");
String[] splitLine = line.split("\\s+");
StringBuilder replacedLine = new StringBuilder();
// first 19 characters are the field header and the pole/zero number & needed whitespace
replacedLine.append(line.substring(0, 18));
// first 16 characters are supposed to be the field header, whitespace, and P/Z index number
// when we extract whitespace
replacedLine.append(splitLine[0]); // field header (i.e., "B053F10-13")
int neededWhitespace = 16 - (splitLine[0].length() + splitLine[1].length());
char[] whitespace = new char[neededWhitespace];
Arrays.fill(whitespace, ' ');
replacedLine.append(whitespace); // amount of needed whitespace
replacedLine.append(splitLine[1]); // index of given pole or zero
replacedLine.append(TWO_SPACES); // two spaces before the real value
double real = poleOrZero.getReal();
String printDouble = formatter.format(real);
......@@ -1419,7 +1428,7 @@ public class InstrumentResponse {
}
replacedLine.append(printDouble).append(TWO_SPACES);
String[] splitLine = line.split("\\s+");
// real and imaginary error are at indices 4 and 5 of array
// (array is field ID, pole/zero #, real part, imag part, real err, imag err)
String realError = splitLine[4];
......