org.qedeq.kernel.bo.service.logic
Class ModuleConstantsExistenceCheckerImpl

java.lang.Object
  extended by org.qedeq.kernel.bo.service.logic.DefaultExistenceChecker
      extended by org.qedeq.kernel.bo.service.logic.ModuleConstantsExistenceCheckerImpl
All Implemented Interfaces:
ClassOperatorExistenceChecker, ExistenceChecker, FunctionExistenceChecker, IdentityOperatorExistenceChecker, PredicateExistenceChecker, RuleExistenceChecker, ModuleConstantsExistenceChecker

public class ModuleConstantsExistenceCheckerImpl
extends DefaultExistenceChecker
implements ModuleConstantsExistenceChecker

Checks if a predicate or function constant is defined.

Author:
Michael Meyling

Field Summary
 
Fields inherited from interface org.qedeq.kernel.bo.logic.common.ExistenceChecker
NAME_EQUAL
 
Constructor Summary
ModuleConstantsExistenceCheckerImpl(KernelQedeqBo prop)
          Constructor.
 
Method Summary
 boolean classOperatorExists()
          Check if the class operator is already defined.
 boolean functionExists(FunctionKey function)
          Check if a function is already defined.
 FunctionConstant get(FunctionKey function)
          Get function constant definition.
 PredicateConstant get(PredicateKey predicate)
          Get predicate constant definition.
 Rule get(RuleKey ruleKey)
          Get rule definition.
 KernelQedeqBo getClassOperatorModule()
          Get QEDEQ module where the class operator is defined within.
 KernelQedeqBo getIdentityOperatorModule()
          Get QEDEQ module where the identity operator is defined within.
 RuleKey getParentRuleKey(java.lang.String ruleName)
          Get maximum rule version that is defined in an imported module.
 KernelQedeqBo getQedeq(FunctionKey function)
          Get QEDEQ module where given function constant is defined.
 KernelQedeqBo getQedeq(PredicateKey predicate)
          Get QEDEQ module where given predicate constant is defined.
 KernelQedeqBo getQedeq(RuleKey ruleKey)
          Get QEDEQ module where given rule is defined.
 RuleKey getRuleKey(java.lang.String ruleName)
          Get maximum rule version that is defined in this or an imported module.
 java.util.Map getRules()
          Get map of all RuleKeys defined in this module or in one of the imported ones.
 void init()
          Check if required QEDEQ modules mix without problems.
 boolean isInitialFunction(FunctionKey function)
          Check if given function key has an initial function definition.
 boolean isInitialPredicate(PredicateKey predicate)
          Check if given predicate key has an initial predicate definition.
 boolean predicateExists(PredicateKey predicate)
          Check if a predicate is already defined.
 void setClassOperatorModule(KernelQedeqBo classOperatorModule, ModuleContext context)
          Set if the class operator is already defined.
 void setIdentityOperatorDefined(java.lang.String identityOperator, KernelQedeqBo identityOperatorModule, ModuleContext context)
          Set the identity operator.
 
Methods inherited from class org.qedeq.kernel.bo.service.logic.DefaultExistenceChecker
add, add, add, add, add, clear, functionExists, getFunction, getIdentityOperator, getPredicate, identityOperatorExists, predicateExists, ruleExists, setIdentityOperatorDefined
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.qedeq.kernel.bo.module.ModuleConstantsExistenceChecker
getFunction, getPredicate
 
Methods inherited from interface org.qedeq.kernel.bo.logic.common.PredicateExistenceChecker
predicateExists
 
Methods inherited from interface org.qedeq.kernel.bo.logic.common.FunctionExistenceChecker
functionExists
 
Methods inherited from interface org.qedeq.kernel.bo.logic.common.IdentityOperatorExistenceChecker
getIdentityOperator, identityOperatorExists
 
Methods inherited from interface org.qedeq.kernel.bo.logic.common.RuleExistenceChecker
ruleExists
 

Constructor Detail

ModuleConstantsExistenceCheckerImpl

public ModuleConstantsExistenceCheckerImpl(KernelQedeqBo prop)
                                    throws ModuleDataException
Constructor.

Parameters:
prop - QEDEQ module properties object.
Throws:
ModuleDataException - Referenced QEDEQ modules are already inconsistent: they doesn't mix.
Method Detail

init

public final void init()
                throws ModuleDataException
