|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.grack.prologmachine.Predicate
Implements the functionality for a unifiable predicate. An atom is represented by a Predicate with arity 0 for simplicity.
Constructor Summary | |
Predicate(java.lang.String name,
int arity)
Constructs a new Predicate from a given name and arity. |
|
Predicate(java.lang.String name,
int arity,
Unifiable argument)
Constructs a new Predicate from a given name and arity and a single argument. |
|
Predicate(java.lang.String name,
int arity,
Unifiable[] arguments)
Constructs a new Predicate from a given name and arity and a list of arguments. |
Method Summary | |
void |
addArgument(Unifiable argument)
Add a new argument to the predicate. |
int |
argumentCount()
Returns the number of arguments this predicate has. |
Unifiable |
getArgument(int index)
Returns the argument at the given index for this predicate. |
int |
getArity()
Returns the arity of the predicate. |
java.lang.String |
getName()
Returns the name of the predicate. |
PredicateSignature |
getSignature()
Computes the predicate signature for this predicate. |
boolean |
isValid()
Returns whether this represents a valid predicate or not. |
void |
setArgument(int index,
Unifiable argument)
Replace an argument with another. |
java.lang.String |
toString()
Converts the predicate to a string representation. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public Predicate(java.lang.String name, int arity)
name
- The name of the predicatearity
- The arity of the predicatepublic Predicate(java.lang.String name, int arity, Unifiable argument)
name
- The name of the predicate.arity
- The arity of the predicate.argument
- The argument to add to the predicate.public Predicate(java.lang.String name, int arity, Unifiable[] arguments)
name
- The name of the predicate.arity
- The arity of the predicate.arguments
- The arguments to add to the predicate.Method Detail |
public void addArgument(Unifiable argument)
argument
- The argument to add.public void setArgument(int index, Unifiable argument)
index
- The index of the argument.argument
- The argument to replace at this index.public int argumentCount()
public boolean isValid()
public PredicateSignature getSignature()
public Unifiable getArgument(int index)
index
- The index to retrieve the argument from.public java.lang.String toString()
public java.lang.String getName()
public int getArity()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |