public interface PrologClause extends PrologElement, PrologDocumentable
Prolog clause is composed by two prolog terms that define a prolog clause, the head and the body. This representation consider the prolog clause body like a single term. If the body is a conjunctive set of terms, the body is an structure with functor/arity (,/2) and the first argument is the first element in the conjunction and the rest is a recursive functor/arity (,/2).
The functor and arity for the clause is given from head term functor and arity.
This class define some properties for commons prolog clause implementations. They are boolean flags that indicate if the prolog clause is dynamic multifile and discontiguos.
This class have several methods to access to the clause components and retrieve some clause properties and information about it.
Additionally this class contains a prolog provider reference for build terms in some operations.
Modifier and Type | Method and Description |
---|---|
<T extends PrologClause> |
cast()
Casts the current PrologClause to the class or interface represented by this
Class object. |
PrologTerm |
getArgument(int index)
Term located at some given index position in the clause head arguments.
|
PrologTerm[] |
getArguments()
Term arguments present in the clause head.
|
int |
getArity()
Integer number that represent the arguments number in the clause head.
|
PrologTerm |
getBody()
Prolog term that represent the clause body.
|
PrologTerm[] |
getBodyArray()
Get the clause body as terms array.
|
Iterator<PrologTerm> |
getBodyIterator()
Iterator to iterate over all body terms.
|
String |
getFunctor()
String that represent the functor in the clause head.
|
PrologTerm |
getHead()
Prolog term that represent the clause head.
|
String |
getIndicator()
Clause family functor/arity based indicator.
|
PrologIndicator |
getPrologIndicator()
Clause family PrologIndicator based indicator.
|
PrologTerm |
getTerm()
Prolog term representation of the current clause.
|
boolean |
hasIndicator(String functor,
int arity)
Check if the current clause have functor/arity based indicator specified by
arguments, false in otherwise.
|
boolean |
isDirective()
True if this clause is a directive, false in other case.
|
boolean |
isDiscontiguous()
Deprecated.
Natives engine don't offer information about that.
|
boolean |
isDynamic()
Deprecated.
Natives engine don't offer information about that.
|
boolean |
isFact()
True if this clause is a fact, false in other case.
|
boolean |
isFunction()
True if this clause is a function, false in other case.
|
boolean |
isMethod()
True if this clause is a rule, false in other case.
|
boolean |
isMultifile()
Deprecated.
Natives engine don't offer information about that.
|
boolean |
isRule()
True if this clause is a rule, false in other case.
|
boolean |
unify(PrologClause clause)
Check that two clauses unify.
|
isClause, isTerm
getAuthor, getDescription, getSee, getSince, getVersion, hasAuthor, hasDescription, hasDocumentation, hasSee, hasSince, hasVersion, setAuthor, setDescription, setSee, setSince, setVersion
int getArity()
getHead().getArity()
.String getFunctor()
getHead().getFunctor()
.PrologTerm[] getArguments()
PrologTerm getArgument(int index)
index
- position to retrieve the correspondent term.ArrayIndexOutOfBoundsException
- if the index value is out of term
array bound.PrologTerm getTerm()
PrologTerm getHead()
PrologTerm getBody()
String getIndicator()
boolean hasIndicator(String functor, int arity)
functor
- clause functor to be checkedarity
- clause arity to be checkedboolean isDirective()
getHead()==null && getBody()!=null
.boolean isFact()
getHead()!=null && getBody()==null
.boolean isRule()
getHead()!=null && getBody()!=null
.boolean isMethod()
getHead()!=null && getBody()!=null
.boolean isFunction()
getHead()!=null && getBody()!=null
.boolean unify(PrologClause clause)
clause
- the clause to unify with the current clause@Deprecated boolean isDynamic()
@Deprecated boolean isMultifile()
@Deprecated boolean isDiscontiguous()
PrologIndicator getPrologIndicator()
Iterator<PrologTerm> getBodyIterator()
PrologTerm[] getBodyArray()
<T extends PrologClause> T cast()
Class
object.ClassCastException
- if the object is not null and is not assignable to
the type T.Copyright © 2020–2024 Prolobjectlink Project. All rights reserved.