org.qedeq.kernel.bo.service.internal
Class DefaultKernelQedeqBo

java.lang.Object
  extended by org.qedeq.kernel.bo.service.internal.DefaultKernelQedeqBo
All Implemented Interfaces:
QedeqBo, KernelQedeqBo

public class DefaultKernelQedeqBo
extends java.lang.Object
implements KernelQedeqBo

Represents a module and its states. This is a kernel internal representation.

Author:
Michael Meyling

Constructor Summary
DefaultKernelQedeqBo(InternalKernelServices services, ModuleAddress address)
          Creates new module properties.
 
Method Summary
 void addPluginErrorsAndWarnings(ModuleService plugin, SourceFileExceptionList errors, SourceFileExceptionList warnings)
          Add errors and warnings for service.
 void clearAllPluginErrorsAndWarnings()
          Remove all errors and warnings for all services.
 SourceArea createSourceArea(Qedeq qedeq, ModuleContext context)
          Create area in source file for QEDEQ module context.
 SourceFileException createSourceFileException(Service service, ModuleDataException exception)
          Create exception out of ModuleDataException.
 SourceFileExceptionList createSourceFileExceptionList(Service service, ModuleDataException exception)
          Create exception out of ModuleDataException.
 SourceFileExceptionList createSourceFileExceptionList(Service service, ModuleDataException exception, Qedeq qedeq)
          Create exception out of ModuleDataException.
 void delete()
          Delete QEDEQ module.
 boolean equals(java.lang.Object obj)
           
 Service getCurrentlyRunningService()
          Get currently running service.
 AbstractState getCurrentState()
          Get the current state of the module.
 DependencyState getDependencyState()
          Get module dependency state.
 KernelModuleReferenceList getDependentModules()
          Get labels and URLs of all directly dependent modules.
 Element2Latex getElement2Latex()
          Return mapper for transforming elements into LaTeX.
 Element2Utf8 getElement2Utf8()
          Return mapper for transforming elements into UTF-8 text.
 SourceFileExceptionList getErrors()
          Get error list.
 ModuleConstantsExistenceChecker getExistenceChecker()
          Get the predicate and function existence checker.
 FormallyProvedState getFormallyProvedState()
          Get module logical formally proved state.
 KernelModuleReferenceList getKernelRequiredModules()
          Get labels and URLs of all referenced modules.
 InternalKernelServices getKernelServices()
          Get internal kernel services.
 ModuleLabels getLabels()
          Get label references for QEDEQ module.
 AbstractState getLastSuccessfulState()
          Get the last successful state of the module.
 QedeqFileDao getLoader()
          Get loader used to load this object.
 int getLoadingCompleteness()
          Set completeness percentage.
 LoadingImportsState getLoadingImportsState()
          Get module loading imports state.
 LoadingState getLoadingState()
          Get module loading state.
 ModuleAddress getModuleAddress()
          Get ModuleAddress of module.
 java.lang.String getName()
          Get name of module.
 java.lang.String getOriginalLanguage()
          Get default language for this QEDEQ module.
 Qedeq getQedeq()
          Get module.
 ModuleReferenceList getRequiredModules()
          Get labels and URLs of all referenced modules.
 java.lang.String getRuleVersion()
          Get rule version information.
 java.lang.String getStateDescription()
          Get module state description.
