public class NicePossibleWorld extends InterpretationSet<Proposition,PlBeliefSet,PropositionalFormula> implements java.util.Comparator<Pair<Proposition,java.lang.Boolean>>
Modifier and Type | Field and Description |
---|---|
private java.util.SortedSet<Pair<Proposition,java.lang.Boolean>> |
representation
The set saving all the proposition boolean pairs that represent this
world assuming the current signature.
|
private PossibleWorld |
world
Implementation of possible world with a small memory print and
fast satisfication tests.
|
Constructor and Description |
---|
NicePossibleWorld(java.util.Collection<Proposition> trueInWorld,
java.util.Collection<Proposition> signature)
Ctor: Generates the possible world using the given set of true propositions and
generated a representation of the possible world using the given signature.
|
NicePossibleWorld(java.util.Collection<Proposition> trueInWorld,
java.util.Collection<Proposition> signature,
java.util.Comparator<Pair<Proposition,java.lang.Boolean>> comparator)
Ctor: Generates the possible world using the given set of true propositions and
generated a representation of the possible world using the given signature.
|
Modifier and Type | Method and Description |
---|---|
int |
compare(Pair<Proposition,java.lang.Boolean> o1,
Pair<Proposition,java.lang.Boolean> o2) |
boolean |
equals(java.lang.Object other) |
static java.util.Set<NicePossibleWorld> |
getAllPossibleWorlds(java.util.Collection<Proposition> signature) |
PossibleWorld |
getOptimizedWorld() |
java.util.Set<Pair<Proposition,java.lang.Boolean>> |
getRepresentationStructure() |
int |
hashCode() |
boolean |
satisfies(PlBeliefSet beliefBase)
Checks whether this interpretation satisfies the given knowledge base.
|
boolean |
satisfies(PropositionalFormula formula)
Checks whether this interpretation satisfies the given formula.
|
void |
setComparator(java.util.Comparator<Pair<Proposition,java.lang.Boolean>> comparator)
Changes the used comparator to sort the representation structure and resorts
the representation.
|
boolean |
setSignature(java.util.Collection<Proposition> signature)
Changes the signature of the world.
|
java.lang.String |
toString() |
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
satisfies
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
private PossibleWorld world
private java.util.SortedSet<Pair<Proposition,java.lang.Boolean>> representation
public NicePossibleWorld(java.util.Collection<Proposition> trueInWorld, java.util.Collection<Proposition> signature)
trueInWorld
- A set of propositions describing those propositions that are
true in this possible world. It has to be a subset of
signature.signature
- A set of propositions describing all know propositions by the
the problem, the signature. It has to be a super set of
trueInWorldpublic NicePossibleWorld(java.util.Collection<Proposition> trueInWorld, java.util.Collection<Proposition> signature, java.util.Comparator<Pair<Proposition,java.lang.Boolean>> comparator)
trueInWorld
- A set of propositions describing those propositions that are
true in this possible world. It has to be a subset of
signature.signature
- A set of propositions describing all know propositions by the
the problem, the signature. It has to be a super set of
trueInWorldpublic boolean setSignature(java.util.Collection<Proposition> signature)
signature
- A collection of propositions defining the new signature.public void setComparator(java.util.Comparator<Pair<Proposition,java.lang.Boolean>> comparator)
comparator
- The new comparator used to sort the representation. If
a null is given the default alphabetically ordering is
used.public PossibleWorld getOptimizedWorld()
public java.util.Set<Pair<Proposition,java.lang.Boolean>> getRepresentationStructure()
public boolean satisfies(PropositionalFormula formula) throws java.lang.IllegalArgumentException
Interpretation
satisfies
in interface Interpretation<PlBeliefSet,PropositionalFormula>
formula
- a formula .java.lang.IllegalArgumentException
- if the formula does not correspond
to the expected language.public boolean satisfies(PlBeliefSet beliefBase) throws java.lang.IllegalArgumentException
Interpretation
satisfies
in interface Interpretation<PlBeliefSet,PropositionalFormula>
beliefBase
- a knowledge base.java.lang.IllegalArgumentException
- IllegalArgumentException if the knowledgebase does not correspond
to the expected language.public boolean equals(java.lang.Object other)
equals
in interface java.util.Collection<Proposition>
equals
in interface java.util.Comparator<Pair<Proposition,java.lang.Boolean>>
equals
in class InterpretationSet<Proposition,PlBeliefSet,PropositionalFormula>
public int hashCode()
hashCode
in interface java.util.Collection<Proposition>
hashCode
in class InterpretationSet<Proposition,PlBeliefSet,PropositionalFormula>
public java.lang.String toString()
toString
in class InterpretationSet<Proposition,PlBeliefSet,PropositionalFormula>
public int compare(Pair<Proposition,java.lang.Boolean> o1, Pair<Proposition,java.lang.Boolean> o2)
compare
in interface java.util.Comparator<Pair<Proposition,java.lang.Boolean>>
public static java.util.Set<NicePossibleWorld> getAllPossibleWorlds(java.util.Collection<Proposition> signature)