From 702d8e0e616b3169b0f4ae1b6874773dead3a961 Mon Sep 17 00:00:00 2001 From: pacoito123 Date: Sat, 6 Jul 2019 11:26:06 -0500 Subject: [PATCH] Quick hotfix for something I overlooked. [SuperComponents] - DoubleSolenoid now has proper naming. --- .../supercomponents/SuperDoubleSolenoid.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/usfirst/lib6647/subsystem/supercomponents/SuperDoubleSolenoid.java b/src/main/java/org/usfirst/lib6647/subsystem/supercomponents/SuperDoubleSolenoid.java index ca444e4..1bd348b 100644 --- a/src/main/java/org/usfirst/lib6647/subsystem/supercomponents/SuperDoubleSolenoid.java +++ b/src/main/java/org/usfirst/lib6647/subsystem/supercomponents/SuperDoubleSolenoid.java @@ -22,42 +22,42 @@ public interface SuperDoubleSolenoid { * HashMap storing the {@link SuperSubsystem}'s {@link HyperDoubleSolenoid * HyperDoubleSolenoids}. */ - public HashMap solenoids = new HashMap(); + public HashMap doubleSolenoids = new HashMap(); /** * Method to initialize {@link HyperDoubleSolenoid HyperDoubleSolenoids} * declared in the {@link SuperSubsystem#robotMap robotMap} JSON file, and add - * them to the {@link #solenoids} HashMap using its declared name as its key. + * them to the {@link #doubleSolenoids} HashMap using its declared name as its key. * * @param {@link SuperSubsystem#robotMap} * @param {@link SuperSubsystem#getName} */ - default void initSolenoids(JSONObject robotMap, String subsystemName) { + default void initDoubleSolenoids(JSONObject robotMap, String subsystemName) { // Create a JSONArray out of the declared objects. - JSONArray solenoidArray = (JSONArray) ((JSONObject) ((JSONObject) robotMap.get("subsystems")) + JSONArray doubleSolenoidArray = (JSONArray) ((JSONObject) ((JSONObject) robotMap.get("subsystems")) .get(subsystemName)).get("doubleSolenoids"); // Create a stream to cast each entry in the JSONArray into a JSONObject, in // order to configure it using the values declared in the robotMap file. - Arrays.stream(solenoidArray.toArray()).map(json -> (JSONObject) json).forEach(json -> { + Arrays.stream(doubleSolenoidArray.toArray()).map(json -> (JSONObject) json).forEach(json -> { try { if (json.containsKey("name") && json.containsKey("forwardChannel") && json.containsKey("reverseChannel")) { - HyperDoubleSolenoid solenoid; + HyperDoubleSolenoid doubleSolenoid; try { // Try to initialize an object from an index in the JSONArray. - solenoid = new HyperDoubleSolenoid(Integer.parseInt(json.get("forwardChannel").toString()), + doubleSolenoid = new HyperDoubleSolenoid(Integer.parseInt(json.get("forwardChannel").toString()), Integer.parseInt(json.get("reverseChannel").toString())); } catch (NumberFormatException e) { throw new ComponentInitException(String.format( "[!] INVALID OR EMPTY CHANNEL VALUE(S) FOR DOUBLESOLENOID '%1$s' IN SUBSYSTEM '%2$s'", json.get("name").toString(), subsystemName)); } - solenoid.stop(); + doubleSolenoid.stop(); // Put object in HashMap with its declared name as key after initialization and // configuration. - solenoids.put(json.get("name").toString(), solenoid); + doubleSolenoids.put(json.get("name").toString(), doubleSolenoid); } else { System.out.println(String.format("[!] UNDECLARED OR EMPTY DOUBLESOLENOID ENTRY IN SUBSYSTEM '%s'", subsystemName.toUpperCase())); @@ -72,16 +72,16 @@ default void initSolenoids(JSONObject robotMap, String subsystemName) { }); // Clear JSONArray after use, not sure if it does anything, but it might free // some unused memory. - solenoidArray.clear(); + doubleSolenoidArray.clear(); } /** * Gets specified {@link HyperDoubleSolenoid}. * * @return {@link HyperDoubleSolenoid} - * @param solenoidName + * @param doubleSolenoidName */ - default HyperDoubleSolenoid getSolenoid(String solenoidName) { - return solenoids.get(solenoidName); + default HyperDoubleSolenoid getDoubleSolenoid(String doubleSolenoidName) { + return doubleSolenoids.get(doubleSolenoidName); } } \ No newline at end of file