in server/src/main/java/com/epam/indigoeln/core/chemistry/sdf/SdUnit.java [147:187]
private static String validateDetailCoordinates(int numAtoms, BufferedReader br) throws IOException {
String returnString = OK;
double improbablyLargeValue = 10000.0D;
for (int x = 0; x <= numAtoms - 1; ++x) {
String line = br.readLine();
if (Objects.isNull(line)) {
return "Incorrect number of atoms and/or bonds";
}
if (line.indexOf(".") != 5) {
return "X coordinate decimal in wrong place";
}
double test;
test = validateDetailGetDouble(line, 0, 10);
if (Math.abs(test) >= improbablyLargeValue) {
return "Invalid X coordinate";
}
test = validateDetailGetDouble(line, 10, 20);
if (Math.abs(test) >= improbablyLargeValue) {
return "Invalid Y coordinate";
}
test = validateDetailGetDouble(line, 20, 30);
if (Math.abs(test) >= improbablyLargeValue) {
return "Invalid Z coordinate";
}
if (doubleEqZero(test)) {
continue;
}
returnString = OK_3D;
}
return returnString;
}