|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectai.krr.fol.Clause
public class Clause
Field Summary | |
---|---|
protected Literal[] |
literals
the Literals of this Clause |
Constructor Summary | |
---|---|
Clause(java.util.Collection<Literal> lits)
This constructor for a Clause takes a List of Literals. |
|
Clause(Literal... lits)
This constructor for a Clause takes an Array of Literals. |
Method Summary | |
---|---|
protected Clause |
clone()
This function generates a shallow copy of this Clause. |
int |
compareTo(Clause other)
This function compares this Clause to the given Clause. |
boolean |
contains(Literal literal)
This function tests whether the given Literal is contained in this Clause. |
boolean |
equals(Clause other)
This function tests whether this and the given Clause are equal. |
boolean |
equals(java.lang.Object obj)
This function tests whether this and the given Object are equal. |
BooleanSymbol |
evaluate(Interpretation ipt,
Substitution s)
This function evaluates this Sentence under the given Interpretation. |
java.util.Set<Symbol> |
getConstants()
This function returns a set of all the constant Symbols occurring in this Clause. |
java.util.Map<Symbol,java.lang.Integer> |
getFunctions()
This function returns a set of all the function Symbols occurring in this Clause. |
Literal[] |
getLiterals()
This function returns the the Literals that are joined in this Clause. |
java.util.Map<NamedSymbol,java.lang.Integer> |
getPredicates()
This function returns a set of all the predicate Symbols occurring in this Clause. |
java.util.Set<Variable> |
getVariables()
This function adds all the Variables in this Clause to the returned Set. |
int |
hashCode()
This function returns the hash code of this Clause. |
int |
size()
This function returns the number of Literals in this Clause. |
Sentence |
toSentence()
This function converts this Clause to an ordinary first-order Sentence, which is either TruthValue.FALSE for the empty Clause, a Literal for a unit Clause, or a disjunction of the Literals in this Clause. |
java.lang.String |
toString()
A Clause is printed as: |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final Literal[] literals
Constructor Detail |
---|
public Clause(java.util.Collection<Literal> lits)
This constructor for a Clause takes a List of Literals. Internally, the Literals are stored in a sorted order, resulting in a time complexity of O(n log(n)) for this constructor.
lits
- the Literals to be connected herepublic Clause(Literal... lits)
This constructor for a Clause takes an Array of Literals. Internally, the Literals are stored in a sorted order, resulting in a time complexity of O(n log(n)) for this constructor.
lits
- the Literals to be connected hereMethod Detail |
---|
protected Clause clone()
This function generates a shallow copy of this Clause. The copy will contain the same Literals as the original.
clone
in class java.lang.Object
public int compareTo(Clause other)
This function compares this Clause to the given Clause. The order between Clauses is primarily determined by their length: shorter Clauses come first. The order between Clauses of equal length is a lexical ordering, i.e. first the first Literals are compared. If they are different this determines the overall result, otherwise the second Literals are compared, etc. Note that Literals are not considered in the order given to the constructor, but in their natural order.
compareTo
in interface java.lang.Comparable<Clause>
other
- the Clause to which this Clause is to be compared
public final Literal[] getLiterals()
This function returns the the Literals that are joined in this Clause.
public int size()
This function returns the number of Literals in this Clause.
public boolean contains(Literal literal)
This function tests whether the given Literal is contained in this Clause.
literal
- the Literal to be tested for
public java.util.Set<Symbol> getConstants()
This function returns a set of all the constant Symbols occurring in this Clause.
public java.util.Set<Variable> getVariables()
This function adds all the Variables in this Clause to the returned Set.
public java.util.Map<Symbol,java.lang.Integer> getFunctions()
This function returns a set of all the function Symbols occurring in this Clause. Each function is mapped to its arity.
public java.util.Map<NamedSymbol,java.lang.Integer> getPredicates()
This function returns a set of all the predicate Symbols occurring in this Clause.
public Sentence toSentence()
This function converts this Clause to an ordinary first-order Sentence, which is either TruthValue.FALSE for the empty Clause, a Literal for a unit Clause, or a disjunction of the Literals in this Clause.
public BooleanSymbol evaluate(Interpretation ipt, Substitution s)
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 ConnectedSentence the returned truth value depends on the connective. It will be BooleanSymbol.TRUE iff:
ipt
- the Interpretation giving truth values for propositions
public java.lang.String toString()
A Clause is printed as:
( <literal>+ )
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
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 java.lang.Object
obj
- the Object this one is to be compared to
public boolean equals(Clause other)
This function tests whether this and the given Clause are equal. In general, two Clauses are equal if they contain equal Literals, where the order of the Literals is not relevant.
other
- the Clause this one is to be compared to
public final int hashCode()
This function returns the hash code of this Clause.
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |