public abstract class AbstractTerm extends Object implements PrologTerm
PrologTerm
interface.Modifier and Type | Field and Description |
---|---|
protected PrologProvider |
provider |
protected int |
type |
Modifier | Constructor and Description |
---|---|
protected |
AbstractTerm(int type,
PrologProvider provider) |
Modifier and Type | Method and Description |
---|---|
<T extends PrologTerm> |
cast()
Casts the current PrologTerm to the class or interface represented by this
Class object. |
protected <T extends PrologTerm> |
cast(PrologTerm term)
Casts a PrologTerm to the class or interface represented by this
Class object. |
protected <T extends PrologTerm> |
cast(PrologTerm term,
Class<T> type)
Casts a PrologTerm to the class or interface represented by this
Class object. |
protected void |
checkIndex(int index) |
protected void |
checkIndex(int index,
int max) |
protected <K> K |
fromTerm(PrologTerm term,
Class<K> to) |
protected <K> K[] |
fromTermArray(PrologTerm[] terms,
Class<K[]> to) |
PrologTerm |
getArgument(int index)
Term located at some given index position in the current term arguments if
current term is a compound term.
|
String |
getIndicator()
Gets the term indicator represented by one string with the format
functor/arity.
|
protected PrologLogger |
getLogger() |
Object |
getObject()
For references terms return the referenced object.
|
PrologProvider |
getProvider()
Prolog provider associated to the current term.
|
PrologTerm |
getTerm()
Return current term instance if current term is not a variable or is a free
variable term.
|
int |
getType()
Get the term type.
|
boolean |
hasIndicator(String functor,
int arity)
True if term has an indicator with the format functor/arity that match with
the given functor and arity.
|
boolean |
isClass()
True if this Term is a Class, false in other case
|
boolean |
isClause()
True if this element is a clause
|
boolean |
isEntry()
True if this Term is a Entry, false in other case
|
boolean |
isField()
True if this Term is a Field, false in other case
|
boolean |
isMap()
True if this Term is a Map, false in other case
|
boolean |
isMixin()
True if this Term is a Mixin, false in other case
|
boolean |
isParameter()
True if this Term is a Parameter, false in other case
|
boolean |
isResult()
True if this Term is a Result, false in other case
|
boolean |
isTerm()
True if this term is a term
|
boolean |
isVariableBound()
True if this Term is a instanced variable, false in other case
|
boolean |
isVariableNotBound()
True if this Term is a not instanced variable, false in other case
|
Map<String,PrologTerm> |
match(PrologTerm term)
Match to other term returning list of substitutions.
|
protected String |
removeQuoted(String functor) |
protected <K extends PrologTerm> |
toTerm(Object o,
Class<K> from) |
protected <K extends PrologTerm> |
toTermArray(Object[] os,
Class<K[]> from) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getArguments, getArity, getFunctor, isAtom, isAtomic, isCompound, isDouble, isEmptyList, isEvaluable, isFalseType, isFloat, isInteger, isList, isLong, isNil, isNullType, isNumber, isObjectType, isReference, isStructure, isTrueType, isVariable, isVoidType, unify
compareTo
protected int type
protected final PrologProvider provider
protected AbstractTerm(int type, PrologProvider provider)
protected final void checkIndex(int index)
protected final void checkIndex(int index, int max)
protected final <K extends PrologTerm> K toTerm(Object o, Class<K> from)
protected final <K extends PrologTerm> K[] toTermArray(Object[] os, Class<K[]> from)
protected final <K> K fromTerm(PrologTerm term, Class<K> to)
protected final <K> K[] fromTermArray(PrologTerm[] terms, Class<K[]> to)
protected final PrologLogger getLogger()
public PrologTerm getArgument(int index)
PrologTerm
ArrayIndexOutOfBoundsException
exception is raised.getArgument
in interface PrologTerm
index
- position to retrieve the correspondent term.public final String getIndicator()
PrologTerm
PrologTerm.getFunctor()
and PrologTerm.getArity()
separated by
slash.getIndicator
in interface PrologTerm
public final boolean hasIndicator(String functor, int arity)
PrologTerm
hasIndicator
in interface PrologTerm
functor
- term functorarity
- term aritypublic PrologTerm getTerm()
PrologTerm
getTerm
in interface PrologTerm
public final int getType()
PrologTerm
getType
in interface PrologTerm
public final PrologProvider getProvider()
PrologTerm
getProvider
in interface PrologTerm
protected final <T extends PrologTerm> T cast(PrologTerm term, Class<T> type)
Class
object.term
- the object to be casttype
- the class or interface to be castedClassCastException
- if the object is not null and is not assignable to
the type T.protected final <T extends PrologTerm> T cast(PrologTerm term)
Class
object.term
- the object to be castClassCastException
- if the object is not null and is not assignable to
the type T.public final <T extends PrologTerm> T cast()
PrologTerm
Class
object.cast
in interface PrologTerm
public Object getObject()
PrologTerm
getObject
in interface PrologTerm
public final boolean isEntry()
PrologTerm
isEntry
in interface PrologTerm
public final boolean isMap()
PrologTerm
isMap
in interface PrologTerm
public boolean isField()
PrologTerm
isField
in interface PrologTerm
public boolean isResult()
PrologTerm
isResult
in interface PrologTerm
public boolean isParameter()
PrologTerm
isParameter
in interface PrologTerm
public final boolean isMixin()
PrologTerm
isMixin
in interface PrologTerm
public final boolean isClass()
PrologTerm
isClass
in interface PrologTerm
public boolean isVariableBound()
PrologTerm
isVariableBound
in interface PrologTerm
public boolean isVariableNotBound()
PrologTerm
isVariableNotBound
in interface PrologTerm
public final boolean isClause()
PrologElement
isClause
in interface PrologElement
public final boolean isTerm()
PrologElement
isTerm
in interface PrologElement
public final Map<String,PrologTerm> match(PrologTerm term)
match
in interface PrologTerm
term
- - term to match checkCopyright © 2020–2024 Prolobjectlink Project. All rights reserved.