Package net.sf.tweety.logics.pl.util
Class EnumeratingIterator
- java.lang.Object
-
- net.sf.tweety.logics.pl.util.EnumeratingIterator
-
- All Implemented Interfaces:
java.util.Iterator<PlBeliefSet>
,BeliefSetIterator<PlFormula,PlBeliefSet>
public class EnumeratingIterator extends java.lang.Object implements BeliefSetIterator<PlFormula,PlBeliefSet>
This sampler enumerates all possible propositional belief bases of the given signature. It does so by taking all subsets of the set of interpretations as the models of some formula and combines all these formulas in all ways.- Author:
- Matthias Thimm
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<PossibleWorld>
allWorlds
All possible worldsprivate int
currentLength
The current lengthprivate java.util.BitSet
indices
The current indices of the worlds that construct the formulas.private PlSignature
signature
The used signature.
-
Constructor Summary
Constructors Constructor Description EnumeratingIterator(PlSignature signature)
Creates a new sampler for the given signature
-
Method Summary
Modifier and Type Method Description boolean
hasNext()
private java.util.BitSet
increment(java.util.BitSet bitSet)
Increments the given bit set, returns null if an overflow happens.PlBeliefSet
next()
-
-
-
Field Detail
-
currentLength
private int currentLength
The current length
-
allWorlds
private java.util.List<PossibleWorld> allWorlds
All possible worlds
-
indices
private java.util.BitSet indices
The current indices of the worlds that construct the formulas.
-
signature
private PlSignature signature
The used signature.
-
-
Constructor Detail
-
EnumeratingIterator
public EnumeratingIterator(PlSignature signature)
Creates a new sampler for the given signature- Parameters:
signature
- some signature
-
-
Method Detail
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfaceBeliefSetIterator<PlFormula,PlBeliefSet>
- Specified by:
hasNext
in interfacejava.util.Iterator<PlBeliefSet>
-
next
public PlBeliefSet next()
- Specified by:
next
in interfaceBeliefSetIterator<PlFormula,PlBeliefSet>
- Specified by:
next
in interfacejava.util.Iterator<PlBeliefSet>
-
increment
private java.util.BitSet increment(java.util.BitSet bitSet)
Increments the given bit set, returns null if an overflow happens.- Parameters:
bitSet
- some bit set.- Returns:
- the incremented bit set
-
-