nars.main
Class Memory

java.lang.Object
  extended by nars.main.Memory

public class Memory
extends java.lang.Object

The memory of the system.


Field Summary
private static ConceptBag concepts
          Concept bag.
static Judgment currentBelief
          Shortcut to the selected belief
static TermLink currentBeliefLink
          Shortcut to the selected TermLink
static Stamp currentStamp
          Shortcut to the derived Stamp
static Task currentTask
          Shortcut to the selected Task
static TaskLink currentTaskLink
          Shortcut to the selected TaskLink
static TemporalValue currentTense
          Shortcut to the derived tense
static Term currentTerm
          Shortcut to the selected Term
private static java.util.ArrayList<Task> newTasks
          List of inference newTasks, to be processed in the next working cycle
private static TaskBuffer novelTasks
          New tasks with novel composed terms, for delayed and selective processing
private static java.util.HashMap<java.lang.String,Operator> operators
          Operators (built-in terms) table.
private static TaskBuffer recentEvents
          List of recent events, for temporal learning
 
Constructor Summary
Memory()
           
 
Method Summary
static void activateConcept(Concept c, BudgetValue b)
          Adjust the activation level of a Concept
static void activatedTask(BudgetValue budget, Sentence sentence, boolean isInput)
          Activated task coming from MatchingRules.trySolution
static void conceptsStartPlay(java.lang.String s)
          Display active concepts, called from MainWindow.
private static void continuedProcess(Task task, Term content)
          Link to a new task from all relevant concepts for continued processing in the near future for unspecified time.
static void convertedJudgment(TruthValue truth, BudgetValue budget)
          Convert jusgment into different relation
static void cycle()
          An atomic working cycle of the system: process new Tasks, then fire a concept
private static void derivedTask(Task task)
          Derived task comes from the inference rules.
static void doublePremiseTask(BudgetValue budget, Term content, TruthValue truth)
          Shared final operations by all double-premise rules, called from the rules except StructuralRules
private static void eventProcessing(Task event1)
          Simple temporal regularity discovery [To be refined]
static void executedTask(Task task)
          Reporting executed task, and remember the event
static Concept getConcept(Term term)
          Get the Concept associated to a Term, or create it.
private static void immediateProcess(Task task)
          Imediate processing of a new task, in constant time Local processing, in one concept only
static void init()
          Initialize a new memory by creating all members.
static void inputTask(Task task)
          Input task processing.
static Concept nameToConcept(java.lang.String name)
          Get an existing Concept for a given name
static Term nameToListedTerm(java.lang.String name)
          Get a Term for a given name of a Concept or Operator
static Operator nameToOperator(java.lang.String name)
          Check if a string is an operator name
static void newTasksStartPlay(java.lang.String s)
          Display newd tasks, called from MainWindow.
static java.lang.String newTasksToString()
          Prepare buffered tasks for display, called from TaskBuffer.
static boolean noResult()
          Check if there is already any derived Task in the current cycle
private static void processConcept()
          Select a concept to fire.
private static void processTask()
          Process the newTasks accumulated in the previous cycle, accept input ones and those that corresponding to existing concepts, plus one from the buffer.
static void report(Sentence sentence, boolean input)
          Display input/output sentence in the MainWindow.
static void singlePremiseTask(BudgetValue budget, Term content, TruthValue truth)
          Shared final operations by all single-premise rules, called in StructuralRules
static Concept termToConcept(Term term)
          Get an existing Concept for a given Term.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

concepts

private static ConceptBag concepts
Concept bag. Containing all Concepts of the system


operators

private static java.util.HashMap<java.lang.String,Operator> operators
Operators (built-in terms) table. Accessed by name


newTasks

private static java.util.ArrayList<Task> newTasks
List of inference newTasks, to be processed in the next working cycle


novelTasks

private static TaskBuffer novelTasks
New tasks with novel composed terms, for delayed and selective processing


recentEvents

private static TaskBuffer recentEvents
List of recent events, for temporal learning


currentTerm

public static Term currentTerm
Shortcut to the selected Term


currentTaskLink

public static TaskLink currentTaskLink
Shortcut to the selected TaskLink


currentTask

public static Task currentTask
Shortcut to the selected Task


currentBeliefLink

public static TermLink currentBeliefLink
Shortcut to the selected TermLink


currentBelief

public static Judgment currentBelief
Shortcut to the selected belief


currentStamp

public static Stamp currentStamp
Shortcut to the derived Stamp


currentTense

public static TemporalValue currentTense
Shortcut to the derived tense

Constructor Detail

