public class ExampleReasoner extends Reasoner
Reasoner
implementation is an example reasoner implementation for explanation reasons. It is able to
handle active user feedback from user interface. Internal sensor data will be supplied at runtime through the
setSensorData(JsonReachabilitySensorData)
method. The reasoner estimates the user reachability and provides
it by getEstimatedReachability()
.Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
MIND_FEEDBACK_KEY
The name of the property which contains the time for how long active feedback shall be minded.
|
private java.util.Properties |
reasonerProps
Basic (user-defined) properties.
|
private long |
startingAt
Starting time of the reasoner.
|
PROPERTY_FILE_SOURCE_KEY
Constructor and Description |
---|
ExampleReasoner()
Create a new example reasoning engine.
|
Modifier and Type | Method and Description |
---|---|
protected void |
cleanUp()
Write current state to log and give all resources free.
|
void |
dump()
Write current state and configuration of this reasoning engine to log...
|
java.util.Map<ReachabilityGroup,ReachabilityStatus> |
getEstimatedReachability()
Supplies the actual estimated
ReachabilityStatus to all ReachabilityGroup s as Map of
ReachabilityStatus to ReachabilityGroup . |
ReachabilityStatus |
getEstimatedReachability(ReachabilityGroup group)
Supplies the actual estimated
ReachabilityStatus to a specific ReachabilityGroup . |
java.util.Map<java.lang.String,java.lang.String> |
getValuesForProperty(java.lang.String property)
Returns reasoner defined options for a specific property.
|
void |
handleFeedback(ReachabilityGroup group,
ReachabilityStatus status)
Handle active user feedback which sets a certain
ReachabilityGroup to a specified
ReachabilityStatus . |
java.util.Properties |
loadCurrentProperties(ConfigType type)
Loads and returns the current local properties of a specified
ConfigType . |
static void |
main(java.lang.String[] args)
Main procedure to start and run this reasoning engine as
ReasonerAgent . |
protected void |
setSensorData(JsonReachabilitySensorData data)
Adds a new sensor object or replaces the last known of this dimension.
|
void |
updateProperties(java.util.Properties newProps,
java.util.Properties changed,
ConfigType type)
Update local properties.
|
getID, getVersion, isActive, isSilent, pushProperties, run, setSilent, shutDown, stopped
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
start
private static final java.lang.String MIND_FEEDBACK_KEY
private java.util.Properties reasonerProps
private long startingAt
protected final void setSensorData(JsonReachabilitySensorData data)
JsonReachabilitySensorData
object. This method will be called by the super class
Reasoner
at runtime if a new internal sensor data arrives.setSensorData
in class Reasoner
data
- The JsonReachabilitySensorData
which has been measured.public final java.util.Map<ReachabilityGroup,ReachabilityStatus> getEstimatedReachability()
ReachabilityStatus
to all ReachabilityGroup
s as Map
of
ReachabilityStatus
to ReachabilityGroup
. This method will be called by the super class
Reasoner
at runtime to publish the actual estimated reachability.Map
of estimated ReachabilityStatus
.public final ReachabilityStatus getEstimatedReachability(ReachabilityGroup group)
ReachabilityStatus
to a specific ReachabilityGroup
.group
- The ReachabilityGroup
for which the estimated ReachabilityStatus
shall be
returned.ReachabilityStatus
related to the requested ReachabilityGroup
.public void handleFeedback(ReachabilityGroup group, ReachabilityStatus status)
ReachabilityGroup
to a specified
ReachabilityStatus
. This method will be called by the super class Reasoner
at runtime whenever
new active user feedback arrives.group
- The ReachabilityGroup
for which the feedback has been given.status
- The user expected ReachabilityStatus
to this ReachabilityGroup
.public final java.util.Map<java.lang.String,java.lang.String> getValuesForProperty(java.lang.String property)
Reasoner
if the type for the property
was defined as AGENT_DEFINED
property
- The requested property as String
.Map
of String
to String
.public final java.util.Properties loadCurrentProperties(ConfigType type)
ConfigType
. This method will be called by
the super class Reasoner
at runtime if the properties of this reasoner are requested by a user interface.type
- Loads the current configuration of a certain type defined as ConfigType
.Properties
object.public final void updateProperties(java.util.Properties newProps, java.util.Properties changed, ConfigType type)
Reasoner
at runtime if a property
change from the user interface or actual configuration data of other components arrive.newProps
- The actual defined and correct Properties
set.changed
- The changed Properties
set.type
- The properties type which shall be updated as ConfigType
.protected final void cleanUp()
Reasoner
at runtime if this service will be ended.public void dump()
public static void main(java.lang.String[] args)
ReasonerAgent
.args
- The system supplied start arguments as array of String
.