implement singleton design pattern
[3501/roboRIO-code-base] / src / org / usfirst / frc / team3501 / robot / OI.java
index 997be71cdbe551afe2477d093f6172a28c1cfe26..211c3992323cac295dc95ad8f22faa573dc0e3f1 100644 (file)
@@ -3,6 +3,7 @@ package org.usfirst.frc.team3501.robot;
 import edu.wpi.first.wpilibj.Joystick;
 
 public class OI {
+  private static OI oi;
   public static Joystick leftJoystick;
   public static Joystick rightJoystick;
 
@@ -11,4 +12,10 @@ public class OI {
     rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT);
 
   }
+  
+  public static OI getOI(){
+         if(oi == null)
+                 oi = new OI();
+         return oi;
+  }
 }