Class DirectLess
java.lang.Object
com.semedy.reasoner.builtin.directfilter.DirectLess
- All Implemented Interfaces:
Builtin,Receiver,DirectFilterBuiltin
- Author:
- angele
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRelation(ReasoningRelation relation) add a whole relation at the beginningvoidclear()frees up allocated resourcesclone the builtinvoidevaluate()voidcall back function.String[]get descriptions for the different argumentsintgetArity()arity of the tuplesget a description for the builtingetName()get the name of the builtinstatic intget the basic tuple storegetType()get the type of the builtinlongthe weight of the builtin.voidinitialize the builtinbooleanisEvaluable(BitSet grounds, BitSet variableInstantiations, Object[] args) is builtin evaluable with a certain instantiation of variablesbooleanis it a builtin for internal use onlyobjectGeneratingArguments(BitSet grounds, BitSet variableInstantiations, Object[] args) In which argument position are new objects createdbooleandoes the builtin read the symbol tablebooleanreceiveRelation(ReasoningRelation relation) receive a whole relationbooleanreceiveTuple(int tuple) receive a single tuplebooleanreceiveTuple(long[] tuple) receive a single tuplebooleanreceiveTuple(TupleBuffer tuple) receive a single tuplestatic voidvoidsetParameters(BuiltinReceiver receiver, int sourceArity, int destArity, BitSet variablePositions) set parametersvoidsetProperties(Properties prp) set the sytem propertiesvoidsetSymbolTable(SymbolTable symbolTable) set the symbol tablestartTuples(Receiver source, boolean check4Duplicates) start delivering single tuplesvoidtuplesFinished(boolean isBottomUp) finish delivering single tuplesvoidtuplesFinished(String annotation, ReasoningRelation T1, ReasoningRelation T2) Finish delivering single tuples.booleandoes the builtin write into the symbol table
-
Constructor Details
-
DirectLess
public DirectLess()
-
-
Method Details
-
getName
Description copied from interface:Builtinget the name of the builtin -
setProperties
Description copied from interface:Builtinset the sytem properties- Parameters:
prp- , properties
-
cloneBuiltin
Description copied from interface:Builtinclone the builtin- Specified by:
cloneBuiltinin interfaceBuiltin- Returns:
- the cloned built-in
-
resetTestCode
public static void resetTestCode() -
getTestCode
public static int getTestCode() -
setParameters
public void setParameters(BuiltinReceiver receiver, int sourceArity, int destArity, BitSet variablePositions) Description copied from interface:DirectFilterBuiltinset parameters- Specified by:
setParametersin interfaceDirectFilterBuiltin- Parameters:
receiver- , the callback to get resultssourceArity- , the source aritydestArity- , the destination arityvariablePositions- , the variables from left
-
isEvaluable
public boolean isEvaluable(BitSet grounds, BitSet variableInstantiations, Object[] args) throws BuiltinException Description copied from interface:Builtinis builtin evaluable with a certain 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
Description copied from interface:Builtininitialize the builtin- Specified by:
initin interfaceBuiltin- Parameters:
args- , the builtin arguments- Throws:
InterruptedExceptionIOExceptionSemReasonerException
-
evaluationFinished
Description copied from interface:Builtincall back function. Is called when the whole evaluation has been finished- Specified by:
evaluationFinishedin interfaceBuiltin- Throws:
BuiltinExceptionInterruptedException
-
setSymbolTable
Description copied from interface:Builtinset the symbol table- Specified by:
setSymbolTablein interfaceBuiltin- Parameters:
symbolTable- , the symbol table
-
getWeight
Description copied from interface:Builtinthe weight of the builtin. Determines when the builtin is executed in a rule -
objectGeneratingArguments
public BitSet objectGeneratingArguments(BitSet grounds, BitSet variableInstantiations, Object[] args) throws BuiltinException Description copied from interface:BuiltinIn which argument position are new objects created- 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
-
getArity
public int getArity()Description copied from interface:Receiverarity of the tuples -
getType
Description copied from interface:Builtinget the type of the builtin -
isInternal
public boolean isInternal()Description copied from interface:Builtinis it a builtin for internal use only- Specified by:
isInternalin interfaceBuiltin- Returns:
-
getArgumentDescriptions
Description copied from interface:Builtinget descriptions for the different arguments- Specified by:
getArgumentDescriptionsin interfaceBuiltin- Returns:
- a description of the arguments of the built-in
-
getDescription
Description copied from interface:Builtinget a description for the builtin- Specified by:
getDescriptionin interfaceBuiltin- Returns:
- a description of the built-in
-
readsSymbolTable
public boolean readsSymbolTable()Description copied from interface:Builtindoes the builtin read the symbol table- Specified by:
readsSymbolTablein interfaceBuiltin- Returns:
- true if it reads the symbol table
-
writesSymbolTable
public boolean writesSymbolTable()Description copied from interface:Builtindoes the builtin write into the symbol table- Specified by:
writesSymbolTablein interfaceBuiltin- Returns:
- true if it writes to the symbol table
-
receiveRelation
public boolean receiveRelation(ReasoningRelation relation) throws SemReasonerException, InterruptedException, IOException Description copied from interface:Receiverreceive a whole relation- Specified by:
receiveRelationin interfaceReceiver- Parameters:
relation- the whole relation to be received- Returns:
- true, if relation is later on dissolved, false otherwise
- Throws:
ReasoningExceptionInterruptedExceptionIOExceptionSemReasonerException
-
evaluate
public void evaluate() -
clear
public void clear()Description copied from interface:Builtinfrees up allocated resources -
startTuples
Description copied from interface:Receiverstart delivering single tuples- Specified by:
startTuplesin interfaceReceiver- Parameters:
source- , the delivering processcheck4Duplicates- , check for duplicates in the target store- Returns:
- an object receiving the results
- Throws:
IOException
-
tuplesFinished
public void tuplesFinished(boolean isBottomUp) throws SemReasonerException, InterruptedException, IOException Description copied from interface:Receiverfinish delivering single tuples- Specified by:
tuplesFinishedin interfaceReceiver- Parameters:
isBottomUp- TODO- Throws:
ReasoningExceptionSemReasonerExceptionInterruptedExceptionIOException
-
tuplesFinished
public void tuplesFinished(String annotation, ReasoningRelation T1, ReasoningRelation T2) throws SemReasonerException, InterruptedException, IOException Description copied from interface:ReceiverFinish delivering single tuples.
Cache result and annotate result.- Specified by:
tuplesFinishedin interfaceReceiver- Parameters:
annotation- , an annotation used for cachingT1- , the relations which have been combinedT2- , the relations which have been combined- Throws:
ReasoningExceptionSemReasonerExceptionInterruptedExceptionIOException
-
addRelation
Description copied from interface:Receiveradd a whole relation at the beginning- Specified by:
addRelationin interfaceReceiver- Parameters:
relation- the relation to be added
-
getTupleStore
Description copied from interface:Receiverget the basic tuple store- Specified by:
getTupleStorein interfaceReceiver- Returns:
- the tuple store
-
receiveTuple
public boolean receiveTuple(long[] tuple) throws SemReasonerException, InterruptedException, IOException Description copied from interface:Receiverreceive a single tuple- Specified by:
receiveTuplein interfaceReceiver- Parameters:
tuple- the tuple to be received- Returns:
- true if tuple has been used (tuple cannot be free'd up)
- Throws:
SemReasonerExceptionInterruptedExceptionIOException
-
receiveTuple
public boolean receiveTuple(int tuple) throws SemReasonerException, InterruptedException, IOException Description copied from interface:Receiverreceive a single tuple- Specified by:
receiveTuplein interfaceReceiver- Parameters:
tuple- the tuple to be received- Returns:
- true if tuple has been used (tuple cannot be free'd up)
- Throws:
SemReasonerExceptionInterruptedExceptionIOException
-
receiveTuple
public boolean receiveTuple(TupleBuffer tuple) throws SemReasonerException, InterruptedException, IOException Description copied from interface:Receiverreceive a single tuple- Specified by:
receiveTuplein interfaceReceiver- Parameters:
tuple- the tuple to be received- Returns:
- true if tuple has been used (tuple cannot be free'd up)
- Throws:
ReasoningExceptionSemReasonerExceptionInterruptedExceptionIOException
-