protected  StateManager getStateManager()
          Get StateManager.
 java.lang.String[] getSupportedLanguages()
          Get all supported languages for this QEDEQ module.
 java.lang.String getUrl()
          Get original URL of module.
 SourceFileExceptionList getWarnings()
          Get warning list.
 WellFormedState getWellFormedState()
          Get module logical well formed state.
 boolean hasBasicFailures()
          Has the module any basic failures? This includes errors during loading the module, during load of imported modules and logical checking.
 boolean hasErrors()
          Is this a error state the module is in?
 int hashCode()
           
 boolean hasLoadedImports()
          Are all directly imported modules loaded?
 boolean hasLoadedRequiredModules()
          Are all required modules loaded?
 boolean hasWarnings()
          Is this a warning state the module is in?
 boolean isFullyFormallyProved()
          Was the module successfully checked for being fully formal correct proved?
 boolean isLoaded()
          Is this module already loaded?
 boolean isSupportedLanguage(java.lang.String language)
          Is the given language supported.
 boolean isWellFormed()
          Was the module successfully checked for being well formed?
 void setCurrentlyRunningService(Service currentlyRunningService)
           
 void setDependencyFailureState(DependencyState state, SourceFileExceptionList e)
          Set dependency failure module state.
 void setDependencyProgressState(DependencyState state)
          Set dependency module state.
 void setExistenceChecker(ModuleConstantsExistenceChecker checker)
          Set ModuleConstantsExistenceChecker.
 void setFormallyProvedFailureState(FormallyProvedState state, SourceFileExceptionList e)
          Set logical formally proved module failure state.
 void setFormallyProvedProgressState(FormallyProvedState state)
          Set logical formally proved module progress state.
 void setLabels(ModuleLabels labels)
          Set label references for QEDEQ module.
 void setLoaded(QedeqVo qedeq, ModuleLabels labels, Element2Latex converter, Element2Utf8 textConverter)
          Set loading state to "loaded".
 void setLoadedImports(KernelModuleReferenceList list)
          Set loaded imports state.
 void setLoadedRequiredModules()
          Set loaded required requirements state.
 void setLoadingCompleteness(int completeness)
          Set completeness percentage.
 void setLoadingFailureState(LoadingState state, SourceFileExceptionList e)
          Set failure module state.
 void setLoadingImportsFailureState(LoadingImportsState state, SourceFileExceptionList e)
          Set failure module state.
 void setLoadingImportsProgressState(LoadingImportsState state)
          Set logical well formed module state.
 void setLoadingProgressState(LoadingState state)
          Set loading progress module state.
 void setQedeqFileDao(QedeqFileDao loader)
          Set loader used for loading this object.
 void setQedeqVo(QedeqVo qedeq)
          Set QedeqVo.
 void setWellfFormedFailureState(WellFormedState state, SourceFileExceptionList e)
          Set failure module state.
 void setWellFormed(ModuleConstantsExistenceChecker checker)
          Set logic well formed state.
 void setWellFormedProgressState(WellFormedState state)
          Set logical well formed module state.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultKernelQedeqBo

public DefaultKernelQedeqBo(InternalKernelServices services,
                            ModuleAddress address)
Creates new module properties.

Parameters:
services - Internal kernel services.
address - Module address (not null).
Throws:
java.lang.NullPointerException - address is null.
Method Detail

setQedeqFileDao

public void setQedeqFileDao(QedeqFileDao loader)
Set loader used for loading this object.

Parameters:
loader - Responsible loader.

getLoader

public QedeqFileDao getLoader()
Get loader used to load this object.

Returns:
Loader.

hasBasicFailures

public boolean hasBasicFailures()
Description copied from interface: QedeqBo
Has the module any basic failures? This includes errors during loading the module, during load of imported modules and logical checking. This includes no plugin errors.

Specified by:
hasBasicFailures in interface QedeqBo
Returns:
wWre there any basic errors?

hasErrors

public boolean hasErrors()
Description copied from interface: QedeqBo
Is this a error state the module is in?

Specified by:
hasErrors in interface QedeqBo
Returns:
Were there any errors?

hasWarnings

public boolean hasWarnings()
Description copied from interface: QedeqBo
Is this a warning state the module is in?

Specified by:
hasWarnings in interface QedeqBo
Returns:
Were there any warnings?

getModuleAddress

public ModuleAddress getModuleAddress()
Description copied from interface: QedeqBo
Get ModuleAddress of module.

Specified by:
getModuleAddress in interface QedeqBo
Returns:
Address of module.

getKernelServices

public InternalKernelServices getKernelServices()
Get internal kernel services.

Specified by:
getKernelServices in interface KernelQedeqBo
Returns:
Internal kernel services.

setLoadingCompleteness

public void setLoadingCompleteness(int completeness)
Set completeness percentage.

Parameters:
completeness - Completeness of loading into memory.

getLoadingCompleteness

public int getLoadingCompleteness()
Description copied from interface: QedeqBo
Set completeness percentage.

Specified by:
getLoadingCompleteness in interface QedeqBo
Returns:
completeness Completeness of loading into memory in percent.

delete

public void delete()
Delete QEDEQ module. Invalidates all dependent modules.


setLoadingProgressState

public void setLoadingProgressState(LoadingState state)
Set loading progress module state.

Parameters:
state - Module loading state. Must not be null.
Throws:
java.lang.IllegalStateException - State is a failure state or module loaded state.

setLoadingFailureState

public void setLoadingFailureState(LoadingState state,
                                   SourceFileExceptionList e)
Set failure module state.

Parameters:
state - Module loading state. Must not be null.
e - Exception that occurred during loading. Must not be null.
Throws:
java.lang.IllegalArgumentException - state is no failure state

getLoadingState

public LoadingState getLoadingState()
Description copied from interface: QedeqBo
Get module loading state.

