Merge branch 'main' of ssh://gitlab.fdmci.hva.nl/propedeuse-hbo-ict/onderwijs/2023-2024/out-a-se-ti/blok-4/muupooviixee66
This commit is contained in:
@@ -29,7 +29,7 @@ public class ExerciseManager {
|
||||
private static final String PROPERTY_NAME = "name";
|
||||
|
||||
// The delimiter used to separate the paths of the sensors.
|
||||
public static final String PATH_DELIMITER = ";";
|
||||
public static final String PATH_DELIMITER = ":";
|
||||
|
||||
public static final int SENSOR_COUNT = 2;
|
||||
|
||||
@@ -96,6 +96,7 @@ public class ExerciseManager {
|
||||
// Ensure all required properties are present
|
||||
for (String property : REQUIRED_PROPERTIES) {
|
||||
if (!content.has(property)) {
|
||||
System.out.println("Missing property: " + property);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -103,10 +104,13 @@ public class ExerciseManager {
|
||||
// Path data is split into two parts, due to the left and right hand.
|
||||
// If one wants to add support for more sensors, one will have to adjust the Exercise
|
||||
// class to support more paths.
|
||||
System.out.println(content.get(PROPERTY_PATH).getAsString());
|
||||
String[] leftRightData = content.get(PROPERTY_PATH).getAsString().split(PATH_DELIMITER);
|
||||
|
||||
if (leftRightData.length != SENSOR_COUNT)
|
||||
if (leftRightData.length != SENSOR_COUNT) {
|
||||
System.out.println("Invalid path data.");
|
||||
return null;
|
||||
}
|
||||
|
||||
return new Exercise(
|
||||
EMuscleGroup.parse(content.get(PROPERTY_MUSCLE_GROUP).getAsString()),
|
||||
|
@@ -13,8 +13,10 @@ public class GesturePath {
|
||||
* @param vectors The vectors that make up the path.
|
||||
*/
|
||||
public GesturePath(Vector3f[] vectors) {
|
||||
if (vectors.length < 2)
|
||||
throw new IllegalArgumentException("A path must have at least two points.");
|
||||
if (vectors.length < 2) {
|
||||
this.segments = new PathSegment[0];
|
||||
return;
|
||||
}
|
||||
|
||||
this.segments = new PathSegment[vectors.length - 1];
|
||||
for (int i = 0; i < vectors.length - 1; i++)
|
||||
@@ -98,7 +100,7 @@ public class GesturePath {
|
||||
|
||||
// Check if the input string contains a valid amount of bytes (12 bytes per vector)
|
||||
if (input.length() % 12 != 0) {
|
||||
throw new IllegalArgumentException("Invalid input string length");
|
||||
throw new IllegalArgumentException("Invalid input string length (" + input.length() + " bytes provided - must be a multiple of 12)");
|
||||
}
|
||||
Vector3f[] vectors = new Vector3f[input.length() / 12];
|
||||
|
||||
|
Reference in New Issue
Block a user