Package frc.robot.subsystems.swervedrive2.swervelib.parser

## Class SwerveParser

- java.lang.Object
- - frc.robot.subsystems.swervedrive2.swervelib.parser.SwerveParser

-     public class SwerveParser
      extends Object

  Helper class used to parse the JSON directory with specified configuration options.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static ControllerPropertiesJson` | `controllerPropertiesJson` | Parsed controllerproperties.json
    `private static HashMap<String,​Integer>` | `moduleConfigs` |
    `static ModuleJson[]` | `moduleJsons` | Array holding the module jsons given in `SwerveDriveJson`.
    `static PhysicalPropertiesJson` | `physicalPropertiesJson` | Parsed modules/physicalproperties.json
    `static PIDFPropertiesJson` | `pidfPropertiesJson` | Parsed modules/pidfproperties.json
    `static SwerveDriveJson` | `swerveDriveJson` | Parsed swervedrive.json

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SwerveParser​(File directory)` | Construct a swerve parser.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `private void` | `checkDirectory​(File directory)` | Check directory structure.
    `SwerveDrive` | `createSwerveDrive()` | Create `SwerveDrive` from JSON configuration directory.
    `static SwerveModule` | `getModuleConfigurationByName​(String name, SwerveDriveConfiguration driveConfiguration)` | Get the swerve module by the json name.
    `private com.fasterxml.jackson.databind.JsonNode` | `openJson​(File file)` | Open JSON file.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### moduleConfigs

          private static final HashMap<String,​Integer> moduleConfigs

    - #### swerveDriveJson

          public static SwerveDriveJson swerveDriveJson

      Parsed swervedrive.json

    - #### controllerPropertiesJson

          public static ControllerPropertiesJson controllerPropertiesJson

      Parsed controllerproperties.json

    - #### pidfPropertiesJson

          public static PIDFPropertiesJson pidfPropertiesJson

      Parsed modules/pidfproperties.json

    - #### physicalPropertiesJson

          public static PhysicalPropertiesJson physicalPropertiesJson

      Parsed modules/physicalproperties.json

    - #### moduleJsons

          public static ModuleJson[] moduleJsons

      Array holding the module jsons given in `SwerveDriveJson`.

  - ### Constructor Detail

    - #### SwerveParser

          public SwerveParser​(File directory)
                       throws IOException

      Construct a swerve parser. Will throw an error if there is a missing file.
      Parameters:
        `directory` - Directory with swerve configurations.
      Throws:
        `IOException`

  - ### Method Detail

    - #### getModuleConfigurationByName

          public static SwerveModule getModuleConfigurationByName​(String name,
                                                                  SwerveDriveConfiguration driveConfiguration)

      Get the swerve module by the json name.
      Parameters:
        `name` - JSON name.
        `driveConfiguration` - `SwerveDriveConfiguration` to pull from.
      Returns:
        `SwerveModuleConfiguration` based on the file.

    - #### openJson

          private com.fasterxml.jackson.databind.JsonNode openJson​(File file)

      Open JSON file.
      Parameters:
        `file` - JSON File to open.
      Returns:
        JsonNode of file.

    - #### checkDirectory

          private void checkDirectory​(File directory)

      Check directory structure.
      Parameters:
        `directory` - JSON Configuration Directory

    - #### createSwerveDrive

          public SwerveDrive createSwerveDrive()

      Create `SwerveDrive` from JSON configuration directory.
      Returns:
        `SwerveDrive` instance.