Specified by:
getLoadingState in interface QedeqBo
Returns:
Module state.

isLoaded

public boolean isLoaded()
Description copied from interface: QedeqBo
Is this module already loaded?

Specified by:
isLoaded in interface QedeqBo
Returns:
Is this module already loaded?

setLoaded

public void setLoaded(QedeqVo qedeq,
                      ModuleLabels labels,
                      Element2Latex converter,
                      Element2Utf8 textConverter)
Set loading state to "loaded". Also puts null to getLabels().

Parameters:
qedeq - This module was loaded. Must not be null.
labels - Module labels.
converter - Can convert elements into LaTeX. Must not be null.
textConverter - Can convert elements into UTF-8 text. Must not be null.
Throws:
java.lang.NullPointerException - One argument was null.

getQedeq

public Qedeq getQedeq()
Description copied from interface: QedeqBo
Get module. Works only if module is already completely loaded.

Specified by:
getQedeq in interface QedeqBo
Returns:
QEDEQ module if it is already loaded.

getElement2Latex

public Element2Latex getElement2Latex()
Description copied from interface: KernelQedeqBo
Return mapper for transforming elements into LaTeX.

Specified by:
getElement2Latex in interface KernelQedeqBo
Returns:
Transformer to get LaTeX out of elements.

getElement2Utf8

public Element2Utf8 getElement2Utf8()
Description copied from interface: KernelQedeqBo
Return mapper for transforming elements into UTF-8 text.

Specified by:
getElement2Utf8 in interface KernelQedeqBo
Returns:
Transformer to get UTF-8 text out of elements.

setLoadingImportsProgressState

public void setLoadingImportsProgressState(LoadingImportsState state)
Description copied from interface: KernelQedeqBo
Set logical well formed module state. Must not be null.

Specified by:
setLoadingImportsProgressState in interface KernelQedeqBo
Parameters:
state - module state

setLoadingImportsFailureState

public void setLoadingImportsFailureState(LoadingImportsState state,
                                          SourceFileExceptionList e)
Description copied from interface: KernelQedeqBo
Set failure module state.

Specified by:
setLoadingImportsFailureState in interface KernelQedeqBo
Parameters:
state - Module state.
e - Exception that occurred during loading required modules.

getLoadingImportsState

public LoadingImportsState getLoadingImportsState()
Description copied from interface: QedeqBo
Get module loading imports state.

Specified by:
getLoadingImportsState in interface QedeqBo
Returns:
module state.

setLoadedImports

public void setLoadedImports(KernelModuleReferenceList list)
Description copied from interface: KernelQedeqBo
Set loaded imports state. All directly required modules were loaded.

Specified by:
setLoadedImports in interface KernelQedeqBo
Parameters:
list - These imports were loaded.

hasLoadedImports

public boolean hasLoadedImports()
Description copied from interface: QedeqBo
Are all directly imported modules loaded?

Specified by:
hasLoadedImports in interface QedeqBo
Returns:
Are all directly imported modules loaded?

setDependencyProgressState

public void setDependencyProgressState(DependencyState state)
Description copied from interface: KernelQedeqBo
Set dependency module state. Must not be null.

Specified by:
setDependencyProgressState in interface KernelQedeqBo
Parameters:
state - Module state

setDependencyFailureState

public void setDependencyFailureState(DependencyState state,
                                      SourceFileExceptionList e)
Description copied from interface: KernelQedeqBo
Set dependency failure module state.

Specified by:
setDependencyFailureState in interface KernelQedeqBo
Parameters:
state - Module state.
e - Exception that occurred during loading required modules.

getDependencyState

public DependencyState getDependencyState()
Description copied from interface: QedeqBo
Get module dependency state.

Specified by:
getDependencyState in interface QedeqBo
Returns:
module state.

setLoadedRequiredModules

public void setLoadedRequiredModules()
Description copied from interface: KernelQedeqBo
Set loaded required requirements state.

Specified by:
setLoadedRequiredModules in interface KernelQedeqBo

getRequiredModules

public ModuleReferenceList getRequiredModules()
Description copied from interface: QedeqBo
Get labels and URLs of all referenced modules. Only available if module has loaded all required modules. Otherwise a runtime exception is thrown.

Specified by:
getRequiredModules in interface QedeqBo
Returns:
URLs of all referenced modules.

getKernelRequiredModules

public KernelModuleReferenceList getKernelRequiredModules()
Description copied from interface: KernelQedeqBo
Get labels and URLs of all referenced modules.

Specified by:
getKernelRequiredModules in interface KernelQedeqBo
Returns:
URLs of all referenced modules.