Memory

public Memory()
Method Detail

init

public static void init()
Initialize a new memory by creating all members.

Called in Center.reset only


nameToListedTerm

public static Term nameToListedTerm(java.lang.String name)
Get a Term for a given name of a Concept or Operator

called in StringParser and the make methods of compound terms.

Parameters:
name - the name of a concept or operator
Returns:
a Term or null (if no Concept/Operator has this name)

nameToOperator

public static Operator nameToOperator(java.lang.String name)
Check if a string is an operator name

called in StringParser only.

Parameters:
name - the name of a possible operator
Returns:
the corresponding operator or null

nameToConcept

public static Concept nameToConcept(java.lang.String name)
Get an existing Concept for a given name

called from Term and ConceptWindow.

Parameters:
name - the name of a concept
Returns:
a Concept or null

termToConcept

public static Concept termToConcept(Term term)
Get an existing Concept for a given Term.

Parameters:
term - The Term naming a concept
Returns:
a Concept or null

getConcept

public static Concept getConcept(Term term)
Get the Concept associated to a Term, or create it.

Parameters:
term - indicating the concept
Returns:
an existing Concept, or a new one

activateConcept

public static void activateConcept(Concept c,
                                   BudgetValue b)
Adjust the activation level of a Concept

called in Concept.insertTaskLink only

Parameters:
c - the concept to be adusted
b - the new BudgetValue

noResult

public static boolean noResult()
Check if there is already any derived Task in the current cycle

called in Concept.fire only

Returns:
Whether in the current cycle there is already derived Task

inputTask

public static void inputTask(Task task)
Input task processing.

Parameters:
task - the input task

derivedTask

private static void derivedTask(Task task)
Derived task comes from the inference rules.

Parameters:
task - the derived task

executedTask

public static void executedTask(Task task)
Reporting executed task, and remember the event

called from Operator.call only

Parameters:
task - the executed task

activatedTask

public static void activatedTask(BudgetValue budget,
                                 Sentence sentence,
                                 boolean isInput)
Activated task coming from MatchingRules.trySolution

Parameters:
budget - The budget value of the new Task
sentence - The content of the new Task
isInput - Whether the question is input

doublePremiseTask

public static void doublePremiseTask(BudgetValue budget,
                                     Term content,
                                     TruthValue truth)
Shared final operations by all double-premise rules, called from the rules except StructuralRules

Parameters:
budget - The budget value of the new task
content - The content of the new task
truth - The truth value of the new task

singlePremiseTask

public static void singlePremiseTask(BudgetValue budget,
                                     Term content,
                                     TruthValue truth)
Shared final operations by all single-premise rules, called in StructuralRules

Parameters:
budget - The budget value of the new task
content - The content of the new task
truth - The truth value of the new task

convertedJudgment

public static void convertedJudgment(TruthValue truth,
                                     BudgetValue budget)
Convert jusgment into different relation

called in MatchingRules

Parameters:
budget - The budget value of the new task
truth - The truth value of the new task

cycle

public static void cycle()
An atomic working cycle of the system: process new Tasks, then fire a concept

Called from Center.tick only


processTask

private static void processTask()
Process the newTasks accumulated in the previous cycle, accept input ones and those that corresponding to existing concepts, plus one from the buffer.


processConcept

private static void processConcept()
Select a concept to fire.


immediateProcess

private static void immediateProcess(Task task)
Imediate processing of a new task, in constant time Local processing, in one concept only

Parameters:
task - the task to be accepted

continuedProcess

private static void continuedProcess(Task task,
                                     Term content)
Link to a new task from all relevant concepts for continued processing in the near future for unspecified time.

The only method that calls the TaskLink constructor.

Parameters:
task - The task to be linked
content - The content of the task

eventProcessing

private static void eventProcessing(Task event1)
Simple temporal regularity discovery [To be refined]

called in Memory.immediateProcess

Parameters:
event1 - A new event

conceptsStartPlay

public static void conceptsStartPlay(java.lang.String s)
Display active concepts, called from MainWindow.

Parameters:
s - the window title

newTasksStartPlay

public static void newTasksStartPlay(java.lang.String s)
Display newd tasks, called from MainWindow.

Parameters:
s - the window title

newTasksToString

public static java.lang.String newTasksToString()
Prepare buffered tasks for display, called from TaskBuffer.

Returns:
the tasks as a String

report

public static void report(Sentence sentence,
                          boolean input)
Display input/output sentence in the MainWindow.

Parameters:
sentence - the sentence to be displayed
input - whether the task is input