Class ReasonerConfiguration
- java.lang.Object
-
- net.ssehub.easy.reasoning.core.reasoner.ReasonerConfiguration
-
public class ReasonerConfiguration extends java.lang.ObjectDescribes the configuration to be passed via theReasonerFrontendto the individual reasoners. Data in this class may be defined e.g. via the UI or from a configuration file. Setters are realized in builder style so that they can be chained easily after instance creation.- Author:
- Holger Eichelberger
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceReasonerConfiguration.IAdditionalInformationLoggerDescribes an information logger.
-
Field Summary
Fields Modifier and Type Field Description static ReasonerConfiguration.IAdditionalInformationLoggerADDITIONAL_INFO_LOG_NONEstatic ReasonerConfiguration.IAdditionalInformationLoggerADDITIONAL_INFO_LOG_SYSOUTprivate AttributeValuesattributeValuesprivate booleancustomMessagesprivate ReasonerDescriptordefaultReasonerprivate booleanincrementalprivate ReasonerConfiguration.IAdditionalInformationLoggerloggerprivate inttimeout
-
Constructor Summary
Constructors Constructor Description ReasonerConfiguration()Creates a new instance and initializes it with default values, i.e.ReasonerConfiguration(boolean defParamValue)Creates a new instance and initializes it with default values, i.e.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ReasonerConfigurationdisableCustomMessages()Disable custom messages.ReasonerConfigurationenableCustomMessages()Enables custom messages.AttributeValuesgetAttributeValues()Returns the attribute values for reasoning.static AttributeValuesgetAttributeValues(ReasonerConfiguration config)Null-safe access to the attribute values.booleangetCustomMessages()Returns if custom messages are enabled.ReasonerDescriptorgetDefaultResoner()Returns the default reasoner.ReasonerConfiguration.IAdditionalInformationLoggergetLogger()Returns the additional information logger.intgetTimeout()Returns the timeout for reasoning.intgetTimeout(ReasonerConfiguration configuration)Returns the specific timeout for reasoning.booleanisIncrementalMode()Returns whether incremental reasoning shall be done (seesetIncrementalMode(boolean).booleanisRuntimeMode()Returns whether runtime reasoning shall be done (seesetRuntimeMode(boolean).ReasonerConfigurationsetAdditionalInformationLogger(ReasonerConfiguration.IAdditionalInformationLogger logger)Defines the additional information logger.ReasonerConfigurationsetAttributeValues(AttributeValues attributeValues)Changes attribute values for reasoning.ReasonerConfigurationsetDefaultReasoner(ReasonerDescriptor defaultReasoner)Changes the default reasoner.ReasonerConfigurationsetIncrementalMode(boolean incremental)Defines whether runtime incremental reasoning shall be performend.ReasonerConfigurationsetRuntimeMode(boolean runtime)Defines whether runtime reasoning reasoning shall be activated.ReasonerConfigurationsetTimeout(int timeout)Changes the timeout for reasoning.
-
-
-
Field Detail
-
ADDITIONAL_INFO_LOG_SYSOUT
public static final ReasonerConfiguration.IAdditionalInformationLogger ADDITIONAL_INFO_LOG_SYSOUT
-
ADDITIONAL_INFO_LOG_NONE
public static final ReasonerConfiguration.IAdditionalInformationLogger ADDITIONAL_INFO_LOG_NONE
-
attributeValues
private AttributeValues attributeValues
-
timeout
private int timeout
-
defaultReasoner
private ReasonerDescriptor defaultReasoner
-
customMessages
private boolean customMessages
-
incremental
private boolean incremental
-
logger
private ReasonerConfiguration.IAdditionalInformationLogger logger
-
-
Constructor Detail
-
ReasonerConfiguration
public ReasonerConfiguration()
Creates a new instance and initializes it with default values, i.e. the global timeout fromReasonerFrontend.getTimeout(), an unspecified attributes values set (null) and an unspecified default reasoner (null).
-
ReasonerConfiguration
public ReasonerConfiguration(boolean defParamValue)
Creates a new instance and initializes it with default values, i.e. the global timeout fromReasonerFrontend.getTimeout(), an unspecified attributes values set (null), custom messaging and an unspecified default reasoner (null).- Parameters:
defParamValue- Enables custom messages (comments instead of constraints).
-
-
Method Detail
-
setTimeout
public ReasonerConfiguration setTimeout(int timeout)
Changes the timeout for reasoning.- Parameters:
timeout- the timeout in ms, shall be ignored if less negative or null- Returns:
- this
-
getTimeout
public int getTimeout()
Returns the timeout for reasoning.- Returns:
- the timeout in ms, shall be ignored if not positive
-
getTimeout
public int getTimeout(ReasonerConfiguration configuration)
Returns the specific timeout for reasoning. This method usesReasonerFrontend.getTimeout()as fallback. Reasoners shall call this method rather thangetTimeout().- Parameters:
configuration- the configuration the timeout shall be returned for (may be null)- Returns:
- the timeout in ms, shall be ignored if less negative or null
-
setAttributeValues
public ReasonerConfiguration setAttributeValues(AttributeValues attributeValues)
Changes attribute values for reasoning.- Parameters:
attributeValues- the values instance (may ba null)- Returns:
- this
-
getAttributeValues
public AttributeValues getAttributeValues()
Returns the attribute values for reasoning. Reasoners shall callgetAttributeValues(ReasonerConfiguration)instead.- Returns:
- the attribute values for reasoning (may be null if none is provided)
-
getAttributeValues
public static AttributeValues getAttributeValues(ReasonerConfiguration config)
Null-safe access to the attribute values.- Parameters:
config- the configuration instance holding the attribute values.- Returns:
- the values or null
-
setDefaultReasoner
public ReasonerConfiguration setDefaultReasoner(ReasonerDescriptor defaultReasoner)
Changes the default reasoner.- Parameters:
defaultReasoner- the default reasoner or null if there is none configured- Returns:
- this
-
getDefaultResoner
public ReasonerDescriptor getDefaultResoner()
Returns the default reasoner.- Returns:
- the default reasoner or null if there is none configured
-
enableCustomMessages
public ReasonerConfiguration enableCustomMessages()
Enables custom messages.- Returns:
- this
-
disableCustomMessages
public ReasonerConfiguration disableCustomMessages()
Disable custom messages.- Returns:
- this
-
getCustomMessages
public boolean getCustomMessages()
Returns if custom messages are enabled.- Returns:
- Returns true if custom messages are enabled.
-
getLogger
public ReasonerConfiguration.IAdditionalInformationLogger getLogger()
Returns the additional information logger.- Returns:
- the information logger
-
setAdditionalInformationLogger
public ReasonerConfiguration setAdditionalInformationLogger(ReasonerConfiguration.IAdditionalInformationLogger logger)
Defines the additional information logger.- Parameters:
logger- the logger- Returns:
- this
-
setRuntimeMode
public ReasonerConfiguration setRuntimeMode(boolean runtime)
Defines whether runtime reasoning reasoning shall be activated. Currently, runtime reasoning assumes that all required defaults and assignments have already been processed. In particular, the caller is responsible for passing a "clean" configuration to the reasoner that leads to the expected results. Same assetIncrementalMode(boolean).- Parameters:
runtime- if reasoning shall happen for runtime- Returns:
- this
-
setIncrementalMode
public ReasonerConfiguration setIncrementalMode(boolean incremental)
Defines whether runtime incremental reasoning shall be performend. Currently, runtime reasoning assumes that all required defaults and assignments have already been processed. In particular, the caller is responsible for passing a "clean" configuration to the reasoner that leads to the expected results.- Parameters:
incremental- if incremental reasoning shall happen- Returns:
- this
-
isRuntimeMode
public boolean isRuntimeMode()
Returns whether runtime reasoning shall be done (seesetRuntimeMode(boolean).- Returns:
trueif reasoning shall happen for runtime,falseelse (same asisIncrementalMode())
-
isIncrementalMode
public boolean isIncrementalMode()
Returns whether incremental reasoning shall be done (seesetIncrementalMode(boolean).- Returns:
trueif reasoning shall happen for runtime,falseelse
-
-