nars.language
Class Term

java.lang.Object
  extended by nars.language.Term
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable<Term>
Direct Known Subclasses:
CompoundTerm, Operator, Variable

public class Term
extends java.lang.Object
implements java.lang.Cloneable, java.lang.Comparable<Term>

Term is the basic component of Narsese, and the object of processing in NARS.

A Term may have an associated Concept containing relations with other Terms. It is not linked in the Term, because a Concept may be forgot, while the Term exists.


Field Summary
protected  java.lang.String name
          A Term is identified uniquely by its name, a sequence of characters in a given alphabet (ASCII or Unicode)
 
Constructor Summary
protected Term()
          Default constructor
  Term(java.lang.String name)
          Constructor with a given name
 
Method Summary
 java.lang.Object clone()
          Make a new Term with the same name.
 int compareTo(Term that)
          Check the relative order of two Terms.
 boolean equals(java.lang.Object that)
          Equal terms have identical name, though not necessarily the same reference.
 int getComplexity()
          The syntactic complexity, for constant automic Term, is 1.
 java.lang.String getConstantName()
          Default, to be overrided in variable Terms.
 java.lang.String getName()
          Reporting the name of the current Term.
 TemporalValue getOrder()
          Get the temporal order in a term, which is null by default
 int hashCode()
          Produce a hash code for the term
 boolean isConstant()
          Check whether the current Term can name a Concept.
 java.lang.String toString()
          The same as getName, used in display.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected java.lang.String name
A Term is identified uniquely by its name, a sequence of characters in a given alphabet (ASCII or Unicode)

Constructor Detail

Term

protected Term()
Default constructor


Term

public Term(java.lang.String name)
Constructor with a given name

Parameters:
name - A String as the name of the Term
Method Detail

toString

public final java.lang.String toString()
The same as getName, used in display.

Overrides:
toString in class java.lang.Object
Returns:
The name of the term as a String

getName

public java.lang.String getName()
Reporting the name of the current Term.

Returns:
The name of the term as a String

getConstantName

public java.lang.String getConstantName()
Default, to be overrided in variable Terms.

Returns:
The name of the term as a String

clone

public java.lang.Object clone()
Make a new Term with the same name.

Overrides:
clone in class java.lang.Object
Returns:
The new Term

equals

public boolean equals(java.lang.Object that)
Equal terms have identical name, though not necessarily the same reference.

Overrides:
equals in class java.lang.Object
Parameters:
that - The Term to be compared with the current Term
Returns:
Whether the two Terms are equal

hashCode

public int hashCode()
Produce a hash code for the term

Overrides:
hashCode in class java.lang.Object
Returns:
An integer hash code

getComplexity

public int getComplexity()
The syntactic complexity, for constant automic Term, is 1.

Returns:
The conplexity of the term, an integer

compareTo

public final int compareTo(Term that)
Check the relative order of two Terms.

based on the constant part first

Specified by:
compareTo in interface java.lang.Comparable<Term>
Parameters:
that - The Term to be compared with the current Term
Returns:
The same as compareTo as defined on Strings when the constant parts are compared

isConstant

public boolean isConstant()
Check whether the current Term can name a Concept.

Returns:
A Term is constant by default

getOrder

public TemporalValue getOrder()
Get the temporal order in a term, which is null by default

Returns:
The default temporal order