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

java.lang.Object
  extended by org.qedeq.kernel.bo.service.internal.StateManager

public class StateManager
extends java.lang.Object

Changes the states of org.qedeq.kernel.bo.service.control.DefaultKernelQedeqBos. All state changing is done here.

Author:
Michael Meyling

Method Summary
 void addPluginResults(ModuleService plugin, SourceFileExceptionList errors, SourceFileExceptionList warnings)
          Add the plugin execution errors and warnings.
 void delete()
          Delete QEDEQ module.
 AbstractState getCurrentState()
          Get the current state of associate module.
 DependencyState getDependencyState()
          Get dependency state.
 SourceFileExceptionList getErrors()
          Get all errors.
 FormallyProvedState getFormallyProvedState()
          Get the formally proved state.
 AbstractState getLastSuccesfulState()
          Get the last successful state we were in.
 int getLoadingCompleteness()
          Get loading completeness percentage.
 LoadingImportsState getLoadingImportsState()
          Get loading imports state.
 LoadingState getLoadingState()
          Get loading state.
 java.lang.String getStateDescription()
          Get a description of the current state the module is in.
 SourceFileExceptionList getWarnings()
          Get all warnings.
 WellFormedState getWellFormedState()
          Get the well formed state.
 boolean hasBasicFailures()
          Is the module in a failure state? That is the case if loading of module or imported modules failed or the logical check failed.
 boolean hasErrors()
          Has the module any errors? This includes loading, importing, logical and plugin errors.
 boolean hasLoadedImports()
          Are all imported modules loaded?
 boolean hasLoadedRequiredModules()
          Are all required modules loaded?
 boolean hasWarnings()
          Has the module any warnings? This includes loading, importing, logical and plugin warnings.
 boolean isFullyFormallyProved()
          Was the module successfully checked having formally correct proofs?
 boolean isLoaded()
          Is the module loaded?
 boolean isWellFormed()
          Was the module successfully checked for well formedness errors?
 void printDependencyTree()
          Print the dependence tree to System.out.
 void removeAllPluginResults()
          Remove all plugin errors and warnings.
 void setDependencyFailureState(DependencyState state, SourceFileExceptionList e)
          Set failure module state.
 void setDependencyProgressState(DependencyState state)
          Set dependency progress module state.
protected  void setDependencyState(DependencyState state)
          Set DependencyState.
protected  void setErrors(SourceFileExceptionList errors)
          Set SourceFileExceptionList.
 void setFormallyProvedFailureState(FormallyProvedState state, SourceFileExceptionList e)
          Set failure module state.
 void setFormallyProvedProgressState(FormallyProvedState state)
          Set checking for formally proved progress module state.
protected  void setFormallyProvedState(FormallyProvedState state)
          Set FormallyProvedState.
 void setLoaded(QedeqVo qedeq, ModuleLabels labels)
          Set loading state to "loaded".
 void setLoadedImports(KernelModuleReferenceList required)
          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 loading imports progress module state.
protected  void setLoadingImportsState(LoadingImportsState state)
          Set LoadingImportsState.
 void setLoadingProgressState(LoadingState state)
          Set loading progress module state.
protected  void setLoadingState(LoadingState state)
          Set LoadingState.
 void setWellFormed(ModuleConstantsExistenceChecker checker)
          Set logic checked state.
 void setWellFormedFailureState(WellFormedState state, SourceFileExceptionList e)
          Set failure module state.
 void setWellFormedProgressState(WellFormedState state)
          Set checking for well formed progress module state.
protected  void setWellFormedState(WellFormedState state)
          Set WellFormedState.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

delete

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


hasBasicFailures

public boolean hasBasicFailures()
Is the module in a failure state? That is the case if loading of module or imported modules failed or the logical check failed. Possible plugin failures don't matter.

Returns:
Failure during loading or logical check occurred.

hasErrors

public boolean hasErrors()
Has the module any errors? This includes loading, importing, logical and plugin errors.

Returns:
Errors occurred.

hasWarnings

public boolean hasWarnings()
Has the module any warnings? This includes loading, importing, logical and plugin warnings.

Returns:
Warnings occurred.

setLoadingCompleteness

public void setLoadingCompleteness(int completeness)
Set completeness percentage.

Parameters:
completeness - Completeness of loading into memory.

getLoadingCompleteness

public int getLoadingCompleteness()
Get loading completeness percentage.

Returns:
Completeness as percent number.

getLoadingState

public LoadingState getLoadingState()
Get loading state.

Returns:
Loading state.

isLoaded

public boolean isLoaded()
Is the module loaded?

Returns:
Is the module loaded?

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

setLoaded

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

Parameters:
qedeq - This module was loaded. Must not be null.
labels - Module labels.
Throws:
java.lang.NullPointerException - One argument was null.

setLoadingImportsProgressState

public void setLoadingImportsProgressState(LoadingImportsState state)
Set loading imports progress module state.

Parameters:
state - Module state. Must not be null.
Throws:
java.lang.IllegalStateException - Module is not yet loaded.
java.lang.IllegalArgumentException - state is failure state or loaded required state.
java.lang.NullPointerException - state is null.

setLoadingImportsFailureState

public void setLoadingImportsFailureState(LoadingImportsState state,
                                          SourceFileExceptionList e)
Set failure module state.

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

getLoadingImportsState