hasLoadedRequiredModules

public boolean hasLoadedRequiredModules()
Description copied from interface: QedeqBo
Are all required modules loaded?

Specified by:
hasLoadedRequiredModules in interface QedeqBo
Returns:
Are all required modules loaded?

getDependentModules

public KernelModuleReferenceList getDependentModules()
Get labels and URLs of all directly dependent modules. These are all modules that are currently known to import this module.

Returns:
URLs of all referenced modules.

setWellFormed

public void setWellFormed(ModuleConstantsExistenceChecker checker)
Description copied from interface: KernelQedeqBo
Set logic well formed state. Also set the predicate and function existence checker.

Specified by:
setWellFormed in interface KernelQedeqBo
Parameters:
checker - Checks if a predicate or function constant is defined.

isWellFormed

public boolean isWellFormed()
Description copied from interface: QedeqBo
Was the module successfully checked for being well formed?

Specified by:
isWellFormed in interface QedeqBo
Returns:
Module was checked?

isFullyFormallyProved

public boolean isFullyFormallyProved()
Description copied from interface: QedeqBo
Was the module successfully checked for being fully formal correct proved?

Specified by:
isFullyFormallyProved in interface QedeqBo
Returns:
Module was checked?

setWellFormedProgressState

public void setWellFormedProgressState(WellFormedState state)
Description copied from interface: KernelQedeqBo
Set logical well formed module state. Must not be null.

Specified by:
setWellFormedProgressState in interface KernelQedeqBo
Parameters:
state - module state

setWellfFormedFailureState

public void setWellfFormedFailureState(WellFormedState state,
                                       SourceFileExceptionList e)
Description copied from interface: KernelQedeqBo
Set failure module state.

Specified by:
setWellfFormedFailureState in interface KernelQedeqBo
Parameters:
state - Module state.
e - Exception that occurred during loading.

getWellFormedState

public WellFormedState getWellFormedState()
Description copied from interface: QedeqBo
Get module logical well formed state.

Specified by:
getWellFormedState in interface QedeqBo
Returns:
module state.

setFormallyProvedProgressState

public void setFormallyProvedProgressState(FormallyProvedState state)
Description copied from interface: KernelQedeqBo
Set logical formally proved module progress state. Must not be null.

Specified by:
setFormallyProvedProgressState in interface KernelQedeqBo
Parameters:
state - module state

setFormallyProvedFailureState

public void setFormallyProvedFailureState(FormallyProvedState state,
                                          SourceFileExceptionList e)
Description copied from interface: KernelQedeqBo
Set logical formally proved module failure state. Must not be null.

Specified by:
setFormallyProvedFailureState in interface KernelQedeqBo
Parameters:
state - module state
e - Exception that occurred during loading.

getFormallyProvedState

public FormallyProvedState getFormallyProvedState()
Description copied from interface: QedeqBo
Get module logical formally proved state.

Specified by:
getFormallyProvedState in interface QedeqBo
Returns:
module state.

getErrors

public SourceFileExceptionList getErrors()
Description copied from interface: QedeqBo
Get error list.

Specified by:
getErrors in interface QedeqBo
Returns:
Error list.

getWarnings

public SourceFileExceptionList getWarnings()
Description copied from interface: QedeqBo
Get warning list.

Specified by:
getWarnings in interface QedeqBo
Returns:
Warning list.

getStateDescription

public java.lang.String getStateDescription()
Description copied from interface: QedeqBo
Get module state description.

Specified by:
getStateDescription in interface QedeqBo
Returns:
module state description.

getCurrentState

public AbstractState getCurrentState()
Description copied from interface: QedeqBo
Get the current state of the module.

Specified by:
getCurrentState in interface QedeqBo
Returns:
Current module state.

getLastSuccessfulState

public AbstractState getLastSuccessfulState()
Description copied from interface: QedeqBo
Get the last successful state of the module.

Specified by:
getLastSuccessfulState in interface QedeqBo
Returns:
Last successful module state.

getCurrentlyRunningService

public Service getCurrentlyRunningService()
Description copied from interface: QedeqBo
Get currently running service.

Specified by:
getCurrentlyRunningService in interface QedeqBo
Returns:
Currently running service. Might be null.

setCurrentlyRunningService

public void setCurrentlyRunningService(Service currentlyRunningService)

getName

public java.lang.String getName()
Description copied from interface: QedeqBo
Get name of module.

Specified by:
getName in interface QedeqBo
Returns:
module name.

getRuleVersion

public java.lang.String getRuleVersion()
Description copied from interface: QedeqBo
Get rule version information.

