dlvhex
2.5.0
|
Data structure for storing sets based on a sorted array. More...
#include <include/dlvhex2/Set.h>
Public Types | |
typedef set_iterator< T > | iterator |
typedef const_set_iterator< T > | const_iterator |
typedef T | value_type |
typedef const T & | const_reference |
Public Member Functions | |
Set (int initialSize=0, int inc=10) | |
Constructor. | |
Set (const Set< T > &s2) | |
Copy-constructor. | |
virtual | ~Set () |
Destructor. | |
bool | contains (T e) const |
Checks if an element is contained in the set. | |
int | count (T e) const |
Retrieves the size of the Set. | |
void | insert (T e) |
Adds an element to the Set. | |
template<typename _Iter > | |
void | insert (_Iter begin, _Iter end) |
Inserts a range of elements given by a pair of begin and end iterator. | |
void | erase (T e) |
Removes an element from the Set if contained. | |
set_iterator< T > | find (T e) |
Searches for an element in the Set. | |
const_set_iterator< T > | find (T e) const |
Searches for an element in the Set. | |
bool | empty () const |
Checks if the Set is empty. | |
void | clear () |
Empties the Set. | |
set_iterator< T > | begin () |
Retruns the begin iterator of the Set. | |
set_iterator< T > | end () |
Retruns the end iterator of the Set. | |
const_set_iterator< T > | begin () const |
Retruns the const begin iterator of the Set. | |
const_set_iterator< T > | end () const |
Retruns the const end iterator of the Set. | |
T & | operator[] (int i) |
Accesses an element given by its index. | |
const T & | operator[] (int i) const |
Accesses an element given by its index. | |
int | size () const |
Retrieves the size of the Set. | |
T * | getData () |
Retrieves the internal data (array). | |
const T * | getData () const |
Retrieves the internal data (array). | |
Set< T > & | operator= (const Set< T > &s2) |
Assigns another Set to this one. | |
Private Member Functions | |
void | grow () |
Grows Set::data such that it covers Set::allocSize. | |
void | grow (int minSize) |
Grows Set::data such that it covers a given minimum size. | |
int | binarySearch (T e) const |
Implements binary search for the set. | |
Private Attributes | |
T * | data |
int | allocSize |
int | rsize |
int | increase |
Data structure for storing sets based on a sorted array.
typedef const_set_iterator<T> Set< T >::const_iterator |
typedef const T& Set< T >::const_reference |
typedef set_iterator<T> Set< T >::iterator |
typedef T Set< T >::value_type |
set_iterator<T> Set< T >::begin | ( | ) | [inline] |
Retruns the begin iterator of the Set.
Definition at line 439 of file Set.h.
Referenced by NogoodSet::addNogood(), InternalGroundASPSolver::getImplicationGraphAsDotString(), InternalGroundASPSolver::getInconsistencyCause(), InternalGroundASPSolver::getLoopNogood(), InternalGroundASPSolver::getUnfoundedSet(), CDNLSolver::initListOfAllAtoms(), InternalGroundASPSolver::intersect(), ExternalLearningHelper::learnFromInputOutputBehavior(), ExternalLearningHelper::learnFromNegativeAtoms(), Nogood::operator==(), Nogood::resolve(), CDNLSolver::resolve(), CDNLSolver::unitPropagation(), and InternalGroundASPSolver::updateUnfoundedSetStructuresAfterSetFact().
const_set_iterator<T> Set< T >::begin | ( | ) | const [inline] |
int Set< T >::binarySearch | ( | T | e | ) | const [inline, private] |
Implements binary search for the set.
e | Element to search for. |
e
in the Set or 0 if it is not contained. Definition at line 265 of file Set.h.
Referenced by Set< IDAddress >::contains(), Set< IDAddress >::erase(), Set< IDAddress >::find(), and Set< IDAddress >::insert().
Empties the Set.
Definition at line 433 of file Set.h.
Referenced by NogoodSet::defragment(), InternalGroundASPSolver::getUnfoundedSet(), CDNLSolver::initWatchingStructures(), Set< IDAddress >::operator=(), CDNLSolver::updateWatchingStructuresAfterAddNogood(), and CDNLSolver::updateWatchingStructuresAfterClearFact().
Checks if an element is contained in the set.
e | Element to search for. |
e
is contained in the Set and false otherwise. Definition at line 336 of file Set.h.
Referenced by CDNLSolver::addNogoodAndUpdateWatchingStructures(), Set< IDAddress >::count(), ExternalLearningHelper::learnFromInputOutputBehavior(), and InternalGroundASPSolver::restartWithAssumptions().
Retrieves the size of the Set.
For compatibility with std::set.
Definition at line 346 of file Set.h.
Referenced by NogoodSet::defragment(), InternalGroundASPSolver::getUnfoundedSet(), InternalGroundASPSolver::initSourcePointers(), GenuineGuessAndCheckModelGenerator::inlineExternalAtoms(), GenuineGuessAndCheckModelGenerator::learnSupportSets(), InternalGroundASPSolver::satisfiesIndependently(), InternalGroundASPSolver::setEDB(), InternalGroundASPSolver::updateUnfoundedSetStructuresAfterClearFact(), InternalGroundASPSolver::updateUnfoundedSetStructuresAfterSetFact(), and InternalGroundASPSolver::useAsNewSourceForHeadAtom().
set_iterator<T> Set< T >::end | ( | ) | [inline] |
Retruns the end iterator of the Set.
Definition at line 445 of file Set.h.
Referenced by Set< IDAddress >::find(), CDNLSolver::initListOfAllAtoms(), Nogood::insert(), Set< IDAddress >::insert(), InternalGroundASPSolver::intersect(), ExternalLearningHelper::learnFromInputOutputBehavior(), ExternalLearningHelper::learnFromNegativeAtoms(), Nogood::resolve(), CDNLSolver::resolve(), and InternalGroundASPSolver::updateUnfoundedSetStructuresAfterSetFact().
const_set_iterator<T> Set< T >::end | ( | ) | const [inline] |
Removes an element from the Set if contained.
e | Element to remove. |
Definition at line 384 of file Set.h.
Referenced by NogoodSet::addNogood(), NogoodSet::defragment(), InternalGroundASPSolver::getUnfoundedSet(), CDNLSolver::inactivateNogood(), ExternalLearningHelper::learnFromInputOutputBehavior(), ExternalLearningHelper::learnFromNegativeAtoms(), InternalGroundASPSolver::removePropagator(), CDNLSolver::removePropagator(), Nogood::resolve(), CDNLSolver::resolve(), CDNLSolver::unitPropagation(), InternalGroundASPSolver::updateUnfoundedSetStructuresAfterSetFact(), CDNLSolver::updateWatchingStructuresAfterClearFact(), and CDNLSolver::updateWatchingStructuresAfterSetFact().
set_iterator<T> Set< T >::find | ( | T | e | ) | [inline] |
const_set_iterator<T> Set< T >::find | ( | T | e | ) | const [inline] |
Grows Set::data such that it covers Set::allocSize.
Definition at line 247 of file Set.h.
Referenced by Set< IDAddress >::insert(), and Set< IDAddress >::operator=().
Adds an element to the Set.
e | Element to add. |
Reimplemented in Nogood.
Definition at line 353 of file Set.h.
Referenced by InternalGroundASPSolver::addPropagator(), CDNLSolver::addPropagator(), InternalGrounder::buildGroundInstance(), InternalGroundASPSolver::computeStronglyConnectedComponents(), InternalGroundASPSolver::createNewBodyAtom(), InternalGroundASPSolver::createShiftedProgram(), InternalGroundASPSolver::getDependingAtoms(), InternalGroundASPSolver::getExternalSupport(), InternalGroundASPSolver::getInitialNewlyUnfoundedAtomsAfterSetFact(), ExternalLearningHelper::getOutputAtoms(), InternalGroundASPSolver::getUnfoundedSet(), InternalGroundASPSolver::initializeLists(), CDNLSolver::initListOfAllAtoms(), InternalGroundASPSolver::initSourcePointers(), Nogood::insert(), Set< IDAddress >::insert(), NogoodSet::removeNogood(), InternalGroundASPSolver::satisfiesIndependently(), InternalGroundASPSolver::updateUnfoundedSetStructuresAfterClearFact(), InternalGroundASPSolver::updateUnfoundedSetStructuresAfterSetFact(), CDNLSolver::updateWatchingStructuresAfterAddNogood(), CDNLSolver::updateWatchingStructuresAfterClearFact(), and CDNLSolver::updateWatchingStructuresAfterSetFact().
T& Set< T >::operator[] | ( | int | i | ) | [inline] |
const T& Set< T >::operator[] | ( | int | i | ) | const [inline] |
Retrieves the size of the Set.
For compatibility with std::set.
Definition at line 482 of file Set.h.
Referenced by NogoodSet::addNogood(), CDNLSolver::complete(), NogoodSet::defragment(), CDNLSolver::getGuess(), InternalGroundASPSolver::getImplicationGraphAsDotString(), InternalGroundASPSolver::getInconsistencyCause(), InternalGroundASPSolver::getNextModel(), NogoodSet::getNogoodCount(), InternalGroundASPSolver::getUnfoundedSet(), InternalGrounder::groundStratum(), Set< IDAddress >::insert(), ExternalLearningHelper::learnFromInputOutputBehavior(), ExternalLearningHelper::learnFromNegativeAtoms(), Set< IDAddress >::operator=(), Nogood::operator==(), Nogood::resolve(), CDNLSolver::unitPropagation(), GenuineGuessAndCheckModelGenerator::updateEANogoods(), InternalGroundASPSolver::updateUnfoundedSetStructuresAfterSetFact(), CDNLSolver::updateWatchingStructuresAfterAddNogood(), and CDNLSolver::updateWatchingStructuresAfterClearFact().
Definition at line 242 of file Set.h.
Referenced by Set< IDAddress >::grow(), Set< IDAddress >::insert(), and Set< IDAddress >::Set().
Definition at line 240 of file Set.h.
Referenced by Set< IDAddress >::binarySearch(), Set< IDAddress >::contains(), Set< IDAddress >::erase(), Set< IDAddress >::find(), Set< IDAddress >::getData(), Set< IDAddress >::grow(), Set< IDAddress >::insert(), Set< IDAddress >::operator=(), Set< IDAddress >::operator[](), Set< IDAddress >::Set(), and Set< IDAddress >::~Set().
Definition at line 244 of file Set.h.
Referenced by Set< IDAddress >::grow(), and Set< IDAddress >::Set().
Definition at line 243 of file Set.h.
Referenced by Set< IDAddress >::binarySearch(), Set< IDAddress >::clear(), Set< IDAddress >::contains(), Set< IDAddress >::empty(), Set< IDAddress >::end(), Set< IDAddress >::erase(), Set< IDAddress >::find(), Set< IDAddress >::insert(), Set< IDAddress >::operator=(), Set< IDAddress >::Set(), and Set< IDAddress >::size().