nars.entity
Class Concept

java.lang.Object
  extended by nars.entity.BudgetValue
      extended by nars.entity.Item
          extended by nars.entity.Concept
All Implemented Interfaces:
java.lang.Cloneable

public final class Concept
extends Item

A concept contains information associated with a term, including directly and indirectly related tasks and beliefs.

To make sure the space will be released, the only allowed reference to a concept are those in a ConceptBag. All other access go through the Term that names the concept.


Field Summary
private  java.util.ArrayList<Judgment> pastRecords
          Judgments directly made about the term, with non-future tense
private  java.util.ArrayList<Goal> pendingGoals
          Goals directly requested on the term
private  java.util.ArrayList<Question> pendingQuestions
          Question directly asked about the term
private  java.util.ArrayList<Judgment> predictions
          Judgments directly made about the term, with future tense
private  Judgment presentBelief
          Most recent and confidence judgment
private  boolean revisible
          Whether truth value of judgments can be revised
private  boolean showing
          Whether the content of the concept is being displayed
private  TaskLinkBag taskLinks
          Task links for indirect processing
private  Term term
          The term is the unique ID of the concept
private  TermLinkBag termLinks
          Term links between the term and its components and compounds
private  java.util.ArrayList<TermLink> termLinkTemplates
          Link templates of TermLink, only in concepts with CompoundTerm
private  ConceptWindow window
          The display window
 
Fields inherited from class nars.entity.Item
key
 
Fields inherited from class nars.entity.BudgetValue
durability, priority, quality
 
Constructor Summary
Concept(Term tm)
          Constructor, called in Memory.getConcept only
 
Method Summary
private  void addToTable(Judgment newJudgment, java.util.ArrayList table, int capacity)
          Add a new belief or goal into the table Sort the beliefs/goals by rank, and remove redundant or low rank one
 void buildTermLinks(BudgetValue budget)
          Recursively build TermLinks between a compound and its components
private  void checkRevisibility()
          Judgments with dependent variable cannot be revised
 void directProcess(Task task)
          Directly process a new task.
private  java.lang.String displayContent()
          Collect direct belief, questions, and goals for display
 void fire()
          An atomic step in a concept, only called in Memory.processConcept
 Judgment getBelief(Task task)
          Select a belief to interact with the given task in inference
 float getQuality()
          Recalculate the quality of the concept [to be refined]
 Term getTerm()
          Return the assocated term, called from Memory only
 java.util.ArrayList<TermLink> getTermLinkTemplates()
          Return the templates for TermLinks, only called in Memory.continuedProcess
 void insertTaskLink(TaskLink taskLink)
          Insert a TaskLink into the TaskLink bag
 void insertTermLink(TermLink termLink)
          Insert a TermLink into the TermLink bag
 void play()
          Resume display, called from ConceptWindow only
private  void processGoal(Goal goal, Task task)
          Direct processing a new goal
private  void processJudgment(Judgment judg, Task task)
          To accept a new judgment as belief, and check for revisions and solutions
private  void processQuestion(Question ques, Task task)
          To answer a question by existing beliefs
private  boolean reviseTable(Judgment newSentence, Task task, java.util.ArrayList table)
          Revise existing beliefs or goals
 void startPlay()
          Start displaying contents and links, called from ConceptWindow only
 void stop()
          Stop display, called from ConceptWindow only
 java.lang.String toString()
          Return a string representation of the concept, called in ConceptBag only
private  void tryUpdate(Judgment judg)
          To temporalRevision the presentBelief
 
Methods inherited from class nars.entity.Item
getBudget, getKey
 
Methods inherited from class nars.entity.BudgetValue
aboveThreshold, clone, decDurability, decPriority, decQuality, getDurability, getPriority, incDurability, incPriority, incQuality, merge, setDurability, setPriority, setQuality, summary, toString2
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

term

private Term term
The term is the unique ID of the concept


taskLinks

private TaskLinkBag taskLinks
Task links for indirect processing


termLinks

private TermLinkBag termLinks
Term links between the term and its components and compounds


termLinkTemplates

private java.util.ArrayList<TermLink> termLinkTemplates
Link templates of TermLink, only in concepts with CompoundTerm


