Serializable
, Cloneable
, Comparable<AbstractTerm>
, AbstractTerm
public class Variable extends Term
Term.TermVisitor
Modifier and Type | Field | Description |
---|---|---|
private int |
hash |
|
private static int |
MAX_CACHED_VARNAME_INDEXES |
|
private Term |
scope |
|
private char |
type |
caches the type character for faster lookup than charAt(0)
|
private static CharSequence[] |
vn1 |
|
private static CharSequence[] |
vn2 |
|
private static CharSequence[] |
vn3 |
EmptyTermArray, imagination, index_variable, SELF, SEQ_SPATIAL, SEQ_TEMPORAL, term_indices
Modifier | Constructor | Description |
---|---|---|
|
Variable(CharSequence name) |
|
protected |
Variable(CharSequence name,
Term scope) |
Constructor, from a given variable name
|
Modifier and Type | Method | Description |
---|---|---|
Variable |
clone() |
Clone a Variable
|
static int |
compare(Variable a,
Variable b) |
|
int |
compareTo(AbstractTerm that) |
|
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.
|
boolean |
equalsTerm(Object that) |
|
short |
getComplexity() |
The syntactic complexity of a variable is 0, because it does not refer to
any concept.
|
static CharSequence |
getName(char type,
int index) |
|
Term |
getScope() |
|
char |
getType() |
Get the type of the variable
|
int |
hashCode() |
Produce a hash code for the term
|
boolean |
hasVar() |
Whether this compound term contains any variable term
|
boolean |
hasVarDep() |
|
boolean |
hasVarIndep() |
|
boolean |
hasVarQuery() |
|
(package private) boolean |
isCommon() |
|
boolean |
isConstant() |
A variable is not constant
|
(package private) boolean |
isDependentVariable() |
|
(package private) boolean |
isIndependentVariable() |
|
(package private) boolean |
isQueryVariable() |
|
protected static CharSequence |
newName(char type,
int index) |
|
Variable |
setScope(Term scope,
CharSequence n) |
|
static boolean |
validVariableType(char c) |
finalize, getClass, notify, notifyAll, wait, wait, wait
cloneDeep, containedTemporalRelations, containsTerm, containsTermRecursively, get, get, getIsSpatial, getTemporalOrder, hasInterval, hasVar, isExecutable, isHigherOrderStatement, isSelf, name, nameInternal, operator, recurseSubtermsContainingVariables, recurseSubtermsContainingVariables, recurseTerms, setName, subjectOrPredicateIsIndependentVar, text, toSortedSet, toSortedSetArray, toString, valid
private char type
private Term scope
private int hash
private static final int MAX_CACHED_VARNAME_INDEXES
private static final CharSequence[] vn1
private static final CharSequence[] vn2
private static final CharSequence[] vn3
public Variable(CharSequence name)
protected Variable(CharSequence name, Term scope)
name
- A String read from inputpublic Variable setScope(Term scope, CharSequence n)
public Variable clone()
public char getType()
public boolean isConstant()
isConstant
in interface AbstractTerm
isConstant
in class Term
public short getComplexity()
getComplexity
in class Term
public boolean hasVar()
Term
hasVar
in interface AbstractTerm
hasVar
in class Term
public boolean hasVarIndep()
hasVarIndep
in class Term
public boolean hasVarQuery()
hasVarQuery
in class Term
public boolean equals(Object that)
Term
public boolean equalsTerm(Object that)
public int hashCode()
Term
public int compareTo(AbstractTerm that)
compareTo
in interface Comparable<AbstractTerm>
compareTo
in class Term
that
- The Term to be compared with the current Termboolean isQueryVariable()
boolean isDependentVariable()
boolean isIndependentVariable()
boolean isCommon()
public Term getScope()
public static boolean validVariableType(char c)
public static CharSequence getName(char type, int index)
protected static CharSequence newName(char type, int index)
public Map<Term,Integer> countTermRecursively(Map<Term,Integer> map)
Term
countTermRecursively
in class Term
map
- The count map that will be created to count how often each term occursCopyright © 2020 OpenNARS. All rights reserved.