Refacotr code for AB8

This commit is contained in:
2022-06-03 14:23:51 +02:00
parent 8f6320e069
commit cfba0106a9
10 changed files with 170 additions and 234 deletions

View File

@@ -2,26 +2,25 @@ import java.io.*;
public class ReadDataUtil {
// Reads the position and velocity vector on the specified 'day' from the file with the
// specified 'path', and sets position and current velocity of 'b' accordingly. If
// successful the method returns 'true'. If the specified 'day' was not found in the file,
// 'b' is unchanged and the method returns 'false'.
// The file format is validated before reading the state.
// Lines before the line "$$SOE" and after the line "$$EOE" the are ignored. Each line of the
// file between the line "$$SOE" and the line "$$EOE" is required to have the following format:
// JDTDB, TIME, X, Y, Z, VX, VY, VZ
// where JDTDB is interpretable as a 'double' value, TIME is a string and X, Y, Z, VX, VY and
// VZ are interpretable as 'double' values. JDTDB can be ignored. The character ',' must only
// be used as field separator. If the file is not found, an exception of the class
// 'StateFileNotFoundException' is thrown. If it does not comply with the format described
// above, the method throws an exception of the class 'StateFileFormatException'. Both
// exceptions are subtypes of 'IOException'.
// Precondition: b != null, path != null, day != null and has the format YYYY-MM-DD.
public static boolean readConfiguration(NamedBody b, String path, String day)
throws IOException {
// TODO: implement this method.
return false;
}
/**
* Reads the position and velocity vector on the specified 'day' from the file with the
* specified 'path', and sets position and current velocity of 'b' accordingly. If
* successful the method returns 'true'. If the specified 'day' was not found in the file,
* 'b' is unchanged and the method returns 'false'.
* The file format is validated before reading the state.
* Lines before the line "$$SOE" and after the line "$$EOE" the are ignored. Each line of the
* file between the line "$$SOE" and the line "$$EOE" is required to have the following format:
* JDTDB, TIME, X, Y, Z, VX, VY, VZ
* where JDTDB is interpretable as a 'double' value, TIME is a string and X, Y, Z, VX, VY and
* VZ are interpretable as 'double' values. JDTDB can be ignored. The character ',' must only
* be used as field separator. If the file is not found, an exception of the class
* 'StateFileNotFoundException' is thrown. If it does not comply with the format described
* above, the method throws an exception of the class 'StateFileFormatException'. Both
* exceptions are subtypes of 'IOException'.
* Precondition: b != null, path != null, day != null and has the format YYYY-MM-DD.
*/
public static boolean readConfiguration(NamedBody b, String path, String day) throws IOException {
// TODO: implement this method.
return false;
}
}