Serializable
, Cloneable
, Comparable<AbstractTerm>
, AbstractTerm
, Plugin
Abbreviation.Abbreviate
, Anticipate
, Believe
, Consider
, Doubt
, Evaluate
, Feel
, FunctionOperator
, Hesitate
, Name
, NullOperator
, Register
, Remind
, Want
, Wonder
public abstract class Operator extends Term implements Plugin
This is the only file to modify when registering a new operator into NARS.
Modifier and Type | Class | Description |
---|---|---|
static class |
Operator.ExecutionResult |
Term.TermVisitor
EmptyTermArray, imagination, index_variable, SELF, SEQ_SPATIAL, SEQ_TEMPORAL, term_indices
Modifier | Constructor | Description |
---|---|---|
protected |
Operator() |
|
protected |
Operator(String name) |
Modifier and Type | Method | Description |
---|---|---|
static String |
addPrefixIfMissing(String opName) |
|
boolean |
call(Operation operation,
Term[] args,
Memory memory,
Timable time) |
The standard way to carry out an operation, which invokes the execute
method defined for the operator, and handles feedback tasks as input
|
boolean |
call(Operation op,
Memory memory,
Timable time) |
|
Operator |
clone() |
Make a new Term with the same name.
|
protected abstract List<Task> |
execute(Operation operation,
Term[] args,
Memory memory,
Timable time) |
Required method for every operator, specifying the corresponding
operation
|
static String |
operationExecutionString(Statement operation) |
|
static void |
reportExecution(Operation operation,
Term[] args,
Object feedback,
Memory memory) |
|
boolean |
setEnabled(Nar n,
boolean enabled) |
called when plugin is activated (enabled = true) / deactivated (enabled=false)
|
finalize, getClass, notify, notifyAll, wait, wait, wait
cloneDeep, compareTo, containedTemporalRelations, containsTerm, containsTermRecursively, countTermRecursively, equals, get, get, getComplexity, getIsSpatial, getTemporalOrder, hashCode, hasInterval, hasVar, hasVar, hasVarDep, hasVarIndep, hasVarQuery, isConstant, isExecutable, isHigherOrderStatement, isSelf, name, nameInternal, operator, recurseSubtermsContainingVariables, recurseSubtermsContainingVariables, recurseTerms, setName, subjectOrPredicateIsIndependentVar, text, toSortedSet, toSortedSetArray, toString, valid
protected Operator()
protected Operator(String name)
public boolean setEnabled(Nar n, boolean enabled)
Plugin
setEnabled
in interface Plugin
protected abstract List<Task> execute(Operation operation, Term[] args, Memory memory, Timable time)
args
- Arguments of the operation, both input (constant) and output (variable)memory
- The memory to work onpublic final boolean call(Operation operation, Term[] args, Memory memory, Timable time)
operation
- The operator to be executedargs
- The arguments to be taken by the operatormemory
- The memory on which the operation is executedtime
- used to retrieve the timepublic Operator clone()
Term
public static void reportExecution(Operation operation, Term[] args, Object feedback, Memory memory)
Copyright © 2020 OpenNARS. All rights reserved.