|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectDLV.Predicate.Literal
This class represents Literals. A Literal in a logic database is like a tuple in a relational database.
Constructor Summary | |
Predicate.Literal()
Constructs a (positive) Literal of arity 0. |
|
Predicate.Literal(boolean positive)
Constructs a Literal of arity 0. |
|
Predicate.Literal(java.lang.String[] term)
Constructs a (positive) Literal from an array of terms. |
|
Predicate.Literal(java.lang.String[] term,
boolean positive)
Constructs a Literal from an array of terms. |
Method Summary | |
void |
appendTo(java.io.PrintWriter out)
This method allows to save this Literal in the file handled by "out" in datalog format. |
int |
arity()
Returns the arity of the Predicate which contains this Literal. |
boolean |
equals(java.lang.Object o)
If this Literal is the same of f returns true, otherwise false. |
Predicate.Literal |
getContrary()
Gets the contrary Literal. |
Predicate |
getPredicate()
This function returns the Predicate object which contains this Literal. |
java.lang.String |
getTermAt(int i)
This function returns the i-th term of this Literal. |
void |
invert()
If this Literal is positive this method make it negative and vice versa. |
boolean |
isContrary(Predicate.Literal f)
If this Literal is the contrary of f returns true, otherwise false. |
boolean |
isPositive()
Returns true if this Literal is positive. |
java.lang.String |
name()
Returns the name of the Predicate which contains this Literal. |
void |
setTermAt(int i,
java.lang.String t)
This function sets the i-th term of this Literal. |
void |
setTermAt(java.lang.String t,
int i)
Deprecated. use setTermAt(int i, String t) instead. |
java.lang.String |
toString()
|
void |
update()
Commits changes made in this object updating the underlying literal implementation stored in the Predicate object. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Predicate.Literal()
BadArityException
- if Literal arity differs from the arity of this Predicate.public Predicate.Literal(boolean positive)
positive
- A boolean variable which indicate that the Literal is positive or negative.
BadArityException
- if Literal arity differs from the arity of this Predicate.public Predicate.Literal(java.lang.String[] term)
term
- Is an array of String objects which contains terms.
BadArityException
- if Literal arity differs from the arity of this Predicate.public Predicate.Literal(java.lang.String[] term, boolean positive)
term
- Is an array of String objects which contains terms.positive
- A boolean variable which indicate that the Literal is positive or negative.
BadArityException
- if Literal arity differs from the arity of this Predicate.Method Detail |
public Predicate getPredicate()
public java.lang.String name()
public int arity()
public java.lang.String getTermAt(int i)
NoSuchTermException
- if you try to get a term which doesn't exist.public void setTermAt(java.lang.String t, int i)
public void setTermAt(int i, java.lang.String t)
NoSuchTermException
- if you try to modify a term which doesn't exist.
java.lang.NullPointerException
- if t is null.public boolean isPositive()
public void invert()
public Predicate.Literal getContrary()
public boolean isContrary(Predicate.Literal f)
f
- a Literal object.
java.lang.NullPointerException
- if f is null.public java.lang.String toString()
public void appendTo(java.io.PrintWriter out)
public boolean equals(java.lang.Object o)
java.lang.NullPointerException
- if f is null.public void update()
LiteralStaledException
- if this Literal is not more contained in the corresponding Predicate object.
TrueNegationNotSupportedException
- if you try to invert this Literal and the implementation of the current Predicate does not support true negation.
MalformedTermException
- if the literal contains malformed terms.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |