class LaserMeasurement {

    @NonNull
    public static List<LaserMeasurement> parse(@NonNull String pointString, boolean metric, boolean strict) throws ParseException {
        final List<LaserMeasurement> points = new ArrayList<>();
        final String[] lines = pointString.split("\n");
        final double units = metric ? 1 : Convert.FT;
        for (int i = 0; i < lines.length; i++) {
            final String line = lines[i];
            final String[] row = line.trim().split("[, \t/]+", -1);
            if (row.length == 2) {
                try {
                    final double x = Double.parseDouble(row[0]) * units;
                    final double y = Double.parseDouble(row[1]) * units;
                    if (Numbers.isReal(x) && Numbers.isReal(y)) {
                        points.add(new LaserMeasurement(x, y));
                    } else {
                        Log.w(TAG, "Laser measurements must be real " + x + " " + y);
                        if (strict) {
                            throw new ParseException("Invalid measurement", i + 1);
                        }
                    }
                } catch (NumberFormatException e) {
                    Log.w(TAG, "Error parsing laser profile " + e);
                    if (strict) {
                        throw new ParseException("Invalid measurement", i + 1);
                    }
                }
            } else {
                if (strict) {
                    throw new ParseException("Invalid measurement", i + 1);
                }
            }
        }
        return points;
    }

    public  LaserMeasurement(double x, double y);

}