|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectai.krr.propositions.IntEncodedClause
public class IntEncodedClause
An IntEncodedClause consists of a list of Literals that are interpreted as a disjunction. Internally Literals are stored in an array of ints, using an encoding provided at construction time. Note that the list representation means that the order of Literals within a Clause may be relevant, e.g. for equality testing. However, IntEncodedClauses that contain more than a fixed number of Literals will be sorted.
Nested Class Summary | |
---|---|
protected static class |
IntEncodedClause.CnfIntEncodedClauseListAdaptor
|
protected static class |
IntEncodedClause.IntEncodedClauseList
|
protected static class |
IntEncodedClause.LiteralSet
|
Field Summary | |
---|---|
protected int |
hValue
a cached hash value for this Clause |
protected int[] |
literals
the encoded Literals in this Clause |
Constructor Summary | |
---|---|
protected |
IntEncodedClause(java.util.Collection<java.lang.Integer> lits)
This constructor creates a Clause from the given Literals. |
protected |
IntEncodedClause(int[] lits)
This constructor creates a Clause from the given Literals and hash value. |
|
IntEncodedClause(IntEncoding enc,
java.util.Collection<Literal> lits)
This constructor for a Clause takes a Collection of Literals. |
|
IntEncodedClause(IntEncoding enc,
Literal... lits)
This constructor for a Clause takes an Array of Literals. |
Method Summary | |
---|---|
protected IntEncodedClause |
clone()
This function generates a shallow copy of this Clause. |
int |
compareTo(IntEncodedClause other)
This function compares this Clause to the given Clause. |
boolean |
contains(int literal)
This function tests whether the given Literal is contained in this Clause. |
boolean |
equals(IntEncodedClause 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. |
int[] |
getLiterals()
This function returns the the Literals that are joined in this Clause. |
java.util.Set<NamedSymbol> |
getPropositions(IntEncoding encoding)
This function returns the set of propositional symbols that occur in this Clause. |
int |
hashCode()
This function returns the hash code of this Clause. |
int |
isTautology()
This function tests whether this clause is a tautology. |
protected IntEncodedClause |
remove(int lit)
This function returns a shallow copy of this Clause in which the given Literal has been removed. |
int |
size()
This function returns the number of 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 int[] literals
protected final int hValue
Constructor Detail |
---|
public IntEncodedClause(IntEncoding enc, java.util.Collection<Literal> lits)
This constructor for a Clause takes a Collection of Literals. The given Collection should not contain duplicate Literals.
enc
- the Class used for consistently encoding Literals as intslits
- the Literals to be connected herepublic IntEncodedClause(IntEncoding enc, Literal... lits)
This constructor for a Clause takes an Array of Literals. The given Collection should not contain duplicate Literals.
enc
- the Class used for consistently encoding Literals as intslits
- the Literals to be connected hereprotected IntEncodedClause(java.util.Collection<java.lang.Integer> lits)
protected IntEncodedClause(int[] lits)
Method Detail |
---|
protected IntEncodedClause 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(IntEncodedClause 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 in which they are stored internally, which may be sorted.
compareTo
in interface java.lang.Comparable<IntEncodedClause>
other
- the Clause to which this Clause is to be compared
public final int[] 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(int literal)
This function tests whether the given Literal is contained in this Clause.
literal
- the Literal to be tested for
public java.util.Set<NamedSymbol> getPropositions(IntEncoding encoding)
This function returns the set of propositional symbols that occur in this Clause. The boolean propositions TRUE and FALSE will not be contained in the result.
public int isTautology()
This function tests whether this clause is a tautology. This is the case if it contains a complementary pair of Literals.
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 Clauses are equal if all the Literals 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(IntEncodedClause 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 only relevant if they are not sorted.
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
protected IntEncodedClause remove(int lit)
This function returns a shallow copy of this Clause in which the given Literal has been removed. If the given Literal is not contained in this Clause this function returns null.
lit
- the Literal to be omitted in the copy
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |