nars.operation
Class Operator

java.lang.Object
  extended by nars.language.Term
      extended by nars.operation.Operator
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable<Term>
Direct Known Subclasses:
Break, GoTo, Open, Pick

public abstract class Operator
extends Term

An individual operator that can be execute by the system, though implemented outside NARS.

This is the only file to modify when adding a new operator into NARS.


Field Summary
 
Fields inherited from class nars.language.Term
name
 
Constructor Summary
Operator(java.lang.String name)
           
 
Method Summary
 void call(Task task)
          Execute an operation, then handle feedback
abstract  java.util.ArrayList<Task> execute(Task task)
          Required method for every operation, specifying the operation
static java.util.HashMap<java.lang.String,Operator> setOperators()
          Register all built-in operators in the Memory
private  void showExecution(Statement operation)
          Display a message in the output stream to indicate the execution of an operation
 
Methods inherited from class nars.language.Term
clone, compareTo, equals, getComplexity, getConstantName, getName, getOrder, hashCode, isConstant, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Operator

public Operator(java.lang.String name)
Method Detail

execute

public abstract java.util.ArrayList<Task> execute(Task task)
Required method for every operation, specifying the operation

Parameters:
task - The task with the arguments to be passed to the operator
Returns:
The direct collectable results and feedback of the execution

call

public void call(Task task)
Execute an operation, then handle feedback

Parameters:
task - The task to be executed

setOperators

public static java.util.HashMap<java.lang.String,Operator> setOperators()
Register all built-in operators in the Memory

The only method to modify when adding a new operator into NARS. An operator name should contain at least two characters after '^'.

Returns:
A Map between Operator name and object

showExecution

private void showExecution(Statement operation)
Display a message in the output stream to indicate the execution of an operation

Parameters:
operation - The content of the operation to be executed