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 TypeMethodDescriptionvoid
addReceiver
(Receiver receive) abstract Builtin
create a clone of the built-invoid
evaluation is finishedabstract String[]
get a description of the argumentsabstract int
getArity()
get the arity of the built-inabstract String
get a description of the built-in itselfabstract String
getName()
get the name of the built-inabstract BuiltinType
getType()
get the type of the built-inabstract long
get the weight of the built-inabstract void
initialize the built-inabstract boolean
isEvaluable
(BitSet grounds, BitSet variableInstantiations, Object[] args) is builtin evaluable with the given ground instantiation of variablesabstract boolean
is it an internal built-inabstract BitSet
objectGeneratingArguments
(BitSet grounds, BitSet variableInstantiations, Object[] args) at which argument positions new objects are generatedabstract boolean
does the built-in read the symbol tablevoid
receiveEncodedEvent
(Object[] tuple) receives an event with already coded values (longs)
triggers reasoning with this new infovoid
receiveEvent
(Object[] tuple) receives an event from an external system/sensor and
triggers reasoning with this new infovoid
retractEncodedEvent
(Object[] tuple) retracts an event with already coded values (longs)
triggers reasoning with this new infovoid
retractEvent
(Object[] tuple) withdraws an event from an external system/sensor and triggers reasoning with this new infovoid
void
setSemaphore
(SimpleSemaphore semaphore) A semaphore is used to continue evaluation after a new value for a sensor has been arrivedvoid
setSymbolTable
(SymbolTable symbolTable) set the symbol tableabstract boolean
does the built-in write the symbol tableMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
SymboltableException
ReasoningException
InterruptedException
IOException
SemReasonerException
-
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:
InterruptedException
IOException
SemReasonerException
-
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:
SymboltableException
ReasoningException
InterruptedException
IOException
SemReasonerException
-
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:
SymboltableException
InterruptedException
IOException
SemReasonerException
-
retractEvents
-
evaluationFinished
evaluation is finished- Specified by:
evaluationFinished
in interfaceBuiltin
- Throws:
BuiltinException
InterruptedException
-
setSymbolTable
set the symbol table- Specified by:
setSymbolTable
in 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:
isEvaluable
in 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:
init
in interfaceBuiltin
- Parameters:
args
- , the builtin arguments- Throws:
SemReasonerException
InterruptedException
BuiltinException
-
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:
objectGeneratingArguments
in 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:
isInternal
in interfaceBuiltin
- Returns:
-
getArgumentDescriptions
get a description of the arguments- Specified by:
getArgumentDescriptions
in interfaceBuiltin
- Returns:
- a description of the arguments of the built-in
-
getDescription
get a description of the built-in itself- Specified by:
getDescription
in interfaceBuiltin
- Returns:
- a description of the built-in
-
readsSymbolTable
public abstract boolean readsSymbolTable()does the built-in read the symbol table- Specified by:
readsSymbolTable
in interfaceBuiltin
- Returns:
- true if it reads the symbol table
-
writesSymbolTable
public abstract boolean writesSymbolTable()does the built-in write the symbol table- Specified by:
writesSymbolTable
in interfaceBuiltin
- Returns:
- true if it writes to the symbol table
-
cloneBuiltin
create a clone of the built-in- Specified by:
cloneBuiltin
in interfaceBuiltin
- Returns:
- the cloned built-in
-