Check if required QEDEQ modules mix without problems. If for example the identity operator is defined in two different modules in two different ways we have got a problem. Also the basic properties (for example setIdentityOperatorDefined(String, KernelQedeqBo, ModuleContext) and ModuleConstantsExistenceCheckerImpl#setClassOperatorModule(KernelQedeqBo)) are set accordingly.

Throws:
ModuleDataException - Required modules doesn't mix.

predicateExists

public boolean predicateExists(PredicateKey predicate)
Description copied from interface: PredicateExistenceChecker
Check if a predicate is already defined.

Specified by:
predicateExists in interface PredicateExistenceChecker
Specified by:
predicateExists in interface ModuleConstantsExistenceChecker
Overrides:
predicateExists in class DefaultExistenceChecker
Parameters:
predicate - Predicate.
Returns:
Predicate is defined.

functionExists

public boolean functionExists(FunctionKey function)
Description copied from interface: FunctionExistenceChecker
Check if a function is already defined.

Specified by:
functionExists in interface FunctionExistenceChecker
Specified by:
functionExists in interface ModuleConstantsExistenceChecker
Overrides:
functionExists in class DefaultExistenceChecker
Parameters:
function - Function.
Returns:
Functions is defined.

isInitialPredicate

public boolean isInitialPredicate(PredicateKey predicate)
Description copied from interface: PredicateExistenceChecker
Check if given predicate key has an initial predicate definition.

Specified by:
isInitialPredicate in interface PredicateExistenceChecker
Overrides:
isInitialPredicate in class DefaultExistenceChecker
Parameters:
predicate - Predicate.
Returns:
Predicate is defined and is an initial predicate definition.

isInitialFunction

public boolean isInitialFunction(FunctionKey function)
Description copied from interface: FunctionExistenceChecker
Check if given function key has an initial function definition.

Specified by:
isInitialFunction in interface FunctionExistenceChecker
Overrides:
isInitialFunction in class DefaultExistenceChecker
Parameters:
function - Function key.
Returns:
Function is defined and is an initial function definition.

get

public PredicateConstant get(PredicateKey predicate)
Description copied from class: DefaultExistenceChecker
Get predicate constant definition.

Specified by:
get in interface ModuleConstantsExistenceChecker
Overrides:
get in class DefaultExistenceChecker
Parameters:
predicate - Get definition of this predicate.
Returns:
Definition.

get

public FunctionConstant get(FunctionKey function)
Description copied from class: DefaultExistenceChecker
Get function constant definition.

Specified by:
get in interface ModuleConstantsExistenceChecker
Overrides:
get in class DefaultExistenceChecker
Parameters:
function - Get definition of this predicate.
Returns:
Definition. Might be null.

getQedeq

public KernelQedeqBo getQedeq(FunctionKey function)
Get QEDEQ module where given function constant is defined.

Specified by:
getQedeq in interface ModuleConstantsExistenceChecker
Parameters:
function - Function we look for.
Returns:
QEDEQ module where function constant is defined.

getQedeq

public KernelQedeqBo getQedeq(PredicateKey predicate)
Get QEDEQ module where given predicate constant is defined.

Specified by:
getQedeq in interface ModuleConstantsExistenceChecker
Parameters:
predicate - Predicate we look for.
Returns:
QEDEQ module where predicate constant is defined.x

getRuleKey

public RuleKey getRuleKey(java.lang.String ruleName)
Description copied from interface: ModuleConstantsExistenceChecker
Get maximum rule version that is defined in this or an imported module.

Specified by:
getRuleKey in interface ModuleConstantsExistenceChecker
Parameters:
ruleName - Rule we look for.
Returns:
Rule key with maximum version.x

getParentRuleKey

public RuleKey getParentRuleKey(java.lang.String ruleName)
Description copied from interface: ModuleConstantsExistenceChecker
Get maximum rule version that is defined in an imported module.

Specified by:
getParentRuleKey in interface ModuleConstantsExistenceChecker
Parameters:
ruleName - Rule we look for.
Returns:
Rule key with maximum version.

get

public Rule get(RuleKey ruleKey)
Description copied from class: DefaultExistenceChecker
Get rule definition.

Specified by:
get in interface ModuleConstantsExistenceChecker
Overrides:
get in class DefaultExistenceChecker
Parameters:
ruleKey - Get definition of this key.
Returns:
Definition. Might be null.

getRules

public java.util.Map getRules()
Description copied from interface: ModuleConstantsExistenceChecker
Get map of all RuleKeys defined in this module or in one of the imported ones.

Specified by:
getRules in interface ModuleConstantsExistenceChecker
Returns:
Map of all defined rule keys mapping from RuleKey to KernelQedeqBo.

getQedeq

public KernelQedeqBo getQedeq(RuleKey ruleKey)
Get QEDEQ module where given rule is defined.

Specified by:
getQedeq in interface ModuleConstantsExistenceChecker
Parameters:
ruleKey - Rule we look for.
Returns:
QEDEQ module where rule is defined. Could be null.

classOperatorExists

public boolean classOperatorExists()
Description copied from interface: ClassOperatorExistenceChecker
Check if the class operator is already defined.

Specified by:
classOperatorExists in interface ClassOperatorExistenceChecker
Specified by:
classOperatorExists in interface ModuleConstantsExistenceChecker
Overrides:
classOperatorExists in class DefaultExistenceChecker
Returns:
Class operator is defined.

setIdentityOperatorDefined

public void setIdentityOperatorDefined(java.lang.String identityOperator,
                                       KernelQedeqBo identityOperatorModule,
                                       ModuleContext context)
                                throws IdentityOperatorAlreadyExistsException
Set the identity operator.

Specified by:
setIdentityOperatorDefined in interface ModuleConstantsExistenceChecker
Parameters:
identityOperator - Operator name. Might be null.
identityOperatorModule - In this module the identity operator is defined.
context - Here we are within the module.
Throws:
IdentityOperatorAlreadyExistsException - Already defined.

getClassOperatorModule

public KernelQedeqBo getClassOperatorModule()
Description copied from interface: ModuleConstantsExistenceChecker
Get QEDEQ module where the class operator is defined within.

Specified by:
getClassOperatorModule in interface ModuleConstantsExistenceChecker
Returns:
Class operator defining module.

getIdentityOperatorModule

public KernelQedeqBo getIdentityOperatorModule()
Description copied from interface: ModuleConstantsExistenceChecker
Get QEDEQ module where the identity operator is defined within.

Specified by:
getIdentityOperatorModule in interface ModuleConstantsExistenceChecker
Returns:
Identity operator defining module.

setClassOperatorModule

public void setClassOperatorModule(KernelQedeqBo classOperatorModule,
                                   ModuleContext context)
                            throws ClassOperatorAlreadyExistsException
Set if the class operator is already defined.

Specified by:
setClassOperatorModule in interface ModuleConstantsExistenceChecker
Parameters:
classOperatorModule - Module where class operator is defined.
context - Context where we try to set new class operator.
Throws:
ClassOperatorAlreadyExistsException - Operator already defined.


Copyright © 2014. All Rights Reserved.