|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectai.krr.propositions.Sentence
ai.krr.propositions.Atom
public class Atom
An Atom is one of the most basic building blocks for a Sentence. It simply consists of a proposition that can be either true or false.
Field Summary | |
---|---|
protected NamedSymbol |
theSy
the proposition symbol |
Constructor Summary | |
---|---|
Atom(NamedSymbol prop)
This constructor for an Atom takes a NamedSymbol for the proposition. |
Method Summary | |
---|---|
void |
addPropositions(java.util.Set<NamedSymbol> props)
This function adds the propositions contained in this Sentence to the given Set. |
Atom |
clone()
Cloning an Atom returns this Atom. |
int |
compareTo(Atom other)
This function compares this Atom to the given Atom. |
int |
compareTo(Sentence stmt)
This function compares this Sentence to the given Sentence. |
boolean |
equals(Atom other)
An Atom is equal to another Atom that consists of an equal proposition symbol. |
boolean |
equals(java.lang.Object obj)
An Atom is equal to another Atom that consists of an equal proposition symbol. |
BooleanSymbol |
evaluate(Interpretation ipt)
This function evaluates this Sentence under the given Interpretation. |
int |
getClassOrderIndex()
This function returns the index used for ordering Sentences across different classes. |
NamedSymbol |
getSymbol()
This function returns the NamedSymbol that represents this proposition. |
int |
hashCode()
This function returns the hash code of this Atom. |
boolean |
isAtom()
This function tests whether this Sentence is an Atom. |
protected Sentence |
toCNF(boolean isNegated)
This function returns a new Literal which contains the proposition contained in this Atom. |
protected Sentence |
toDNF(boolean isNegated)
This function returns a new Literal which contains the proposition contained in this Atom. |
java.lang.String |
toString()
An Atom is printed as the proposition symbol. |
Methods inherited from class ai.krr.propositions.Sentence |
---|
addSubSentences, allSubSentences, exceedsDepth, getDepth, getPropositions, isLiteral, prettyPrint, read, toClauseForm, toCNF, toDNF, write |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final NamedSymbol theSy
Constructor Detail |
---|
public Atom(NamedSymbol prop)
This constructor for an Atom takes a NamedSymbol for the proposition. The given Symbol must not be null.
prop
- the proposition symbolMethod Detail |
---|
public Atom clone()
Cloning an Atom returns this Atom.
clone
in class Sentence
public final boolean isAtom()
This function tests whether this Sentence is an Atom.
isAtom
in class Sentence
public void addPropositions(java.util.Set<NamedSymbol> props)
This function adds the propositions contained in this Sentence to the given Set. Of course, the given Set must not be null.
addPropositions
in class Sentence
props
- the Set to which the NamedSymbols are addedpublic BooleanSymbol evaluate(Interpretation ipt)
This function evaluates this Sentence under the given Interpretation. If all propositions occurring in the Sentence have a truth value assigned by the Interpretation the result will be either BooleanSymbol.TRUE or BooleanSymbol.FALSE. Otherwise the result will be null, indicating the truth value of this Sentence is undefined under the given Interpretation. For an Atom the returned truth value is simply the one assigned by the Interpretation.
evaluate
in class Sentence
ipt
- the Interpretation giving truth values for propositions
public final int getClassOrderIndex()
This function returns the index used for ordering Sentences across different classes. This index of this class is defined to be 1.
getClassOrderIndex
in class Sentence
public int compareTo(Sentence stmt)
This function compares this Sentence to the given Sentence. The order between different kinds of Sentence is arbitrarily defined as (ascending): TruthValue, Atom, Literal, NegatedSentence, ConnectedSentence, BinaryConnectedSentence.
compareTo
in interface java.lang.Comparable<Sentence>
compareTo
in class Sentence
stmt
- the Sentence to which this Sentence is to be compared
public final NamedSymbol getSymbol()
This function returns the NamedSymbol that represents this proposition.
public int compareTo(Atom other)
This function compares this Atom to the given Atom. The order between Atoms is defined by the order of the NamedSymbols they contain.
other
- the Atom to which this Atom is to be compared
protected Sentence toCNF(boolean isNegated)
This function returns a new Literal which contains the proposition contained in this Atom. The given boolean indicates whether the new Literal is to be negated.
toCNF
in class Sentence
isNegated
- whether the Literal has to be negated
protected Sentence toDNF(boolean isNegated)
This function returns a new Literal which contains the proposition contained in this Atom. The given boolean indicates whether the new Literal is to be negated.
toDNF
in class Sentence
isNegated
- whether the Literal has to be negated
public boolean equals(java.lang.Object obj)
An Atom is equal to another Atom that consists of an equal proposition symbol.
equals
in class java.lang.Object
obj
- the Object this Atom is compared to
public boolean equals(Atom other)
An Atom is equal to another Atom that consists of an equal proposition symbol.
other
- the Atom this Atom is compared to
public final int hashCode()
This function returns the hash code of this Atom.
hashCode
in class java.lang.Object
public java.lang.String toString()
An Atom is printed as the proposition symbol.
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |