001package edu.wpi.first.wpilibj;
002
003import edu.wpi.first.wpilibj.util.BaseSystemNotInitializedException;
004
005public class RobotState {
006        private static Interface impl;
007
008        public static void SetImplementation(Interface i) {
009                impl = i;
010        }
011
012        public static boolean isDisabled() {
013                if (impl != null) {
014                        return impl.isDisabled();
015                } else {
016                        throw new BaseSystemNotInitializedException(Interface.class, RobotState.class);
017                }
018        }
019
020        public static boolean isEnabled() {
021                if (impl != null) {
022                        return impl.isEnabled();
023                } else {
024                        throw new BaseSystemNotInitializedException(Interface.class, RobotState.class);
025                }
026        }
027
028        public static boolean isOperatorControl() {
029                if (impl != null) {
030                        return impl.isOperatorControl();
031                } else {
032                        throw new BaseSystemNotInitializedException(Interface.class, RobotState.class);
033                }
034        }
035
036        public static boolean isAutonomous() {
037                if (impl != null) {
038                        return impl.isAutonomous();
039                } else {
040                        throw new BaseSystemNotInitializedException(Interface.class, RobotState.class);
041                }
042        }
043
044        public static boolean isTest() {
045                if (impl != null) {
046                        return impl.isTest();
047                } else {
048                        throw new BaseSystemNotInitializedException(Interface.class, RobotState.class);
049                }
050        }
051
052        interface Interface {
053                boolean isDisabled();
054                boolean isEnabled();
055                boolean isOperatorControl();
056                boolean isAutonomous();
057                boolean isTest();
058        }
059}