Browse Source

Added functionality to BitVectorHashMap

Former-commit-id: 0d1fa18d16
main
Mavo 9 years ago
parent
commit
dd17955a3e
  1. 5
      src/storage/BitVectorHashMap.cpp
  2. 8
      src/storage/BitVectorHashMap.h
  3. 2
      src/storage/dft/DFTState.cpp
  4. 6
      src/storage/dft/DFTState.h

5
src/storage/BitVectorHashMap.cpp

@ -168,6 +168,11 @@ namespace storm {
return values[flagBucketPair.second]; return values[flagBucketPair.second];
} }
template<class ValueType, class Hash1, class Hash2>
bool BitVectorHashMap<ValueType, Hash1, Hash2>::contains(storm::storage::BitVector const& key) const {
return findBucket(key).first;
}
template<class ValueType, class Hash1, class Hash2> template<class ValueType, class Hash1, class Hash2>
typename BitVectorHashMap<ValueType, Hash1, Hash2>::const_iterator BitVectorHashMap<ValueType, Hash1, Hash2>::begin() const { typename BitVectorHashMap<ValueType, Hash1, Hash2>::const_iterator BitVectorHashMap<ValueType, Hash1, Hash2>::begin() const {
return const_iterator(*this, occupied.begin()); return const_iterator(*this, occupied.begin());

8
src/storage/BitVectorHashMap.h

@ -95,6 +95,14 @@ namespace storm {
*/ */
ValueType getValue(storm::storage::BitVector const& key) const; ValueType getValue(storm::storage::BitVector const& key) const;
/*!
* Checks if the given key is already contained in the map.
*
* @param key The key to search
* @return True if the key is already contained in the map
*/
bool contains(storm::storage::BitVector const& key) const;
/*! /*!
* Retrieves an iterator to the elements of the map. * Retrieves an iterator to the elements of the map.
* *

2
src/storage/dft/DFTState.cpp

@ -123,7 +123,7 @@ namespace storm {
} }
template<typename ValueType> template<typename ValueType>
bool DFTState<ValueType>::isUsed(size_t child) {
bool DFTState<ValueType>::isUsed(size_t child) const {
return (std::find(mUsedRepresentants.begin(), mUsedRepresentants.end(), child) != mUsedRepresentants.end()); return (std::find(mUsedRepresentants.begin(), mUsedRepresentants.end(), child) != mUsedRepresentants.end());
} }

6
src/storage/dft/DFTState.h

@ -61,7 +61,7 @@ namespace storm {
mValid = false; mValid = false;
} }
bool isInvalid() {
bool isInvalid() const {
return !mValid; return !mValid;
} }
@ -88,7 +88,7 @@ namespace storm {
* @param child The id of the child for which we want to know whether it is currently used. * @param child The id of the child for which we want to know whether it is currently used.
* @return true iff it is currently used by any of the spares. * @return true iff it is currently used by any of the spares.
*/ */
bool isUsed(size_t child);
bool isUsed(size_t child) const;
/** /**
* Sets to to the usageIndex which child is now used. * Sets to to the usageIndex which child is now used.
@ -114,7 +114,7 @@ namespace storm {
*/ */
std::pair<std::shared_ptr<DFTBE<ValueType>>, bool> letNextBEFail(size_t smallestIndex = 0); std::pair<std::shared_ptr<DFTBE<ValueType>>, bool> letNextBEFail(size_t smallestIndex = 0);
std::string getCurrentlyFailableString() {
std::string getCurrentlyFailableString() const {
std::stringstream stream; std::stringstream stream;
auto it = mIsCurrentlyFailableBE.begin(); auto it = mIsCurrentlyFailableBE.begin();
stream << "{"; stream << "{";

Loading…
Cancel
Save