FtcXtensible/src/main/java/org/ftccommunity/ftcxtensible/AnnotationFtcRegister.java
private HashMap<String, LinkedList<Class<?>>> findOpModes(LinkedList<Class> klazzes) {
        @SuppressWarnings("deprecation") Class<TeleOp> teleOpClass = TeleOp.class;
        @SuppressWarnings("deprecation") Class<Autonomous> autoClass = Autonomous.class;
        @SuppressWarnings("deprecation") Class<Disabled> disabledClass = Disabled.class;

        int nextAvailableIndex = 0;
        HashMap<String, LinkedList<Class<?>>> opModes = new HashMap<>();
        for (Class currentClass : klazzes) {
            /*if (!currentClass.isAssignableFrom(OpMode.class)) {
                continue;
            }*/

            final boolean isNotDisabled = !(currentClass.isAnnotationPresent(disabledClass) || currentClass.isAnnotationPresent(com.qualcomm.robotcore.eventloop.opmode.Disabled.class));
            if (isNotDisabled) {
                if (currentClass.isAnnotationPresent(teleOpClass)) {
                    Annotation annotation = currentClass.getAnnotation(teleOpClass);
                    @SuppressWarnings("deprecation") String name = ((TeleOp) annotation).pairWithAuto();
                    nextAvailableIndex = getNextAvailableIndex(nextAvailableIndex, opModes, currentClass, name);
                } else if (currentClass.isAnnotationPresent(com.qualcomm.robotcore.eventloop.opmode.TeleOp.class)) {
                    Annotation annotation = currentClass.getAnnotation(com.qualcomm.robotcore.eventloop.opmode.TeleOp.class);
                    String name = ((com.qualcomm.robotcore.eventloop.opmode.TeleOp) annotation).group();
                    nextAvailableIndex = getNextAvailableIndex(nextAvailableIndex, opModes, currentClass, name);
                }
                if (currentClass.isAnnotationPresent(autoClass)) {
                    Annotation annotation = currentClass.getAnnotation(autoClass);
                    //noinspection deprecation
                    String name = ((Autonomous) annotation).pairWithTeleOp();
                    nextAvailableIndex = getNextAvailableIndex(nextAvailableIndex, opModes, currentClass, name);
                }
                if (currentClass.isAnnotationPresent(com.qualcomm.robotcore.eventloop.opmode.Autonomous.class)) {
                    Annotation annotation = currentClass.getAnnotation(com.qualcomm.robotcore.eventloop.opmode.Autonomous.class);
                    String name = ((com.qualcomm.robotcore.eventloop.opmode.Autonomous) annotation).group();
                    nextAvailableIndex = getNextAvailableIndex(nextAvailableIndex, opModes, currentClass, name);
                }
            }
        }
        return opModes;
    }
/**
     * Checks a given {@link LinkedList<Class>} for OpModes. All OpModes found are then returned via
     * a HashMap containing the proper groupings.
     *
     * @param klazzes a LinkedList to check for possible OpMode candidates
     * @return a HashMap containing OpMode groupings
     */


