Class DirectLess
java.lang.Object
com.semedy.reasoner.builtin.directfilter.DirectLess
- All Implemented Interfaces:
Builtin
,Receiver
,DirectFilterBuiltin
- Author:
- angele
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addRelation
(ReasoningRelation relation) add a whole relation at the beginningvoid
clear()
frees up allocated resourcesclone the builtinvoid
evaluate()
void
call back function.String[]
get descriptions for the different argumentsint
getArity()
arity of the tuplesget a description for the builtingetName()
get the name of the builtinstatic int
get the basic tuple storegetType()
get the type of the builtinlong
the weight of the builtin.void
initialize the builtinboolean
isEvaluable
(BitSet grounds, BitSet variableInstantiations, Object[] args) is builtin evaluable with a certain instantiation of variablesboolean
is it a builtin for internal use onlyobjectGeneratingArguments
(BitSet grounds, BitSet variableInstantiations, Object[] args) In which argument position are new objects createdboolean
does the builtin read the symbol tableboolean
receiveRelation
(ReasoningRelation relation) receive a whole relationboolean
receiveTuple
(int tuple) receive a single tupleboolean
receiveTuple
(long[] tuple) receive a single tupleboolean
receiveTuple
(TupleBuffer tuple) receive a single tuplestatic void
void
setParameters
(BuiltinReceiver receiver, int sourceArity, int destArity, BitSet variablePositions) set parametersvoid
setProperties
(Properties prp) set the sytem propertiesvoid
setSymbolTable
(SymbolTable symbolTable) set the symbol tablestartTuples
(Receiver source, boolean check4Duplicates) start delivering single tuplesvoid
tuplesFinished
(boolean isBottomUp) finish delivering single tuplesvoid
tuplesFinished
(String annotation, ReasoningRelation T1, ReasoningRelation T2) Finish delivering single tuples.boolean
does the builtin write into the symbol table
-
Constructor Details
-
DirectLess
public DirectLess()
-
-
Method Details
-
getName
Description copied from interface:Builtin
get the name of the builtin -
setProperties
Description copied from interface:Builtin
set the sytem properties- Parameters:
prp
- , properties
-
cloneBuiltin
Description copied from interface:Builtin
clone the builtin- Specified by:
cloneBuiltin
in 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:DirectFilterBuiltin
set parameters- Specified by:
setParameters
in 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:Builtin
is builtin evaluable with a certain 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
Description copied from interface:Builtin
initialize the builtin- Specified by:
init
in interfaceBuiltin
- Parameters:
args
- , the builtin arguments- Throws:
InterruptedException
IOException
SemReasonerException
-
evaluationFinished
Description copied from interface:Builtin
call back function. Is called when the whole evaluation has been finished- Specified by:
evaluationFinished
in interfaceBuiltin
- Throws:
BuiltinException
InterruptedException
-
setSymbolTable
Description copied from interface:Builtin
set the symbol table- Specified by:
setSymbolTable
in interfaceBuiltin
- Parameters:
symbolTable
- , the symbol table
-
getWeight
Description copied from interface:Builtin
the 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:Builtin
In which argument position are new objects created- 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
-
getArity
public int getArity()Description copied from interface:Receiver
arity of the tuples -
getType
Description copied from interface:Builtin
get the type of the builtin -
isInternal
public boolean isInternal()Description copied from interface:Builtin
is it a builtin for internal use only- Specified by:
isInternal
in interfaceBuiltin
- Returns:
-
getArgumentDescriptions
Description copied from interface:Builtin
get descriptions for the different arguments- Specified by:
getArgumentDescriptions
in interfaceBuiltin
- Returns:
- a description of the arguments of the built-in
-
getDescription
Description copied from interface:Builtin
get a description for the builtin- Specified by:
getDescription
in interfaceBuiltin
- Returns:
- a description of the built-in
-
readsSymbolTable
public boolean readsSymbolTable()Description copied from interface:Builtin
does the builtin read the symbol table- Specified by:
readsSymbolTable
in interfaceBuiltin
- Returns:
- true if it reads the symbol table
-
writesSymbolTable
public boolean writesSymbolTable()Description copied from interface:Builtin
does the builtin write into the symbol table- Specified by:
writesSymbolTable
in interfaceBuiltin
- Returns:
- true if it writes to the symbol table
-
receiveRelation
public boolean receiveRelation(ReasoningRelation relation) throws SemReasonerException, InterruptedException, IOException Description copied from interface:Receiver
receive a whole relation- Specified by:
receiveRelation
in interfaceReceiver
- Parameters:
relation
- the whole relation to be received- Returns:
- true, if relation is later on dissolved, false otherwise
- Throws:
ReasoningException
InterruptedException
IOException
SemReasonerException
-
evaluate
public void evaluate() -
clear
public void clear()Description copied from interface:Builtin
frees up allocated resources -
startTuples
Description copied from interface:Receiver
start delivering single tuples- Specified by:
startTuples
in 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:Receiver
finish delivering single tuples- Specified by:
tuplesFinished
in interfaceReceiver
- Parameters:
isBottomUp
- TODO- Throws:
ReasoningException
SemReasonerException
InterruptedException
IOException
-
tuplesFinished
public void tuplesFinished(String annotation, ReasoningRelation T1, ReasoningRelation T2) throws SemReasonerException, InterruptedException, IOException Description copied from interface:Receiver
Finish delivering single tuples.
Cache result and annotate result.- Specified by:
tuplesFinished
in interfaceReceiver
- Parameters:
annotation
- , an annotation used for cachingT1
- , the relations which have been combinedT2
- , the relations which have been combined- Throws:
ReasoningException
SemReasonerException
InterruptedException
IOException
-
addRelation
Description copied from interface:Receiver
add a whole relation at the beginning- Specified by:
addRelation
in interfaceReceiver
- Parameters:
relation
- the relation to be added
-
getTupleStore
Description copied from interface:Receiver
get the basic tuple store- Specified by:
getTupleStore
in interfaceReceiver
- Returns:
- the tuple store
-
receiveTuple
public boolean receiveTuple(long[] tuple) throws SemReasonerException, InterruptedException, IOException Description copied from interface:Receiver
receive a single tuple- Specified by:
receiveTuple
in interfaceReceiver
- Parameters:
tuple
- the tuple to be received- Returns:
- true if tuple has been used (tuple cannot be free'd up)
- Throws:
SemReasonerException
InterruptedException
IOException
-
receiveTuple
public boolean receiveTuple(int tuple) throws SemReasonerException, InterruptedException, IOException Description copied from interface:Receiver
receive a single tuple- Specified by:
receiveTuple
in interfaceReceiver
- Parameters:
tuple
- the tuple to be received- Returns:
- true if tuple has been used (tuple cannot be free'd up)
- Throws:
SemReasonerException
InterruptedException
IOException
-
receiveTuple
public boolean receiveTuple(TupleBuffer tuple) throws SemReasonerException, InterruptedException, IOException Description copied from interface:Receiver
receive a single tuple- Specified by:
receiveTuple
in interfaceReceiver
- Parameters:
tuple
- the tuple to be received- Returns:
- true if tuple has been used (tuple cannot be free'd up)
- Throws:
ReasoningException
SemReasonerException
InterruptedException
IOException
-