|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlp.struct.LpAbstractStructureUnit
lp.struct.LpLiteral
public class LpLiteral
This class represents a literal in logic programming. Such a
literal can be positive or negative (default) and relates to exactly one atom
represented by a instance
.
LpAtom
,
LpRule
Field Summary | |
---|---|
private LpAtom |
atom
The atom part of this literal. |
private boolean |
positive
The polarity of this literal. |
Fields inherited from class lp.struct.LpAbstractStructureUnit |
---|
TO_STRING_BUFFER |
Constructor Summary | |
---|---|
LpLiteral(boolean positive,
LpAtom atom)
Creates a new instance with the given values as members. |
Method Summary | |
---|---|
void |
accept(LpStructureUnitVisitor visitor)
Accepts LpStructureUnitVisitor instance, i.e. calls its
visitor.visit(this) . |
boolean |
equals(Object obj)
Returns true if and only if
obj is a LpLiteral instance,
it has the same polarity as this literal,
its underlying LpAtom instance is equal to this literal's
underlying LpAtom instance
|
List<LpTerm> |
getArguments()
Returns the list of arguments of this literal. |
LpAtom |
getAtom()
Returns the atom used to create this literal, the same that was given to the constructor. |
LpPredicate |
getPredicate()
Returns the predicate symbol of this literal. |
int |
hashCode()
Overriden in order to maintain the general contract of Object.hashCode() . |
boolean |
isPositive()
Returns true if this literal is positive and false
otherwise. |
Methods inherited from class lp.struct.LpAbstractStructureUnit |
---|
toString, toUnmodifiableList, toUnmodifiableSet |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private final boolean positive
true
if this is a positive literal,
false
if this is a default literal.
private final LpAtom atom
Constructor Detail |
---|
LpLiteral(boolean positive, LpAtom atom)
LpAtom
.
positive
- true
if it's supposed to be a positive
literal, false
if it's supposed to be a default literalatom
- the atom part of this literal
IllegalArgumentException
- if atom
is null
Method Detail |
---|
public boolean isPositive()
true
if this literal is positive and false
otherwise.
true
iff this literal is positivepublic LpAtom getAtom()
LpAtom
instance given in the constructorpublic LpPredicate getPredicate()
LpPredicate
instance representing the predicate
symbol used in this literalLpAtom.getPredicate()
public List<LpTerm> getArguments()
LpAtom.getArguments()
public void accept(LpStructureUnitVisitor visitor)
LpStructureUnitVisitor
instance, i.e. calls its
visitor.visit(this)
.
visitor
- the visitor to acceptpublic boolean equals(Object obj)
true
if and only if
obj
is a LpLiteral
instance,LpAtom
instance is equal to this literal's
underlying LpAtom
instance
equals
in class Object
obj
- the object to compare with
true
if this object is equal to obj
according to
the description above, and false
otherwiseLpAtom.equals(Object)
public int hashCode()
Object.hashCode()
.
hashCode
in class Object
LpAtom.hashCode()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |