Interface BlockModelService


  • public interface BlockModelService
    Service for providing block models.
    • Field Detail

      • SUBROUTINE_MODEL

        static final int SUBROUTINE_MODEL
        Type for a subroutine block model.
        See Also:
        Constant Field Values
      • SIMPLE_BLOCK_MODEL_NAME

        static final java.lang.String SIMPLE_BLOCK_MODEL_NAME
        Name of the implementation for a Simple block model.
        See Also:
        Constant Field Values
      • MULTI_ENTRY_SUBROUTINE_MODEL_NAME

        static final java.lang.String MULTI_ENTRY_SUBROUTINE_MODEL_NAME
        Name of the implementation for a subroutine with multiple entry points.
        See Also:
        Constant Field Values
      • ISOLATED_ENTRY_SUBROUTINE_MODEL_NAME

        static final java.lang.String ISOLATED_ENTRY_SUBROUTINE_MODEL_NAME
        Name of the implementation for a subroutine that has a unique entry point, which may share code with other subroutines.
        See Also:
        Constant Field Values
      • OVERLAPPED_SUBROUTINE_MODEL_NAME

        static final java.lang.String OVERLAPPED_SUBROUTINE_MODEL_NAME
        Name of the implementation for an overlapped subroutine model.
        See Also:
        Constant Field Values
      • PARTITIONED_SUBROUTINE_MODEL_NAME

        static final java.lang.String PARTITIONED_SUBROUTINE_MODEL_NAME
        Name of the implementation for a subroutine that does not share code with other subroutines and may have one or more entry points.
        See Also:
        Constant Field Values
      • DEFAULT_BLOCK_MODEL_NAME

        static final java.lang.String DEFAULT_BLOCK_MODEL_NAME
        Default basic block model (Simple Block Model)
        See Also:
        Constant Field Values
      • DEFAULT_SUBROUTINE_MODEL_NAME

        static final java.lang.String DEFAULT_SUBROUTINE_MODEL_NAME
        Default subroutine model (M-Model)
        See Also:
        Constant Field Values
    • Method Detail

      • registerModel

        void registerModel​(java.lang.Class<? extends CodeBlockModel> modelClass,
                           java.lang.String modelName)
        Register a new model.
        Parameters:
        modelClass - code block model class. Subroutine models must implement the SubroutineBlockMode interface - all other models are assumed to be basic block models.
        modelName - name of model
      • unregisterModel

        void unregisterModel​(java.lang.Class<? extends CodeBlockModel> modelClass)
        Deregister a model.
        Parameters:
        modelClass - code block model class.
      • getActiveBlockModel

        @Deprecated
        CodeBlockModel getActiveBlockModel()
        Deprecated.
        use getActiveBlockModel(Program) instead
        Get new instance of the active Basic Block model for the current program.
        Returns:
        new Basic Block model instance or null if program is not open.
      • getActiveBlockModel

        @Deprecated
        CodeBlockModel getActiveBlockModel​(boolean includeExternals)
        Deprecated.
        use getActiveBlockModel(Program, boolean) instead
        Get new instance of the active Basic Block model for the current program.
        Parameters:
        includeExternals - externals are included if true
        Returns:
        new Basic Block model instance or null if program is not open.
      • getActiveBlockModel

        CodeBlockModel getActiveBlockModel​(Program program)
        Get new instance of the active Basic Block model.
        Parameters:
        program - program to associate with the block model
        Returns:
        new Basic Block model instance or null if program is null
      • getActiveBlockModel

        CodeBlockModel getActiveBlockModel​(Program program,
                                           boolean includeExternals)
        Get new instance of the active Basic Block model.
        Parameters:
        program - program to associate with the block model
        includeExternals - externals are included if true
        Returns:
        new Basic Block model instance or null if program is null
      • getActiveBlockModelName

        java.lang.String getActiveBlockModelName()
        Get the name of the active Basic Block model.
        Returns:
        active block model name
      • getActiveSubroutineModel

        @Deprecated
        CodeBlockModel getActiveSubroutineModel()
        Deprecated.
        use getActiveSubroutineModel(Program) instead
        Get new instance of the active Subroutine Block model for the current program.
        Returns:
        new Subroutine Block model instance or null if program is not open
      • getActiveSubroutineModel

        @Deprecated
        CodeBlockModel getActiveSubroutineModel​(boolean includeExternals)
        Deprecated.
        use getActiveSubroutineModel(Program) instead
        Get new instance of the active Subroutine Block model for the current program.
        Parameters:
        includeExternals - externals are included if true
        Returns:
        new Subroutine Block model instance or null if program is not open
      • getActiveSubroutineModel

        CodeBlockModel getActiveSubroutineModel​(Program program)
        Get new instance of the active Subroutine Block model.
        Parameters:
        program - program associated with the block model.
        Returns:
        new Subroutine Block model instance or null if program is null
      • getActiveSubroutineModel

        CodeBlockModel getActiveSubroutineModel​(Program program,
                                                boolean includeExternals)
        Get new instance of the active Subroutine Block model.
        Parameters:
        program - program associated with the block model.
        includeExternals - externals are included if true
        Returns:
        new Subroutine Block model instance or null if program is null
      • getActiveSubroutineModelName

        java.lang.String getActiveSubroutineModelName()
        Get the name of the active Subroutine model.
        Returns:
        active subroutine model name
      • getNewModelByName

        @Deprecated
        CodeBlockModel getNewModelByName​(java.lang.String modelName)
                                  throws NotFoundException
        Deprecated.
        use getNewModelByName(String, Program) instead
        Get new instance of the specified block model.
        Parameters:
        modelName - name of registered block model
        Returns:
        new model instance or null if program is not open.
        Throws:
        NotFoundException - if specified model is not registered
      • getNewModelByName

        @Deprecated
        CodeBlockModel getNewModelByName​(java.lang.String modelName,
                                         boolean includeExternals)
                                  throws NotFoundException
        Deprecated.
        use getNewModelByName(String, Program, boolean) instead
        Get new instance of the specified block model.
        Parameters:
        modelName - name of registered block model
        includeExternals - externals are included if true
        Returns:
        new model instance or null if program is not open.
        Throws:
        NotFoundException - if specified model is not registered
      • getNewModelByName

        CodeBlockModel getNewModelByName​(java.lang.String modelName,
                                         Program program)
                                  throws NotFoundException
        Get new instance of the specified block model.
        Parameters:
        modelName - name of registered block model
        program - program associated with the model
        Returns:
        new model instance or null if program is null
        Throws:
        NotFoundException - if specified model is not registered
      • getNewModelByName

        CodeBlockModel getNewModelByName​(java.lang.String modelName,
                                         Program program,
                                         boolean includeExternals)
                                  throws NotFoundException
        Get new instance of the specified block model.
        Parameters:
        modelName - name of registered block model
        program - program associated with the model
        includeExternals - externals are included if true
        Returns:
        new model instance or null if program is null
        Throws:
        NotFoundException - if specified model is not registered
      • getAvailableModelNames

        java.lang.String[] getAvailableModelNames​(int modelType)
        Get list of registered block models of the specified type. A modelType of ANY_BLOCK will return all models registered. List ordering is based upon the registration order. It is important to recognize that the list of returned names could change as models are registered and unregistered.
        Parameters:
        modelType - type of model (ANY_MODEL, BASIC_MODEL or SUBROUTINE_MODEL)
        Returns:
        array of model names
      • addListener

        void addListener​(BlockModelServiceListener listener)
        Add service listener.
        Parameters:
        listener - listener to add
      • removeListener

        void removeListener​(BlockModelServiceListener listener)
        Remove service listener.
        Parameters:
        listener - to remove