Package org.hyperonline.hyperlib.oi
Class JoystickData
- java.lang.Object
-
- org.hyperonline.hyperlib.oi.JoystickData
-
public class JoystickData extends java.lang.Object
This class is an intermediate data structure used inOI
and in RobotInspector. It holds information parsed out of the OI map for a particular joystick.
-
-
Constructor Summary
Constructors Constructor Description JoystickData(int port, MapJoystick.Role role, MapJoystick.Type type, java.lang.Class<?> mapClass, java.util.List<ButtonData> buttons)
Construct a new JoystickData object with the given parameters
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<ButtonData>
buttons()
Get an immutable list of buttons on the joystick.java.lang.Class<?>
mapClass()
Get the class used to declare the joystick.java.lang.String
name()
Get a string representation of the name of the joystick.int
port()
Get the port the joystick is plugged intoMapJoystick.Role
role()
Get the role of the joystickMapJoystick.Type
type()
Get the physical type of the joystick
-
-
-
Constructor Detail
-
JoystickData
public JoystickData(int port, MapJoystick.Role role, MapJoystick.Type type, java.lang.Class<?> mapClass, java.util.List<ButtonData> buttons)
Construct a new JoystickData object with the given parameters- Parameters:
port
- the port the joystick is plugged intorole
- the role the joystick fillstype
- the physical type of joystickmapClass
- the class inside the oi map representing the joystickbuttons
- a list of buttons which are part of the joystick. This object makes an immutable reference to the list passed in.
-
-
Method Detail
-
port
public int port()
Get the port the joystick is plugged into- Returns:
- the port the joystick is plugged into
-
role
public MapJoystick.Role role()
Get the role of the joystick- Returns:
- the role of the joystick
-
type
public MapJoystick.Type type()
Get the physical type of the joystick- Returns:
- the type of the joystick
-
name
public java.lang.String name()
Get a string representation of the name of the joystick. This is the simple name of the class representing the joystick- Returns:
- The name of the joystick
-
mapClass
public java.lang.Class<?> mapClass()
Get the class used to declare the joystick. This should be a public static class in the oi map which had aMapJoystick
annotation- Returns:
- The class of the joystick
-
buttons
public java.util.List<ButtonData> buttons()
Get an immutable list of buttons on the joystick. This is actually a list of button/command mappings, so a single button number may be counted twice if there are multiple commands on it.- Returns:
- A list of button/command mappings
-
-