|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object tuffy.mln.Literal
public class Literal
A literal in first-order logic.
Nested Class Summary | |
---|---|
private class |
Literal.VarClique
Clique of variables. |
Field Summary | |
---|---|
private boolean |
coversAllMaterializedTuples
|
private int |
idx
The index of this literal in its parent clause. |
private Predicate |
pred
Predicate object associated with this literal. |
private boolean |
sense
The positive/negative value of this literal. |
private java.util.ArrayList<Term> |
terms
List of terms (variable/constant) contained in this literal. |
private Tuple |
tuple
The tuple format of this literal. |
private java.util.HashSet<java.lang.String> |
vars
The name set of all variables in this literal. |
Constructor Summary | |
---|---|
Literal(Predicate predicate,
boolean sense)
Constructor of Literal. |
Method Summary | |
---|---|
void |
appendTerm(Term t)
Append a new term to this literal. |
java.lang.Object |
clone()
|
boolean |
coversAllMaterializedTuples()
Test whether we want this literal to cover all materialized tuples regardless of the sense of this literal. |
void |
flipSense()
Flip the sense of this literal. |
int |
getIdx()
Return the assigned index of this literal in its parent clause. |
Predicate |
getPred()
Return the predicate of this literal. |
boolean |
getSense()
Return true if this is a positive literal. |
java.util.ArrayList<Term> |
getTerms()
Return the list of terms in this literal. |
java.util.HashSet<java.lang.String> |
getVars()
Return the set of variable names in this literal. |
boolean |
isBuiltIn()
Return whether the predicate of this literal is a built-in predicate. |
boolean |
isSameAs(Literal lit)
Compare a given literal with this one. |
java.util.HashMap<java.lang.String,Term> |
mostGeneralUnification(Tuple atuple)
Compute the most general unification (MGU) of two literals. |
void |
setCoversAllMaterializedTuples(boolean coversAllMaterializedTuples)
Set whether we want this literal to cover all materialized tuples regardless of the sense of this literal. |
void |
setIdx(int i)
Assign an unique (within its parent clause) index to this literal. |
void |
setSense(boolean asense)
Set the sense of this literal. |
Literal |
substitute(java.util.HashMap<java.lang.String,Term> vmap)
Apply a substitution to this literal. |
Atom |
toAtom(Atom.AtomType type)
Convert this literal to an atom. |
java.lang.String |
toString()
Return the human-friendly representation of this literal. |
Tuple |
toTuple()
Convert this literal into a tuple. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private Predicate pred
private int idx
private java.util.ArrayList<Term> terms
private boolean sense
private boolean coversAllMaterializedTuples
private Tuple tuple
toTuple()
to make
this variable not null. This variable is not automatically maintained.
To obtain the most update to date version, you need to call toTuple()
.
private java.util.HashSet<java.lang.String> vars
Constructor Detail |
---|
public Literal(Predicate predicate, boolean sense)
predicate
- the predicatesense
- true for a positive literal; false for a negative oneMethod Detail |
---|
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public boolean isBuiltIn()
public java.util.HashSet<java.lang.String> getVars()
public Predicate getPred()
public java.util.ArrayList<Term> getTerms()
public int getIdx()
public void setIdx(int i)
i
- the indexClause.addLiteral(Literal)
public java.util.HashMap<java.lang.String,Term> mostGeneralUnification(Tuple atuple)
atuple
- the literal (in the form of a tuple) to be unified
public java.lang.String toString()
toString
in class java.lang.Object
public void appendTerm(Term t)
t
- the term to be appendedpublic Tuple toTuple()
public boolean isSameAs(Literal lit)
lit
- the literal needed to be compared.
public Literal substitute(java.util.HashMap<java.lang.String,Term> vmap)
vmap
- the substitution
public Atom toAtom(Atom.AtomType type)
type
- indicates if it's an evidence, a query, etc.public void flipSense()
public boolean getSense()
public void setSense(boolean asense)
asense
- true if this is intended to be a positive literalpublic void setCoversAllMaterializedTuples(boolean coversAllMaterializedTuples)
coversAllMaterializedTuples
- public boolean coversAllMaterializedTuples()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |