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

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

public class DefaultExistenceChecker
extends java.lang.Object
implements ExistenceChecker

Checks if all predicate and function constants exist already.

Author:
Michael Meyling

Field Summary
 
Fields inherited from interface org.qedeq.kernel.bo.logic.common.ExistenceChecker
NAME_EQUAL
 
Constructor Summary
DefaultExistenceChecker()
          Constructor.
 
Method Summary
 void add(FunctionConstant definition)
          Add unknown function constant definition.
 void add(InitialFunctionDefinition initialDefinition)
          Add unknown function constant definition.
 void add(InitialPredicateDefinition initialDefinition)
          Add unknown predicate constant definition.
 void add(PredicateConstant constant)
          Add unknown predicate constant definition.
 void add(RuleKey ruleKey, Rule definition)
          Add unknown rule definition.
 boolean classOperatorExists()
          Check if the class operator is already defined.
 void clear()
          Empty all definitions.
 boolean functionExists(FunctionKey function)
          Check if a function is already defined.
 boolean functionExists(java.lang.String name, int arguments)
          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.
 FunctionConstant getFunction(java.lang.String name, int arguments)
          Get function constant definition.
 java.lang.String getIdentityOperator()
          Get identity operator.
 PredicateConstant getPredicate(java.lang.String name, int arguments)
          Get predicate constant definition.
 boolean identityOperatorExists()
          Check if the identity operator is already defined.
 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.
 boolean predicateExists(java.lang.String name, int arguments)
          Check if a predicate is already defined.
 boolean ruleExists(RuleKey ruleKey)
          Check if a rule is already defined.
 void setIdentityOperatorDefined(java.lang.String identityOperator)
          Set the identity operator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultExistenceChecker

public DefaultExistenceChecker()
Constructor.

Method Detail

clear

public void clear()
Empty all definitions.


predicateExists

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

Specified by:
predicateExists in interface PredicateExistenceChecker
Parameters:
predicate - Predicate.
Returns:
Predicate is defined.

predicateExists

public boolean predicateExists(java.lang.String name,
                               int arguments)
Description copied from interface: PredicateExistenceChecker
Check if a predicate is already defined.

Specified by:
predicateExists in interface PredicateExistenceChecker
Parameters:
name - Predicate name.
arguments - Number of operands for the predicate.
Returns:
Predicate 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
Parameters:
predicate - Predicate.
Returns:
Predicate is defined and is an initial predicate definition.

add

public void add(InitialPredicateDefinition initialDefinition)
Add unknown predicate constant definition. If the predicate constant is already known a runtime exception is thrown.

Parameters:
initialDefinition - Predicate constant definition that is not already known. Must not be null.
Throws:
java.lang.IllegalArgumentException - Predicate constant is already defined.

add

public void add(PredicateConstant constant)
Add unknown predicate constant definition. If the predicate constant is already known a runtime exception is thrown.

Parameters:
constant - Predicate constant definition that is not already known. Must not be null.
Throws:
java.lang.IllegalArgumentException - Predicate constant is already defined.

get

public PredicateConstant get(PredicateKey predicate)
Get predicate constant definition.

Parameters:
predicate - Get definition of this predicate.
Returns:
Definition.

getPredicate

public PredicateConstant getPredicate(java.lang.String name,
                                      int arguments)
Get predicate constant definition.

Parameters:
name - Name of predicate.
arguments - Arguments of predicate.
Returns:
Definition. Might be null.

functionExists

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

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

functionExists

public boolean functionExists(java.lang.String name,
                              int arguments)
Description copied from interface: FunctionExistenceChecker
Check if a function is already defined.

Specified by:
functionExists in interface FunctionExistenceChecker
Parameters:
name - Function name.
arguments - Number of operands for the function.
Returns:
Functions is defined.

add

public void add(FunctionConstant definition)
Add unknown function constant definition. If the function constant is already known a runtime exception is thrown.

Parameters:
definition - Function constant definition that is not already known. Must not be null.
Throws:
java.lang.IllegalArgumentException - Function constant is already defined.

add

public void add(InitialFunctionDefinition initialDefinition)
Add unknown function constant definition. If the function constant is already known a runtime exception is thrown.

Parameters:
initialDefinition - Function constant definition that is not already known. Must not be null.
Throws:
java.lang.IllegalArgumentException - Function constant is already defined.

get

public FunctionConstant get(FunctionKey function)
Get function constant definition.

Parameters:
function - Get definition of this predicate.
Returns:
Definition. Might be null.

getFunction

public FunctionConstant getFunction(java.lang.String name,
                                    int arguments)
Get function constant definition.

Parameters:
name - Name of function.
arguments - Arguments of function.
Returns:
Definition. Might be null.

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
Parameters:
function - Function key.
Returns:
Function is defined and is an initial function definition.

ruleExists

public boolean ruleExists(RuleKey ruleKey)
Description copied from interface: RuleExistenceChecker
Check if a rule is already defined.

Specified by:
ruleExists in interface RuleExistenceChecker
Parameters:
ruleKey - Rule defining data.
Returns:
Rule is defined.

add

public void add(RuleKey ruleKey,
                Rule definition)
Add unknown rule definition. If the rule is already known a runtime exception is thrown.

Parameters:
ruleKey - Key for rule.
definition - Rule definition that is not already known. Must not be null. Rule key might be different!
Throws:
java.lang.IllegalArgumentException - Rule is already defined (for given version).

get

public Rule get(RuleKey ruleKey)
Get rule definition.

Parameters:
ruleKey - Get definition of this key.
Returns:
Definition. Might 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
Returns:
Class operator is defined.

identityOperatorExists

public boolean identityOperatorExists()
Description copied from interface: IdentityOperatorExistenceChecker
Check if the identity operator is already defined.

Specified by:
identityOperatorExists in interface IdentityOperatorExistenceChecker
Returns:
Identity operator is already defined.

getIdentityOperator

public java.lang.String getIdentityOperator()
Description copied from interface: IdentityOperatorExistenceChecker
Get identity operator. This is the operator string of a predicate.

Specified by:
getIdentityOperator in interface IdentityOperatorExistenceChecker
Returns:
Identity operator. Should be null if !IdentityOperatorExistenceChecker.identityOperatorExists().

setIdentityOperatorDefined

public void setIdentityOperatorDefined(java.lang.String identityOperator)
Set the identity operator.

Parameters:
identityOperator - Operator name. Might be null.


Copyright © 2014. All Rights Reserved.