Serializable
, Cloneable
, Comparable<AbstractTerm>
, AbstractTerm
CompoundTerm
, Interval
, Operator
, Variable
public class Term extends Object implements AbstractTerm, Serializable
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. Multiple objects may represent the same Term.
Modifier and Type | Class | Description |
---|---|---|
static interface |
Term.TermVisitor |
Modifier and Type | Field | Description |
---|---|---|
private static Map<CharSequence,Term> |
atoms |
|
static Term[] |
EmptyTermArray |
|
ImaginationSpace |
imagination |
|
String |
index_variable |
|
private CharSequence |
name |
|
static Term |
SELF |
|
static Term |
SEQ_SPATIAL |
|
static Term |
SEQ_TEMPORAL |
|
int[] |
term_indices |
Modifier | Constructor | Description |
---|---|---|
protected |
Term() |
Default constructor that build an internal Term
|
|
Term(CharSequence name) |
Constructor with a given name
|
Modifier and Type | Method | Description |
---|---|---|
Term |
clone() |
Make a new Term with the same name.
|
Term |
cloneDeep() |
|
int |
compareTo(AbstractTerm that) |
|
int |
containedTemporalRelations() |
|
boolean |
containsTerm(Term target) |
whether this contains a term in its components.
|
boolean |
containsTermRecursively(Term target) |
Recursively check if a compound contains a term
|
Map<Term,Integer> |
countTermRecursively(Map<Term,Integer> map) |
Recursively count how often the terms are contained
|
boolean |
equals(Object that) |
Equal terms have identical name, though not necessarily the same
reference.
|
static Term |
get(int i) |
gets the atomic term of an integer
|
static Term |
get(CharSequence name) |
gets the atomic term given a name
|
short |
getComplexity() |
|
boolean |
getIsSpatial() |
|
int |
getTemporalOrder() |
|
int |
hashCode() |
Produce a hash code for the term
|
boolean |
hasInterval() |
|
boolean |
hasVar() |
Whether this compound term contains any variable term
|
boolean |
hasVar(char type) |
|
boolean |
hasVarDep() |
|
boolean |
hasVarIndep() |
|
boolean |
hasVarQuery() |
|
boolean |
isConstant() |
Check whether the current Term can name a Concept.
|
boolean |
isExecutable(Memory mem) |
|
boolean |
isHigherOrderStatement() |
|
static boolean |
isSelf(Term t) |
|
CharSequence |
name() |
Reporting the name of the current Term.
|
protected CharSequence |
nameInternal() |
|
Symbols.NativeOperator |
operator() |
|
void |
recurseSubtermsContainingVariables(Term.TermVisitor v) |
|
void |
recurseSubtermsContainingVariables(Term.TermVisitor v,
Term parent) |
|
void |
recurseTerms(Term.TermVisitor v,
Term parent) |
|
protected void |
setName(CharSequence newName) |
set the name
|
boolean |
subjectOrPredicateIsIndependentVar() |
|
static Term |
text(String t) |
Creates a quote-escaped term from a string.
|
static NavigableSet<Term> |
toSortedSet(Term... arg) |
|
static Term[] |
toSortedSetArray(Term... arg) |
|
String |
toString() |
The same as getName by default, used in display only.
|
static boolean |
valid(Term content) |
performs a thorough check of the validity of a term (by cloneDeep it) to see if it's valid
|
public ImaginationSpace imagination
private static final Map<CharSequence,Term> atoms
public static final Term SELF
public static final Term SEQ_SPATIAL
public static final Term SEQ_TEMPORAL
private CharSequence name
public int[] term_indices
public String index_variable
public static final Term[] EmptyTermArray
protected Term()
public Term(CharSequence name)
name
- A String as the name of the Termpublic static final boolean isSelf(Term t)
public Symbols.NativeOperator operator()
public boolean isHigherOrderStatement()
public boolean isExecutable(Memory mem)
public static final Term get(CharSequence name)
public static final Term get(int i)
public CharSequence name()
name
in interface AbstractTerm
protected CharSequence nameInternal()
public Term clone()
public Term cloneDeep()
public boolean equals(Object that)
public int hashCode()
public boolean isConstant()
isConstant
in interface AbstractTerm
public int getTemporalOrder()
public boolean getIsSpatial()
public void recurseTerms(Term.TermVisitor v, Term parent)
public void recurseSubtermsContainingVariables(Term.TermVisitor v)
public void recurseSubtermsContainingVariables(Term.TermVisitor v, Term parent)
public short getComplexity()
protected void setName(CharSequence newName)
public int compareTo(AbstractTerm that)
compareTo
in interface Comparable<AbstractTerm>
that
- The Term to be compared with the current Termpublic int containedTemporalRelations()
public boolean containsTermRecursively(Term target)
target
- The term to be searchedpublic Map<Term,Integer> countTermRecursively(Map<Term,Integer> map)
map
- The count map that will be created to count how often each term occurspublic boolean containsTerm(Term target)
public final String toString()
public static Term text(String t)
public boolean hasVar()
hasVar
in interface AbstractTerm
public boolean hasVar(char type)
public boolean hasVarIndep()
public boolean hasInterval()
public boolean hasVarDep()
public boolean hasVarQuery()
public static NavigableSet<Term> toSortedSet(Term... arg)
public static boolean valid(Term content)
public boolean subjectOrPredicateIsIndependentVar()
Copyright © 2020 OpenNARS. All rights reserved.