|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectde.unidu.is.pdatalog.ds.Literal
The representation of an datalog literal. An literal is a string
[!]p(t1,...,tn) where is
p is a predicate name, the tis
are the arguments (variable names or constants, where constants are
conclosed on '') and n is the arity of
the predicate. It is also called the arity of the literal. A
literal can be positive (missing !) or negative (with
starting !).
Rule for storing the head literal.
| Field Summary | |
protected Expression[] |
arguments
The arguments. |
protected boolean |
positive
Being true iff this Literal is positive. |
protected java.lang.String |
predicateName
The name of the predicate. |
| Constructor Summary | |
Literal(Literal literal)
Creates a new literal. |
|
Literal(java.lang.String predicateName,
Expression[] arguments,
boolean positive)
Creates a new literal. |
|
Literal(java.lang.String predicateName,
java.util.List arguments,
boolean positive)
Creates a new literal. |
|
| Method Summary | |
Literal |
createLiteral()
Creates a positive copy of this literal. |
Literal |
createLiteral(boolean positive)
Creates a copy of this literal. |
boolean |
equals(java.lang.Object o)
Compares the specified Object with this literal for equality. |
java.util.Set |
getAllArguments()
Returns a set containing all arguments (variables and constants). |
Expression |
getArgument(int index)
Returns the argument at the specified index. |
java.lang.String |
getArguments()
Returns the arguments as a comma separated string. |
int |
getArity()
Returns the arity of this literal. |
java.util.Set |
getConstants()
Returns a set containing all constants (no variables). |
java.lang.String |
getPredicateName()
Returns the predicate name. |
java.util.Set |
getVariables()
Returns a set containing all variables (no constants). |
int |
hashCode()
Returns the hash code value for this literal. |
boolean |
isPositive()
Returns if this literal is positive. |
boolean |
isVariable(int index)
Returns whether the argument at the specified index is a variable name or a constant. |
void |
negate()
Negates this literal. |
void |
putAllArguments(java.util.Set set)
Puts all arguments (variables and constants) into the specified set. |
void |
putConstants(java.util.Set set)
Puts all constants (no variables) into the specified set. |
void |
putVariables(java.util.Set set)
Puts all variables (no constants) into the specified set. |
void |
setArgument(int index,
Expression value)
Sets the argument at the specified index. |
void |
setNegative()
Makes this literal negative. |
void |
setPositive()
Makes this literal positive. |
void |
setPositive(boolean positive)
Sets if this literal is positive. |
void |
setPredicateName(java.lang.String predicateName)
Sets the predicate name. |
protected java.lang.String |
toHashCodeString()
Returns a string representation of this literal, used for equals(Object) and hashCode(). |
java.lang.String |
toString()
Returns a datalog representation of this literal. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected java.lang.String predicateName
protected Expression[] arguments
protected boolean positive
| Constructor Detail |
public Literal(java.lang.String predicateName,
Expression[] arguments,
boolean positive)
predicateName - predicate namearguments - arguments (variable names or constants)positive - true iff this literal is positive
public Literal(java.lang.String predicateName,
java.util.List arguments,
boolean positive)
predicateName - predicate namearguments - list of arguments (variable names or constants)positive - true iff this literal is positivepublic Literal(Literal literal)
literal - to be copied| Method Detail |
public java.lang.String getPredicateName()
public void setPredicateName(java.lang.String predicateName)
predicateName - predicate namepublic int getArity()
public java.lang.String getArguments()
public Expression getArgument(int index)
index - index
public boolean isVariable(int index)
index - index
public void setArgument(int index,
Expression value)
index - specified indexvalue - new argument at the specified indexpublic void putVariables(java.util.Set set)
set - destination set for all variablespublic void putConstants(java.util.Set set)
set - destination set for all constantspublic void putAllArguments(java.util.Set set)
set - destination set for all argumentspublic java.util.Set getVariables()
public java.util.Set getConstants()
public java.util.Set getAllArguments()
public boolean isPositive()
public void setPositive(boolean positive)
positive - flag indicating if this literal is positive or negativepublic void setPositive()
setPositive(true).
public void setNegative()
setPositive(false).
public void negate()
public Literal createLiteral()
public Literal createLiteral(boolean positive)
positive - indicating whether the copy is positive or negative
public java.lang.String toString()
protected java.lang.String toHashCodeString()
equals(Object) and hashCode().
public int hashCode()
toHashCodeString().
public boolean equals(java.lang.Object o)
toHashCodeString().
o - the Object to be compared for equality with this literal
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||