Class AutonUtil
java.lang.Object
com.stuypulse.robot.util.auton.AutonUtil
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumRepresents a supported autonomous path format and its location in the deploy directory. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doubleComputes a character-count distance between two names.countChars(char[] chars) Counts the occurrences of each character in an array.static StringfindClosestMatch(List<String> paths, String input) Finds the listed path name with the smallest character-based distance from an input.getPathFileNames(AutonUtil.AutonType autonType) Lists the available path names for an autonomous format.
-
Constructor Details
-
AutonUtil
private AutonUtil()
-
-
Method Details
-
getPathFileNames
Lists the available path names for an autonomous format.- Parameters:
autonType- The auton type to search for determining which auton directory and file extension to search- Returns:
- Sorted path names without their file extensions. Returns an empty list if the directory cannot be read, in which case an error is reported to the Driver Station
-
findClosestMatch
Finds the listed path name with the smallest character-based distance from an input.- Parameters:
paths- The possible path names to compareinput- The path name to match- Returns:
- The closest candidate, or an empty string when no candidate is selected
-
countChars
Counts the occurrences of each character in an array.This is mainly used for
findClosestMatch(List, String).- Parameters:
chars- Characters to count- Returns:
- A map from each encountered character to its amount of occurences
-
compareNameProximity
public static double compareNameProximity(HashMap<Character, Integer> list1, HashMap<Character, Integer> list2) Computes a character-count distance between two names.Smaller values indicate closer names, while larger values indicate more distant names.
This is mainly used for
findClosestMatch(List, String).- Parameters:
list1- Character counts for the first namelist2- Character counts for the second name- Returns:
- The calculated distance between the names
-