public LoadingImportsState getLoadingImportsState()
Get loading imports state.

Returns:
Dependency state.

hasLoadedImports

public boolean hasLoadedImports()
Are all imported modules loaded?

Returns:
Are all imported module loaded?

setDependencyProgressState

public void setDependencyProgressState(DependencyState state)
Set dependency progress module state.

Parameters:
state - Module state. Must not be null.
Throws:
java.lang.IllegalStateException - Module is not yet loaded.
java.lang.IllegalArgumentException - state is failure state or loaded required state.
java.lang.NullPointerException - state is null.

setDependencyFailureState

public void setDependencyFailureState(DependencyState state,
                                      SourceFileExceptionList e)
Set failure module state.

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

getDependencyState

public DependencyState getDependencyState()
Get dependency state.

Returns:
Dependency state.

hasLoadedRequiredModules

public boolean hasLoadedRequiredModules()
Are all required modules loaded?

Returns:
All required modules are loaded?

setLoadedImports

public void setLoadedImports(KernelModuleReferenceList required)
Set loaded imports state.

Parameters:
required - URLs of all referenced modules. Must not be null.
Throws:
java.lang.IllegalStateException - Module is not yet loaded.

setLoadedRequiredModules

public void setLoadedRequiredModules()
Set loaded required requirements state.

Throws:
java.lang.IllegalStateException - Module is not yet loaded.

setWellFormed

public void setWellFormed(ModuleConstantsExistenceChecker checker)
Set logic checked state. Also set the predicate and function existence checker.

Parameters:
checker - Checks if a predicate or function constant is defined.

setWellFormedProgressState

public void setWellFormedProgressState(WellFormedState state)
Set checking for well formed progress module state. Must not be null.

Parameters:
state - module state

setWellFormedFailureState

public void setWellFormedFailureState(WellFormedState state,
                                      SourceFileExceptionList e)
Set failure module state.

Parameters:
state - module state
e - Exception that occurred during loading.
Throws:
java.lang.IllegalArgumentException - state is no failure state

setFormallyProvedProgressState

public void setFormallyProvedProgressState(FormallyProvedState state)
Set checking for formally proved progress module state. Must not be null.

Parameters:
state - module state

setFormallyProvedFailureState

public void setFormallyProvedFailureState(FormallyProvedState state,
                                          SourceFileExceptionList e)
Set failure module state.

Parameters:
state - module state
e - Exception that occurred during loading.
Throws:
java.lang.IllegalArgumentException - state is no failure state

isWellFormed

public boolean isWellFormed()
Was the module successfully checked for well formedness errors?

Returns:
Successfully checked for being well formed?

getWellFormedState

public WellFormedState getWellFormedState()
Get the well formed state.

Returns:
Well formed state.

isFullyFormallyProved

public boolean isFullyFormallyProved()
Was the module successfully checked having formally correct proofs?

Returns:
Successfully checked for having formally correct proofs?

getFormallyProvedState

public FormallyProvedState getFormallyProvedState()
Get the formally proved state.

Returns:
Formally proved state.

getStateDescription

public java.lang.String getStateDescription()
Get a description of the current state the module is in.

Returns:
Textual representation of module state.

getCurrentState

public AbstractState getCurrentState()
Get the current state of associate module.

Returns:
Current module state.

getLastSuccesfulState

public AbstractState getLastSuccesfulState()
Get the last successful state we were in. As there are: undefined, loaded, loaded required, fully formally proved.

Returns:
Previous major error free state.

setLoadingState

protected void setLoadingState(LoadingState state)
Set LoadingState. Doesn't do any status handling. Only for internal use.

Parameters:
state - Set this loading state.

setLoadingImportsState

protected void setLoadingImportsState(LoadingImportsState state)
Set LoadingImportsState. Doesn't do any status handling. Only for internal use.

Parameters:
state - Set this loading state.

setDependencyState

protected void setDependencyState(DependencyState state)
Set DependencyState. Doesn't do any status handling. Only for internal use.

Parameters:
state - Set this dependency state.

setWellFormedState

protected void setWellFormedState(WellFormedState state)
Set WellFormedState. Doesn't do any status handling. Only for internal use.

Parameters:
state - Set this logical state.

setFormallyProvedState

protected void setFormallyProvedState(FormallyProvedState state)
Set FormallyProvedState. Doesn't do any status handling. Only for internal use.

Parameters:
state - Set this logical state.

getErrors

public SourceFileExceptionList getErrors()
Get all errors.

Returns:
Errors. Is a newly created list.

getWarnings

public SourceFileExceptionList getWarnings()
Get all warnings.

Returns:
Warnings. Is a newly created list.

setErrors

protected void setErrors(SourceFileExceptionList errors)
Set SourceFileExceptionList. Doesn't do any status handling. Only for internal use.

Parameters:
errors - Set this error list. If this is null the errors are cleared!

addPluginResults

public void addPluginResults(ModuleService plugin,
                             SourceFileExceptionList errors,
                             SourceFileExceptionList warnings)
Add the plugin execution errors and warnings.

Parameters:
plugin - Plugin that was executed.
errors - Resulting errors.
warnings - Resulting warnings.

removeAllPluginResults

public void removeAllPluginResults()
Remove all plugin errors and warnings.


printDependencyTree

public void printDependencyTree()
Print the dependence tree to System.out.



Copyright © 2014. All Rights Reserved.