| 
||||||||||
| 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.NegatedSentence
public class NegatedSentence
A NegatedSentence is the simplest kind of complex Sentence. It simply contains the Sentence that is negated. Note that a negated Atom can also be represented as a Literal, but a negative Literal is not equal to a negated sentence containing the same Atom or NamedSymbol.
| Field Summary | |
|---|---|
protected  Sentence | 
contained
the contained Sentence that is negated *  | 
| Constructor Summary | |
|---|---|
NegatedSentence(Sentence stmt)
This constructor for a NegatedSentence simply takes the Sentence that is negated.  | 
|
| Method Summary | |
|---|---|
 void | 
addPropositions(java.util.Set<NamedSymbol> props)
This function adds the propositions contained in this Sentence to the given Set.  | 
 NegatedSentence | 
clone()
Cloning a NegatedSentence returns a new NegatedSentence containing the same Sentence as the original.  | 
 int | 
compareTo(NegatedSentence other)
This function compares this NegatedSentence to the given NegatedSentence.  | 
 int | 
compareTo(Sentence stmt)
This function compares this Sentence to the given Sentence.  | 
 boolean | 
equals(NegatedSentence other)
A NegatedSentence is equal to another NegatedSentence that contains an equal Sentence.  | 
 boolean | 
equals(java.lang.Object obj)
A NegatedSentence is equal to another NegatedSentence that contains an equal Sentence.  | 
 BooleanSymbol | 
evaluate(Interpretation ipt)
This function evaluates this Sentence under the given Interpretation.  | 
 boolean | 
exceedsDepth(int depth)
This function tests whether this Sentence exceeds the given depth which should be a non-negative integer.  | 
 int | 
getClassOrderIndex()
This function returns the index used for ordering Sentences across different classes.  | 
 Sentence | 
getContainedSentence()
This function returns the Sentence that is contained in this NegatedSentence.  | 
 int | 
getDepth()
This function returns the nesting depth of this Sentence.  | 
 int | 
hashCode()
This function returns the hash code of this NegatedSentence.  | 
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()
A NegatedSentence is printed as the tilde symbol '~' followed by the contained Sentence.  | 
| Methods inherited from class ai.krr.propositions.Sentence | 
|---|
addSubSentences, allSubSentences, getPropositions, isAtom, 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 Sentence contained
| Constructor Detail | 
|---|
public NegatedSentence(Sentence stmt)
This constructor for a NegatedSentence simply takes the Sentence that is negated. The given Sentence must not be null.
stmt - the negated Sentence| Method Detail | 
|---|
public NegatedSentence clone()
Cloning a NegatedSentence returns a new NegatedSentence containing the same Sentence as the original.
clone in class Sentencepublic int getDepth()
This function returns the nesting depth of this Sentence. The depth of a negated sentence is equal to the depth of the contained Sentence.
getDepth in class Sentencepublic boolean exceedsDepth(int depth)
This function tests whether this Sentence exceeds the given depth which should be a non-negative integer.
exceedsDepth in class Sentencedepth - the depth value that is tested for
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 Sentenceprops - 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 a NegatedSentence the returned truth value is the negation of the value of the contained Sentence.
evaluate in class Sentenceipt - 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 3.
getClassOrderIndex in class Sentencepublic 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 Sentencestmt - the Sentence to which this Sentence is to be compared
public final Sentence getContainedSentence()
This function returns the Sentence that is contained in this NegatedSentence.
public int compareTo(NegatedSentence other)
This function compares this NegatedSentence to the given NegatedSentence. The order between NegatedSentences is defined by the order of the Sentences they contain.
other - the Sentence to which this Sentence 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 SentenceisNegated - 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 SentenceisNegated - whether the Literal has to be negated
public java.lang.String toString()
A NegatedSentence is printed as the tilde symbol '~' followed by the contained Sentence.
toString in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
A NegatedSentence is equal to another NegatedSentence that contains an equal Sentence.
equals in class java.lang.Objectobj - the Object this NegatedSentence is compared to
public boolean equals(NegatedSentence other)
A NegatedSentence is equal to another NegatedSentence that contains an equal Sentence.
other - the NegatedSentence this NegatedSentence is compared to
public int hashCode()
This function returns the hash code of this NegatedSentence.
hashCode in class java.lang.Object
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||