Package com.semedy.reasoner.api.builtin
Class SensorBuiltin
java.lang.Object
com.semedy.reasoner.api.builtin.SensorBuiltin
- All Implemented Interfaces:
Builtin
- Direct Known Subclasses:
Alarm,IncrementalFactsBuiltin,ListenToPort,SensorBuiltinSingleValue,Ticks
A sensor builtin feeds events asynchroniously into the reasoner.
Used for complex event processing.
Used for complex event processing.
- Author:
- angele
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddReceiver(Receiver receive) abstract Builtincreate a clone of the built-invoidevaluation is finishedabstract String[]get a description of the argumentsabstract intgetArity()get the arity of the built-inabstract Stringget a description of the built-in itselfabstract StringgetName()get the name of the built-inabstract BuiltinTypegetType()get the type of the built-inabstract longget the weight of the built-inabstract voidinitialize the built-inabstract booleanisEvaluable(BitSet grounds, BitSet variableInstantiations, Object[] args) is builtin evaluable with the given ground instantiation of variablesabstract booleanis it an internal built-inabstract BitSetobjectGeneratingArguments(BitSet grounds, BitSet variableInstantiations, Object[] args) at which argument positions new objects are generatedabstract booleandoes the built-in read the symbol tablevoidreceiveEncodedEvent(Object[] tuple) receives an event with already coded values (longs)
triggers reasoning with this new infovoidreceiveEvent(Object[] tuple) receives an event from an external system/sensor and
triggers reasoning with this new infovoidretractEncodedEvent(Object[] tuple) retracts an event with already coded values (longs)
triggers reasoning with this new infovoidretractEvent(Object[] tuple) withdraws an event from an external system/sensor and triggers reasoning with this new infovoidvoidsetSemaphore(SimpleSemaphore semaphore) A semaphore is used to continue evaluation after a new value for a sensor has been arrivedvoidsetSymbolTable(SymbolTable symbolTable) set the symbol tableabstract booleandoes the built-in write the symbol tableMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.semedy.reasoner.api.builtin.Builtin
clear, setProperties
-
Constructor Details
-
SensorBuiltin
public SensorBuiltin()
-
-
Method Details
-
addReceiver
-
receiveEvent
public void receiveEvent(Object[] tuple) throws SemReasonerException, InterruptedException, IOException receives an event from an external system/sensor and
triggers reasoning with this new info- Parameters:
tuple-- Throws:
SymboltableExceptionReasoningExceptionInterruptedExceptionIOExceptionSemReasonerException
-
receiveEncodedEvent
public void receiveEncodedEvent(Object[] tuple) throws InterruptedException, IOException, SemReasonerException receives an event with already coded values (longs)
triggers reasoning with this new info- Parameters:
tuple- (array of Long)- Throws:
InterruptedExceptionIOExceptionSemReasonerException
-
retractEvent
public void retractEvent(Object[] tuple) throws SemReasonerException, InterruptedException, IOException withdraws an event from an external system/sensor and triggers reasoning with this new info- Parameters:
tuple-- Throws:
SymboltableExceptionReasoningExceptionInterruptedExceptionIOExceptionSemReasonerException
-
retractEncodedEvent
public void retractEncodedEvent(Object[] tuple) throws IOException, InterruptedException, SemReasonerException retracts an event with already coded values (longs)
triggers reasoning with this new info- Parameters:
tuple- (array of Long)- Throws:
SymboltableExceptionInterruptedExceptionIOExceptionSemReasonerException
-
retractEvents
-
evaluationFinished
evaluation is finished- Specified by:
evaluationFinishedin interfaceBuiltin- Throws:
BuiltinExceptionInterruptedException
-
setSymbolTable
set the symbol table- Specified by:
setSymbolTablein interfaceBuiltin- Parameters:
symbolTable- , the symbol table
-
setSemaphore
A semaphore is used to continue evaluation after a new value for a sensor has been arrived- Parameters:
semaphore-
-
isEvaluable
public abstract boolean isEvaluable(BitSet grounds, BitSet variableInstantiations, Object[] args) throws BuiltinException is builtin evaluable with the given ground instantiation of variables- Specified by:
isEvaluablein interfaceBuiltin- Parameters:
grounds- , which arguments are groundvariableInstantiations- , which variables are instantiatedargs- , the arguments- Returns:
- was it evaluable
- Throws:
BuiltinException
-
init
public abstract void init(Object[] args) throws BuiltinException, InterruptedException, SemReasonerException initialize the built-in- Specified by:
initin interfaceBuiltin- Parameters:
args- , the builtin arguments- Throws:
SemReasonerExceptionInterruptedExceptionBuiltinException
-
getWeight
get the weight of the built-in -
objectGeneratingArguments
public abstract BitSet objectGeneratingArguments(BitSet grounds, BitSet variableInstantiations, Object[] args) throws BuiltinException at which argument positions new objects are generated- Specified by:
objectGeneratingArgumentsin interfaceBuiltin- Parameters:
grounds- , ground argument positionsvariableInstantiations- , instantiated variablesargs- , arguments of the literal- Returns:
- each bit indicates the argument position where new objects are created
- Throws:
BuiltinException
-
getName
get the name of the built-in -
getArity
public abstract int getArity()get the arity of the built-in -
getType
get the type of the built-in -
isInternal
public abstract boolean isInternal()is it an internal built-in- Specified by:
isInternalin interfaceBuiltin- Returns:
-
getArgumentDescriptions
get a description of the arguments- Specified by:
getArgumentDescriptionsin interfaceBuiltin- Returns:
- a description of the arguments of the built-in
-
getDescription
get a description of the built-in itself- Specified by:
getDescriptionin interfaceBuiltin- Returns:
- a description of the built-in
-
readsSymbolTable
public abstract boolean readsSymbolTable()does the built-in read the symbol table- Specified by:
readsSymbolTablein interfaceBuiltin- Returns:
- true if it reads the symbol table
-
writesSymbolTable
public abstract boolean writesSymbolTable()does the built-in write the symbol table- Specified by:
writesSymbolTablein interfaceBuiltin- Returns:
- true if it writes to the symbol table
-
cloneBuiltin
create a clone of the built-in- Specified by:
cloneBuiltinin interfaceBuiltin- Returns:
- the cloned built-in
-