Specified by:
getRuleVersion in interface QedeqBo
Returns:
rule version.

getUrl

public java.lang.String getUrl()
Description copied from interface: QedeqBo
Get original URL of module.

Specified by:
getUrl in interface QedeqBo
Returns:
URL of module.

setLabels

public void setLabels(ModuleLabels labels)
Set label references for QEDEQ module.

Parameters:
labels - Label references.

getLabels

public ModuleLabels getLabels()
Description copied from interface: KernelQedeqBo
Get label references for QEDEQ module.

Specified by:
getLabels in interface KernelQedeqBo
Returns:
Label references.

createSourceFileExceptionList

public SourceFileExceptionList createSourceFileExceptionList(Service service,
                                                             ModuleDataException exception)
Create exception out of ModuleDataException.

Parameters:
service - This service generated the error.
exception - Take this exception.
Returns:
Newly created instance.

createSourceFileExceptionList

public SourceFileExceptionList createSourceFileExceptionList(Service service,
                                                             ModuleDataException exception,
                                                             Qedeq qedeq)
Create exception out of ModuleDataException.

Parameters:
service - This service generated the error.
exception - Take this exception.
qedeq - Take this QEDEQ source. (This might not be accessible via getQedeq().
Returns:
Newly created instance.

createSourceFileException

public SourceFileException createSourceFileException(Service service,
                                                     ModuleDataException exception)
Description copied from interface: KernelQedeqBo
Create exception out of ModuleDataException.

Specified by:
createSourceFileException in interface KernelQedeqBo
Parameters:
service - This service generated the error.
exception - Take this exception.
Returns:
Newly created instance.

createSourceArea

public SourceArea createSourceArea(Qedeq qedeq,
                                   ModuleContext context)
Create area in source file for QEDEQ module context. If the system property "qedeq.test.xmlLocationFailures" is set to "true" a runtime exception is thrown if the context is not found.

Parameters:
qedeq - Look at this QEDEQ module.
context - Search for this context.
Returns:
Created file area. Maybe null.

getSupportedLanguages

public java.lang.String[] getSupportedLanguages()
Description copied from interface: QedeqBo
Get all supported languages for this QEDEQ module.

Specified by:
getSupportedLanguages in interface QedeqBo
Returns:
Array of supported languages.

isSupportedLanguage

public boolean isSupportedLanguage(java.lang.String language)
Description copied from interface: QedeqBo
Is the given language supported.

Specified by:
isSupportedLanguage in interface QedeqBo
Parameters:
language - Language.
Returns:
Is this language supported?

getOriginalLanguage

public java.lang.String getOriginalLanguage()
Description copied from interface: QedeqBo
Get default language for this QEDEQ module. This should be the original language of the module before it was translated. This value should be also within QedeqBo.getSupportedLanguages().

Specified by:
getOriginalLanguage in interface QedeqBo
Returns:
Original language.

setQedeqVo

public void setQedeqVo(QedeqVo qedeq)
Set QedeqVo. Doesn't do any status handling. Only for internal use.

Parameters:
qedeq - Set this value.

getStateManager

protected StateManager getStateManager()
Get StateManager. Only for internal use.

Returns:
StateManager

getExistenceChecker

public ModuleConstantsExistenceChecker getExistenceChecker()
Get the predicate and function existence checker. Is not null if logic was (not necessarily successfully) checked.

Specified by:
getExistenceChecker in interface KernelQedeqBo
Returns:
Checker. Checks if a predicate or function constant is defined.

setExistenceChecker

public void setExistenceChecker(ModuleConstantsExistenceChecker checker)
Description copied from interface: KernelQedeqBo
Set ModuleConstantsExistenceChecker. Doesn't do any status handling.

Specified by:
setExistenceChecker in interface KernelQedeqBo
Parameters:
checker - Set this checker.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

addPluginErrorsAndWarnings

public void addPluginErrorsAndWarnings(ModuleService plugin,
                                       SourceFileExceptionList errors,
                                       SourceFileExceptionList warnings)
Description copied from interface: KernelQedeqBo
Add errors and warnings for service.

Specified by:
addPluginErrorsAndWarnings in interface KernelQedeqBo
Parameters:
plugin - Add errors for this service.
errors - These errors occurred.
warnings - These warnings occurred.

clearAllPluginErrorsAndWarnings

public void clearAllPluginErrorsAndWarnings()
Description copied from interface: KernelQedeqBo
Remove all errors and warnings for all services.

Specified by:
clearAllPluginErrorsAndWarnings in interface KernelQedeqBo


Copyright © 2014. All Rights Reserved.