pendingQuestions

private java.util.ArrayList<Question> pendingQuestions
Question directly asked about the term


pendingGoals

private java.util.ArrayList<Goal> pendingGoals
Goals directly requested on the term


pastRecords

private java.util.ArrayList<Judgment> pastRecords
Judgments directly made about the term, with non-future tense


predictions

private java.util.ArrayList<Judgment> predictions
Judgments directly made about the term, with future tense


presentBelief

private Judgment presentBelief
Most recent and confidence judgment


revisible

private boolean revisible
Whether truth value of judgments can be revised


showing

private boolean showing
Whether the content of the concept is being displayed


window

private ConceptWindow window
The display window

Constructor Detail

Concept

public Concept(Term tm)
Constructor, called in Memory.getConcept only

Parameters:
tm - A term corresponding to the concept
Method Detail

checkRevisibility

private void checkRevisibility()
Judgments with dependent variable cannot be revised


directProcess

public void directProcess(Task task)
Directly process a new task. Called exactly once on each task. Using local information and finishing in a constant time. Provide feedback in the budget value of the task.

called in Memory.immediateProcess only

Parameters:
task - The task to be processed

processQuestion

private void processQuestion(Question ques,
                             Task task)
To answer a question by existing beliefs

Parameters:
ques - The question to be answered
task - The task to be processed

processGoal

private void processGoal(Goal goal,
                         Task task)
Direct processing a new goal

Parameters:
goal - The goal to be processed
task - The task to be processed

processJudgment

private void processJudgment(Judgment judg,
                             Task task)
To accept a new judgment as belief, and check for revisions and solutions

Parameters:
judg - The judgment to be accepted
task - The task to be processed

reviseTable

private boolean reviseTable(Judgment newSentence,
                            Task task,
                            java.util.ArrayList table)
Revise existing beliefs or goals

Parameters:
task - The task to be processed
table - The table to be revised
Returns:
Whether the new belief triggered a temporalRevision

tryUpdate

private void tryUpdate(Judgment judg)
To temporalRevision the presentBelief

Parameters:
judg - The new belief

addToTable

private void addToTable(Judgment newJudgment,
                        java.util.ArrayList table,
                        int capacity)
Add a new belief or goal into the table Sort the beliefs/goals by rank, and remove redundant or low rank one

Parameters:
newJudgment - The judgment to be processed
table - The table to be revised
capacity - The capacity of the table

insertTaskLink

public void insertTaskLink(TaskLink taskLink)
Insert a TaskLink into the TaskLink bag

called only from Memory.continuedProcess

Parameters:
taskLink - The termLink to be inserted

buildTermLinks

public void buildTermLinks(BudgetValue budget)
Recursively build TermLinks between a compound and its components

called only from Memory.continuedProcess

Parameters:
budget - The budget of the task

insertTermLink

public void insertTermLink(TermLink termLink)
Insert a TermLink into the TermLink bag

called from buildTermLinks only

Parameters:
termLink - The termLink to be inserted

getTerm

public Term getTerm()
Return the assocated term, called from Memory only

Returns:
The assocated term

toString

public java.lang.String toString()
Return a string representation of the concept, called in ConceptBag only

Overrides:
toString in class BudgetValue
Returns:
The concept name, with budget in the full version

getQuality

public float getQuality()
Recalculate the quality of the concept [to be refined]

Overrides:
getQuality in class BudgetValue
Returns:
The quality value

getTermLinkTemplates

public java.util.ArrayList<TermLink> getTermLinkTemplates()
Return the templates for TermLinks, only called in Memory.continuedProcess

Returns:
The template get

getBelief

public Judgment getBelief(Task task)
Select a belief to interact with the given task in inference

get the first qualified one

only called in RuleTables.reason

Parameters:
task - The selected task
Returns:
The selected belief

fire

public void fire()
An atomic step in a concept, only called in Memory.processConcept


startPlay

public void startPlay()
Start displaying contents and links, called from ConceptWindow only


play

public void play()
Resume display, called from ConceptWindow only


stop

public void stop()
Stop display, called from ConceptWindow only


displayContent

private java.lang.String displayContent()
Collect direct belief, questions, and goals for display

Returns:
String representation of direct content