@param klazzes a LinkedList to check for possible OpMode candidates
@return a HashMap containing OpMode groupings
@param klazzes a LinkedList to check for possible OpMode candidates @return a HashMap containing OpMode groupings
private HashMap<String, LinkedList<Class<?>>> findOpModes(LinkedList<Class> klazzes) {
        @SuppressWarnings("deprecation") Class<TeleOp> teleOpClass = TeleOp.class;
        @SuppressWarnings("deprecation") Class<Autonomous> autoClass = Autonomous.class;
        @SuppressWarnings("deprecation") Class<Disabled> disabledClass = Disabled.class;
        int nextAvailableIndex = 0;
        HashMap<String, LinkedList<Class<?>>> opModes = new HashMap<>();
        for (Class currentClass : klazzes) {
            /*if (!currentClass.isAssignableFrom(OpMode.class)) {
                continue;
            }*/
            final boolean isNotDisabled = !(currentClass.isAnnotationPresent(disabledClass) || currentClass.isAnnotationPresent(com.qualcomm.robotcore.eventloop.opmode.Disabled.class));
            if (isNotDisabled) {
                if (currentClass.isAnnotationPresent(teleOpClass)) {
                    Annotation annotation = currentClass.getAnnotation(teleOpClass);
                    @SuppressWarnings("deprecation") String name = ((TeleOp) annotation).pairWithAuto();
                    nextAvailableIndex = getNextAvailableIndex(nextAvailableIndex, opModes, currentClass, name);
                } else if (currentClass.isAnnotationPresent(com.qualcomm.robotcore.eventloop.opmode.TeleOp.class)) {
                    Annotation annotation = currentClass.getAnnotation(com.qualcomm.robotcore.eventloop.opmode.TeleOp.class);
                    String name = ((com.qualcomm.robotcore.eventloop.opmode.TeleOp) annotation).group();
                    nextAvailableIndex = getNextAvailableIndex(nextAvailableIndex, opModes, currentClass, name);
                }
                if (currentClass.isAnnotationPresent(autoClass)) {
                    Annotation annotation = currentClass.getAnnotation(autoClass);
                    String name = ((Autonomous) annotation).pairWithTeleOp();
                    nextAvailableIndex = getNextAvailableIndex(nextAvailableIndex, opModes, currentClass, name);
                }
                if (currentClass.isAnnotationPresent(com.qualcomm.robotcore.eventloop.opmode.Autonomous.class)) {
                    Annotation annotation = currentClass.getAnnotation(com.qualcomm.robotcore.eventloop.opmode.Autonomous.class);
                    String name = ((com.qualcomm.robotcore.eventloop.opmode.Autonomous) annotation).group();
                    nextAvailableIndex = getNextAvailableIndex(nextAvailableIndex, opModes, currentClass, name);
                }
            }
        }
        return opModes;
    }
private HashMap < String , LinkedList < Class < ? > > > findOpModes ( LinkedList < Class > klazzes ) { @ SuppressWarnings ( "deprecation" ) Class < TeleOp > teleOpClass = TeleOp . class ; @ SuppressWarnings ( "deprecation" ) Class < Autonomous > autoClass = Autonomous . class ; @ SuppressWarnings ( "deprecation" ) Class < Disabled > disabledClass = Disabled . class ; int nextAvailableIndex = 0 ; HashMap < String , LinkedList < Class < ? > > > opModes = new HashMap < > ( ) ; for ( Class currentClass : klazzes ) { /*if (!currentClass.isAssignableFrom(OpMode.class)) {
                continue;
            }*/ final boolean isNotDisabled = ! ( currentClass . isAnnotationPresent ( disabledClass ) || currentClass . isAnnotationPresent ( com . qualcomm . robotcore . eventloop . opmode . Disabled . class ) ) ; if ( isNotDisabled ) { if ( currentClass . isAnnotationPresent ( teleOpClass ) ) { Annotation annotation = currentClass . getAnnotation ( teleOpClass ) ; @ SuppressWarnings ( "deprecation" ) String name = ( ( TeleOp ) annotation ) . pairWithAuto ( ) ; nextAvailableIndex = getNextAvailableIndex ( nextAvailableIndex , opModes , currentClass , name ) ; } else if ( currentClass . isAnnotationPresent ( com . qualcomm . robotcore . eventloop . opmode . TeleOp . class ) ) { Annotation annotation = currentClass . getAnnotation ( com . qualcomm . robotcore . eventloop . opmode . TeleOp . class ) ; String name = ( ( com . qualcomm . robotcore . eventloop . opmode . TeleOp ) annotation ) . group ( ) ; nextAvailableIndex = getNextAvailableIndex ( nextAvailableIndex , opModes , currentClass , name ) ; } if ( currentClass . isAnnotationPresent ( autoClass ) ) { Annotation annotation = currentClass . getAnnotation ( autoClass ) ; String name = ( ( Autonomous ) annotation ) . pairWithTeleOp ( ) ; nextAvailableIndex = getNextAvailableIndex ( nextAvailableIndex , opModes , currentClass , name ) ; } if ( currentClass . isAnnotationPresent ( com . qualcomm . robotcore . eventloop . opmode . Autonomous . class ) ) { Annotation annotation = currentClass . getAnnotation ( com . qualcomm . robotcore . eventloop . opmode . Autonomous . class ) ; String name = ( ( com . qualcomm . robotcore . eventloop . opmode . Autonomous ) annotation ) . group ( ) ; nextAvailableIndex = getNextAvailableIndex ( nextAvailableIndex , opModes , currentClass , name ) ; } } } return opModes ; }
Checks a given {@link LinkedList<Class>} for OpModes.
Checks a given { @link LinkedList<Class > } for OpModes .
//noinspection deprecation