|
||||||||||
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.ConnectedSentence
ai.krr.propositions.BinaryConnectedSentence
public class BinaryConnectedSentence
This class represents a Sentence that consists of a Connective that connects two sub-Sentences. The Connective that may be given to the public constructor must be IMPLIES, IFF or XOR. ConnectedSentences based on AND or OR must be constructed as ConnectedSentences.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ai.krr.propositions.ConnectedSentence |
---|
ConnectedSentence.Connective |
Field Summary |
---|
Fields inherited from class ai.krr.propositions.ConnectedSentence |
---|
connective, sentences |
Constructor Summary | |
---|---|
BinaryConnectedSentence(Sentence lhs,
ConnectedSentence.Connective connective,
Sentence rhs)
This constructor for a BinaryConnectedSentence takes a Connective and two Sentences which are the Sentences that are connected by the given connective. |
Method Summary | |
---|---|
void |
addPropositions(java.util.Set<NamedSymbol> props)
This function adds the propositions contained in this Sentence to the given Set. |
BinaryConnectedSentence |
clone()
This function generates a deep copy of this BinaryConnectedSentence. |
int |
compareTo(ConnectedSentence other)
This function compares this BinaryConnectedSentence to the given ConnectedSentence. |
boolean |
equals(ConnectedSentence other)
This function tests whether this and the given Object are equal. |
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 |
getDepth()
This function returns the nesting depth of this Sentence. |
Sentence |
getLeftHandSide()
This function returns the left-hand side sub-Sentence of this BinaryConnectedSentence. |
Sentence |
getRightHandSide()
This function returns the right-hand side sub-Sentence of this BinaryConnectedSentence. |
int |
hashCode()
This function returns the hash code of this ConnectedSentence. |
protected Sentence |
toCNF(boolean isNegated)
This function returns a new Sentence which is the CNF of this Sentence. |
protected Sentence |
toDNF(boolean isNegated)
This function returns a new Sentence which is the DNF of this Sentence. |
Methods inherited from class ai.krr.propositions.ConnectedSentence |
---|
compareTo, equals, getClassOrderIndex, getConnective, getSubSentences, isConjunction, isDisjunction, multiplyS, toString |
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 |
Constructor Detail |
---|
public BinaryConnectedSentence(Sentence lhs, ConnectedSentence.Connective connective, Sentence rhs)
This constructor for a BinaryConnectedSentence takes a Connective and two Sentences which are the Sentences that are connected by the given connective. The first Sentence is taken to be the left hand side where that matters. The connective should be IMPLIES, IFF or XOR.
lhs
- the left hand side sub-Sentenceconnective
- the connective (e.g. Connective.AND)rhs
- the right hand side sub-SentenceMethod Detail |
---|
public BinaryConnectedSentence clone()
This function generates a deep copy of this BinaryConnectedSentence. The copy will contain the same Symbols as the original.
clone
in class ConnectedSentence
public int getDepth()
This function returns the nesting depth of this Sentence. The depth of a implication is the maximum depth of the sub-Sentences plus 1. The depth of a co-implication or exclusive disjunction is the maximum depth of the sub-Sentences plus 2.
getDepth
in class ConnectedSentence
public boolean exceedsDepth(int depth)
This function tests whether this Sentence exceeds the given depth which should be a non-negative integer.
exceedsDepth
in class ConnectedSentence
depth
- 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 ConnectedSentence
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 may be null, indicating the truth value of this Sentence is undefined under the given Interpretation. For a BinaryConnectedSentence the returned truth value depends on the connective. It will be BooleanSymbol.TRUE iff:
evaluate
in class ConnectedSentence
ipt
- the Interpretation giving truth values for propositions
public final Sentence getLeftHandSide()
This function returns the left-hand side sub-Sentence of this BinaryConnectedSentence. This could be for example, the premise of an implication.
public final Sentence getRightHandSide()
This function returns the right-hand side sub-Sentence of this BinaryConnectedSentence. This could be for example, the conclusion of an implication.
public int compareTo(ConnectedSentence other)
This function compares this BinaryConnectedSentence to the given ConnectedSentence. The order between ConnectedSentences is primarily defined by the order of the Connectives they contain. If they use the same connective a lexical ordering is used, i.e. first the first sub-Sentences are compared. If they are different this determines the overall result, otherwise the second sub-Sentences are compared, etc.
compareTo
in class ConnectedSentence
other
- the ConnectedSentence to which this BinaryConnectedSentence
is to be compared
protected Sentence toCNF(boolean isNegated)
This function returns a new Sentence which is the CNF of this Sentence. The given boolean indicates whether the Sentence is to be treated as negated at this point.
toCNF
in class ConnectedSentence
isNegated
- whether the Sentence is negated
protected Sentence toDNF(boolean isNegated)
This function returns a new Sentence which is the DNF of this Sentence. The given boolean indicates whether the Sentence is to be treated as negated at this point.
toDNF
in class ConnectedSentence
isNegated
- whether the Sentence is negated
public boolean equals(ConnectedSentence other)
This function tests whether this and the given Object are equal. In general, two ConnectedSentences are equal if they have the same connective and all the sub-Sentences are in the same order and equal.
equals
in class ConnectedSentence
other
- the Sentence this one is to be compared to
public int hashCode()
This function returns the hash code of this ConnectedSentence.
hashCode
in class ConnectedSentence
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |