Class ButtonData


  • public class ButtonData
    extends java.lang.Object
    This class is an intermediate data structure used in OI and in RobotInspector. It holds information parsed out of the OI map for a particular binding of a button to a command.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  ButtonData.Action
      An Action describes what action on a button (pressed, released, held) should trigger a command to run.
    • Constructor Summary

      Constructors 
      Constructor Description
      ButtonData​(int port, ButtonData.Action action, java.lang.reflect.Field field)
      Construct a new ButtonData object from parameters
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ButtonData.Action action()
      Get the action which triggers a command
      java.lang.String description()
      Get a string description of the button/command mapping.
      java.lang.reflect.Field field()
      Get the field in the OI map corresponding to this button
      java.lang.String name()
      Get the name of the button/command mapping.
      int port()
      Get the id of the button
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ButtonData

        public ButtonData​(int port,
                          ButtonData.Action action,
                          java.lang.reflect.Field field)
        Construct a new ButtonData object from parameters
        Parameters:
        port - The id number of the button, starting at 1
        action - The action which will trigger a command
        field - The field of the OIMap class which corresponds to the command to run
    • Method Detail

      • port

        public int port()
        Get the id of the button
        Returns:
        The id of the button
      • action

        public ButtonData.Action action()
        Get the action which triggers a command
        Returns:
        the action which triggers a command
      • name

        public java.lang.String name()
        Get the name of the button/command mapping. This is the name of the field in OIMap corresponding to this button.
        Returns:
        The name of the button/command mapping.
      • field

        public java.lang.reflect.Field field()
        Get the field in the OI map corresponding to this button
        Returns:
        The filed in the OI map corresponding to this button
      • description

        public java.lang.String description()
        Get a string description of the button/command mapping. This includes the action and the name. This is used for making the joystick diagrams.
        Returns:
        A string description of the button/command mapping.