src/main/java/com/inari/firefly/system/FFContext.java
/** Use this to load a specified {@link FFSystem} into the context.<p>
     *  Use force true to force the loading of the specified {@link FFSystem}. This means, even if the {@link FFSystem}
     *  is already loaded, the already loaded instance is disposed and a new instance is created.
     *  @param key {@link FFSystemTypeKey} specifies the {@link FFSystem}
     *  @param force forces to load of specified {@link FFSystem}
     *  @return {@link FFSystem} of type of key type
     *  @throws {@link FFInitExcpetion} if the {@link FFSystem} was not loaded and an error occurs on load
     */
Use this to load a specified  FFSystem into the context.
Use force true to force the loading of the specified  FFSystem. This means, even if the  FFSystem
is already loaded, the already loaded instance is disposed and a new instance is created.
@param key  FFSystemTypeKey specifies the  FFSystem
@param force forces to load of specified  FFSystem
@return  FFSystem of type of key type
@throws  FFInitExcpetion if the  FFSystem was not loaded and an error occurs on load
Use this to load a specified FFSystem into the context . Use force true to force the loading of the specified FFSystem . This means even if the FFSystem is already loaded the already loaded instance is disposed and a new instance is created . @param key FFSystemTypeKey specifies the FFSystem @param force forces to load of specified FFSystem @return FFSystem of type of key type @throws FFInitExcpetion if the FFSystem was not loaded and an error occurs on load
public final <T extends FFSystem> FFContext loadSystem( FFSystemTypeKey<T> key, boolean force ) {
        if ( systems.contains( key.index() ) ) {
            if ( force ) {
                FFSystem oldSystem = systems.remove( key.index() );
                oldSystem.dispose( this );
            } else {
                return this;
            }
        }
        try {
            Constructor<T> constructor = key.systemType.getDeclaredConstructor();
            boolean accessible = constructor.isAccessible();
            constructor.setAccessible( true );
            T componentSystem = constructor.newInstance();
            systems.set( key.index(), componentSystem );
            componentSystem.init( this );
            constructor.setAccessible( accessible );
            if ( componentSystem instanceof ComponentSystem ) {
                initComponentSystem( (ComponentSystem<?>) componentSystem );
            }
            if ( key.systemType == EntitySystem.class ) {
                entitySystem = (EntitySystem) componentSystem;
            }
        } catch ( Exception e ) {
            throw new FFInitException( "Failed to load system: " + key, e );
        }
        return this;
    }
public final < T extends FFSystem > FFContext loadSystem ( FFSystemTypeKey < T > key , boolean force ) { if ( systems . contains ( key . index ( ) ) ) { if ( force ) { FFSystem oldSystem = systems . remove ( key . index ( ) ) ; oldSystem . dispose ( this ) ; } else { return this ; } } try { Constructor < T > constructor = key . systemType . getDeclaredConstructor ( ) ; boolean accessible = constructor . isAccessible ( ) ; constructor . setAccessible ( true ) ; T componentSystem = constructor . newInstance ( ) ; systems . set ( key . index ( ) , componentSystem ) ; componentSystem . init ( this ) ; constructor . setAccessible ( accessible ) ; if ( componentSystem instanceof ComponentSystem ) { initComponentSystem ( ( ComponentSystem < ? > ) componentSystem ) ; } if ( key . systemType == EntitySystem . class ) { entitySystem = ( EntitySystem ) componentSystem ; } } catch ( Exception e ) { throw new FFInitException ( "Failed to load system: " + key , e ) ; } return this ; }
Use this to load a specified {@link FFSystem} into the context.<p>
  Use force true to force the loading of the specified {@link FFSystem}.
Use this to load a specified { @link FFSystem } into the context . <p > Use force true to force the loading of the specified { @link FFSystem } .