73 template <
typename TYPE,
77 public set<TYPE, ALLOC>,
107 class Iterator final :
public hashTable<TYPE, const bool, ALLOC, HASH>::Iterator,
118 u_integer bucket = 0, hashNode* node =
nullptr);
129 friend class hashSet;
135 Iterator(
const Iterator& other);
142 Iterator&
operator=(
const Iterator& other);
148 Iterator*
clone()
const override;
154 [[nodiscard]] std::string
className()
const override;
177 [[nodiscard]]
bool hasNext()
const override;
182 [[nodiscard]]
bool hasPrev()
const override;
201 void next()
const override;
206 void prev()
const override;
211 Iterator*
getPrev()
const override;
217 const TYPE&
get()
override;
223 const TYPE
get()
const override;
228 void set(
const TYPE& data)
override;
234 [[nodiscard]]
bool isValid()
const override;
236 ~Iterator()
override =
default;
244 explicit hashSet(HASH
hash = HASH{}, ALLOC alloc = ALLOC{});
292 bool contains(
const TYPE &e)
const override;
299 bool add(
const TYPE &e)
override;
306 bool remove(
const TYPE &e)
override;
312 Iterator*
begins()
const override;
318 Iterator*
ends()
const override;
324 [[nodiscard]] std::string
className()
const override;
331 [[nodiscard]] std::string
toString(
bool enter)
const override;
361 template <
typename TYPE,
365 public set<TYPE, ALLOC>,
374 using RBNode =
typename RBTreeType::RBNode;
389 class Iterator final :
public RBTreeType::Iterator,
398 explicit Iterator(RBTreeType* tree, RBNode* cur);
408 friend class treeSet;
414 Iterator(
const Iterator& other);
421 Iterator&
operator=(
const Iterator& other);
427 Iterator*
clone()
const override;
433 [[nodiscard]] std::string
className()
const override;
456 [[nodiscard]]
bool hasNext()
const override;
462 [[nodiscard]]
bool hasPrev()
const override;
481 void next()
const override;
486 void prev()
const override;
492 Iterator*
getPrev()
const override;
498 const TYPE&
get()
override;
504 const TYPE
get()
const override;
510 void set(
const TYPE& data)
override;
516 [[nodiscard]]
bool isValid()
const override;
518 ~Iterator()
override =
default;
576 bool contains(
const TYPE &e)
const override;
583 bool add(
const TYPE &e)
override;
590 bool remove(
const TYPE &e)
override;
596 Iterator*
begins()
const override;
602 Iterator*
ends()
const override;
608 [[nodiscard]] std::string
className()
const override;
615 [[nodiscard]] std::string
toString(
bool enter)
const override;
649 template <
typename TYPE,
652 class JSet final :
public skipList<const TYPE, const bool, ALLOC, Compare>,
653 public set<TYPE, ALLOC>,
662 using skipListNode =
typename skipListType::skipListNode;
678 class Iterator final :
public skipListType::Iterator,
697 explicit Iterator(skipListNode* cur);
722 [[nodiscard]] std::string
className()
const override;
747 [[nodiscard]]
bool hasNext()
const override;
752 [[nodiscard]]
bool hasPrev()
const override;
771 void next()
const override;
776 void prev()
const override;
787 const TYPE&
get()
override;
793 const TYPE
get()
const override;
798 void set(
const TYPE& data)
override;
804 [[nodiscard]]
bool isValid()
const override;
864 bool contains(
const TYPE &e)
const override;
871 bool add(
const TYPE &e)
override;
879 bool remove(
const TYPE &e)
override;
886 Iterator*
begins()
const override;
893 Iterator*
ends()
const override;
899 [[nodiscard]] std::string
className()
const override;
907 [[nodiscard]] std::string
toString(
bool enter)
const override;
918template<
typename TYPE,
typename HASH,
typename ALLOC>
919original::hashSet<TYPE, HASH, ALLOC>::Iterator::Iterator(vector<hashNode*, rebind_alloc_pointer> *buckets,
920u_integer bucket, hashNode *node) : hashTable<TYPE, const bool, ALLOC, HASH>::Iterator(
921 const_cast<vector<hashNode*, rebind_alloc_pointer>*>(buckets), bucket, node) {}
923template<
typename TYPE,
typename HASH,
typename ALLOC>
924bool original::hashSet<TYPE, HASH, ALLOC>::Iterator::equalPtr(
const iterator<const TYPE> *other)
const {
925 auto other_it =
dynamic_cast<const Iterator*
>(other);
927 this->p_buckets == other_it->p_buckets &&
928 this->cur_bucket == other_it->cur_bucket &&
929 this->p_node == other_it->p_node;
932template<
typename TYPE,
typename HASH,
typename ALLOC>
933original::hashSet<TYPE, HASH, ALLOC>::Iterator::Iterator(
const Iterator &other) : Iterator() {
937template<
typename TYPE,
typename HASH,
typename ALLOC>
940 if (
this == &other) {
948template<
typename TYPE,
typename HASH,
typename ALLOC>
951 return new Iterator(*
this);
954template<
typename TYPE,
typename HASH,
typename ALLOC>
956 return "hashSet::Iterator";
959template<
typename TYPE,
typename HASH,
typename ALLOC>
964template<
typename TYPE,
typename HASH,
typename ALLOC>
969template<
typename TYPE,
typename HASH,
typename ALLOC>
975template<
typename TYPE,
typename HASH,
typename ALLOC>
980template<
typename TYPE,
typename HASH,
typename ALLOC>
985template<
typename TYPE,
typename HASH,
typename ALLOC>
987 auto other_it =
dynamic_cast<const Iterator*
>(other);
992 if (!
next->isValid()){
997 return next->equalPtr(other_it);
1000template<
typename TYPE,
typename HASH,
typename ALLOC>
1002 return other->
atPrev(*
this);
1005template<
typename TYPE,
typename HASH,
typename ALLOC>
1010template<
typename TYPE,
typename HASH,
typename ALLOC>
1015template<
typename TYPE,
typename HASH,
typename ALLOC>
1021template<
typename TYPE,
typename HASH,
typename ALLOC>
1026template<
typename TYPE,
typename HASH,
typename ALLOC>
1031template<
typename TYPE,
typename HASH,
typename ALLOC>
1036template<
typename TYPE,
typename HASH,
typename ALLOC>
1041template<
typename TYPE,
typename HASH,
typename ALLOC>
1043 :
hashTable<TYPE, const bool, ALLOC, HASH>(std::move(
hash)),
1044 set<TYPE, ALLOC>(std::move(alloc)) {}
1046template<
typename TYPE,
typename HASH,
typename ALLOC>
1051template<
typename TYPE,
typename HASH,
typename ALLOC>
1054 if (
this == &other) {
1058 this->buckets = this->bucketsCopy(other.buckets);
1059 this->size_ = other.size_;
1060 this->hash_ = other.hash_;
1061 if constexpr(ALLOC::propagate_on_container_copy_assignment::value) {
1063 this->rebind_alloc = other.rebind_alloc;
1068template<
typename TYPE,
typename HASH,
typename ALLOC>
1073template<
typename TYPE,
typename HASH,
typename ALLOC>
1076 if (
this == &other) {
1080 this->buckets = std::move(other.buckets);
1081 this->size_ = other.size_;
1083 this->hash_ = std::move(other.hash_);
1084 if constexpr(ALLOC::propagate_on_container_move_assignment::value) {
1085 this->
allocator = std::move(other.allocator);
1086 this->rebind_alloc = std::move(other.rebind_alloc);
1091template<
typename TYPE,
typename HASH,
typename ALLOC>
1096template<
typename TYPE,
typename HASH,
typename ALLOC>
1098 return this->find(e);
1101template<
typename TYPE,
typename HASH,
typename ALLOC>
1103 return this->insert(e,
true);
1106template<
typename TYPE,
typename HASH,
typename ALLOC>
1108 return this->erase(e);
1111template<
typename TYPE,
typename HASH,
typename ALLOC>
1115 if (this->buckets[0]) {
1116 return new Iterator(p_buckets, 0, this->buckets[0]);
1119 return new Iterator(p_buckets, bucket, p_buckets->get(bucket));
1122template<
typename TYPE,
typename HASH,
typename ALLOC>
1127 auto node = this->buckets[bucket];
1128 while (node && node->getPNext()) {
1129 node = node->getPNext();
1131 return new Iterator(p_buckets, bucket, node);
1134template<
typename TYPE,
typename HASH,
typename ALLOC>
1139template<
typename TYPE,
typename HASH,
typename ALLOC>
1141 std::stringstream ss;
1145 for (
auto it = this->
begin(); it != this->
end(); it.next()){
1158template<
typename TYPE,
typename HASH,
typename ALLOC>
1159original::hashSet<TYPE, HASH, ALLOC>::~hashSet() =
default;
1161template <
typename TYPE,
typename Compare,
typename ALLOC>
1162original::treeSet<TYPE, Compare, ALLOC>::Iterator::Iterator(RBTreeType* tree, RBNode* cur)
1163 : RBTreeType::Iterator(tree, cur) {}
1165template <
typename TYPE,
typename Compare,
typename ALLOC>
1166bool original::treeSet<TYPE, Compare, ALLOC>::Iterator::equalPtr(
const iterator<const TYPE>* other)
const
1168 auto other_it =
dynamic_cast<const Iterator*
>(other);
1170 this->tree_ == other_it->tree_ &&
1171 this->cur_ == other_it->cur_;
1174template <
typename TYPE,
typename Compare,
typename ALLOC>
1175original::treeSet<TYPE, Compare, ALLOC>::Iterator::Iterator(
const Iterator& other)
1176 : Iterator(nullptr, nullptr)
1181template <
typename TYPE,
typename Compare,
typename ALLOC>
1185 if (
this == &other) {
1189 this->
tree_ = other.tree_;
1190 this->
cur_ = other.cur_;
1194template <
typename TYPE,
typename Compare,
typename ALLOC>
1198 return new Iterator(*
this);
1201template <
typename TYPE,
typename Compare,
typename ALLOC>
1204 return "treeSet::Iterator";
1207template <
typename TYPE,
typename Compare,
typename ALLOC>
1210 RBTreeType::Iterator::operator+=(steps);
1213template <
typename TYPE,
typename Compare,
typename ALLOC>
1216 RBTreeType::Iterator::operator-=(steps);
1219template <
typename TYPE,
typename Compare,
typename ALLOC>
1226template <
typename TYPE,
typename Compare,
typename ALLOC>
1229 return RBTreeType::Iterator::hasNext();
1232template <
typename TYPE,
typename Compare,
typename ALLOC>
1235 return RBTreeType::Iterator::hasPrev();
1238template <
typename TYPE,
typename Compare,
typename ALLOC>
1241 auto other_it =
dynamic_cast<const Iterator*
>(other);
1246 if (!
next->isValid()){
1251 return next->equalPtr(other_it);
1254template <
typename TYPE,
typename Compare,
typename ALLOC>
1257 return other->
atNext(*
this);
1260template <
typename TYPE,
typename Compare,
typename ALLOC>
1263 RBTreeType::Iterator::next();
1266template <
typename TYPE,
typename Compare,
typename ALLOC>
1269 RBTreeType::Iterator::prev();
1272template <
typename TYPE,
typename Compare,
typename ALLOC>
1276 auto it = this->
clone();
1281template <
typename TYPE,
typename Compare,
typename ALLOC>
1284 return RBTreeType::Iterator::get().template
get<0>();
1287template <
typename TYPE,
typename Compare,
typename ALLOC>
1290 return RBTreeType::Iterator::get().template
get<0>();
1293template <
typename TYPE,
typename Compare,
typename ALLOC>
1299template <
typename TYPE,
typename Compare,
typename ALLOC>
1302 return RBTreeType::Iterator::isValid();
1305template<
typename TYPE,
typename Compare,
typename ALLOC>
1307 : RBTreeType(std::move(comp)),
1308 set<TYPE, ALLOC>(std::move(alloc)) {}
1310template<
typename TYPE,
typename Compare,
typename ALLOC>
1315template<
typename TYPE,
typename Compare,
typename ALLOC>
1318 if (
this == &other){
1322 this->destroyTree();
1323 this->root_ = other.treeCopy();
1324 this->size_ = other.size_;
1325 this->compare_ = other.compare_;
1326 if constexpr(ALLOC::propagate_on_container_copy_assignment::value) {
1328 this->rebind_alloc = other.rebind_alloc;
1333template<
typename TYPE,
typename Compare,
typename ALLOC>
1338template<
typename TYPE,
typename Compare,
typename ALLOC>
1341 if (
this == &other){
1345 this->destroyTree();
1346 this->root_ = other.root_;
1347 other.root_ =
nullptr;
1348 this->size_ = other.size_;
1350 this->compare_ = std::move(other.compare_);
1351 if constexpr(ALLOC::propagate_on_container_move_assignment::value) {
1352 this->
allocator = std::move(other.allocator);
1353 this->rebind_alloc = std::move(other.rebind_alloc);
1358template<
typename TYPE,
typename Compare,
typename ALLOC>
1363template<
typename TYPE,
typename Compare,
typename ALLOC>
1365 return this->find(e);
1368template<
typename TYPE,
typename Compare,
typename ALLOC>
1370 return this->insert(e,
true);
1373template<
typename TYPE,
typename Compare,
typename ALLOC>
1375 return this->erase(e);
1378template <
typename TYPE,
typename Compare,
typename ALLOC>
1385template <
typename TYPE,
typename Compare,
typename ALLOC>
1392template<
typename TYPE,
typename Compare,
typename ALLOC>
1397template<
typename TYPE,
typename Compare,
typename ALLOC>
1399 std::stringstream ss;
1403 for (
auto it = this->
begin(); it != this->
end(); it.next()){
1416template<
typename TYPE,
typename Compare,
typename ALLOC>
1419template<
typename TYPE,
typename Compare,
typename ALLOC>
1420bool original::JSet<TYPE, Compare, ALLOC>::Iterator::equalPtr(
1422 auto other_it =
dynamic_cast<const Iterator*
>(other);
1423 return other_it && this->cur_ == other_it->cur_;
1426template<
typename TYPE,
typename Compare,
typename ALLOC>
1430template<
typename TYPE,
typename Compare,
typename ALLOC>
1434template<
typename TYPE,
typename Compare,
typename ALLOC>
1437 skipListType::Iterator::operator=(other);
1441template<
typename TYPE,
typename Compare,
typename ALLOC>
1447template<
typename TYPE,
typename Compare,
typename ALLOC>
1450 return "JSet::Iterator";
1453template<
typename TYPE,
typename Compare,
typename ALLOC>
1455 skipListType::Iterator::operator+=(steps);
1458template<
typename TYPE,
typename Compare,
typename ALLOC>
1463template<
typename TYPE,
typename Compare,
typename ALLOC>
1467 auto other_it =
dynamic_cast<const Iterator*
>(&other);
1468 if (other_it ==
nullptr)
1469 return this > &other ?
1470 std::numeric_limits<integer>::max() :
1471 std::numeric_limits<integer>::min();
1472 return skipListType::Iterator::operator-(*other_it);
1475template<
typename TYPE,
typename Compare,
typename ALLOC>
1477 return skipListType::Iterator::hasNext();
1480template<
typename TYPE,
typename Compare,
typename ALLOC>
1485template<
typename TYPE,
typename Compare,
typename ALLOC>
1488 const auto other_it =
dynamic_cast<const Iterator*
>(other);
1492 auto cloned_it =
ownerPtr(other_it->clone());
1493 return this->equalPtr(cloned_it.get());
1496template<
typename TYPE,
typename Compare,
typename ALLOC>
1499 return other->
atPrev(*
this);
1502template<
typename TYPE,
typename Compare,
typename ALLOC>
1504 skipListType::Iterator::next();
1507template<
typename TYPE,
typename Compare,
typename ALLOC>
1512template<
typename TYPE,
typename Compare,
typename ALLOC>
1518template<
typename TYPE,
typename Compare,
typename ALLOC>
1520 return skipListType::Iterator::get().template
get<0>();
1523template<
typename TYPE,
typename Compare,
typename ALLOC>
1525 return skipListType::Iterator::get().template
get<0>();
1528template<
typename TYPE,
typename Compare,
typename ALLOC>
1533template<
typename TYPE,
typename Compare,
typename ALLOC>
1535 return skipListType::Iterator::isValid();
1538template<
typename TYPE,
typename Compare,
typename ALLOC>
1540 : skipListType(std::move(comp)),
1541 set<TYPE, ALLOC>(std::move(alloc)) {}
1543template<
typename TYPE,
typename Compare,
typename ALLOC>
1548template<
typename TYPE,
typename Compare,
typename ALLOC>
1551 if (
this == &other){
1555 this->listDestroy();
1556 this->head_ = other.listCopy();
1557 this->size_ = other.size_;
1558 this->compare_ = other.compare_;
1559 if constexpr(ALLOC::propagate_on_container_copy_assignment::value) {
1561 this->rebind_alloc = other.rebind_alloc;
1566template<
typename TYPE,
typename Compare,
typename ALLOC>
1571template<
typename TYPE,
typename Compare,
typename ALLOC>
1574 if (
this == &other){
1578 this->listDestroy();
1579 this->head_ = other.head_;
1580 other.head_ = other.createNode();
1581 this->size_ = other.size_;
1583 this->compare_ = std::move(other.compare_);
1584 if constexpr(ALLOC::propagate_on_container_move_assignment::value) {
1585 this->
allocator = std::move(other.allocator);
1586 this->rebind_alloc = std::move(other.rebind_alloc);
1591template<
typename TYPE,
typename Compare,
typename ALLOC>
1596template<
typename TYPE,
typename Compare,
typename ALLOC>
1598 return this->find(e);
1601template<
typename TYPE,
typename Compare,
typename ALLOC>
1603 return this->insert(e,
true);
1606template<
typename TYPE,
typename Compare,
typename ALLOC>
1608 return this->erase(e);
1611template<
typename TYPE,
typename Compare,
typename ALLOC>
1614 return new Iterator(this->head_->getPNext(1));
1617template<
typename TYPE,
typename Compare,
typename ALLOC>
1620 return new Iterator(this->findLastNode());
1623template<
typename TYPE,
typename Compare,
typename ALLOC>
1628template<
typename TYPE,
typename Compare,
typename ALLOC>
1630 std::stringstream ss;
1634 for (
auto it = this->
begin(); it != this->
end(); it.next()){
1647template<
typename TYPE,
typename Compare,
typename ALLOC>
Red-Black Tree implementation header.
Memory allocation interface and implementations.
Forward iterator for JSet.
Definition sets.h:679
void prev() const override
Not supported (throws unSupportedMethodError)
Definition sets.h:1508
bool hasNext() const override
Checks if more elements exist in forward direction.
Definition sets.h:1476
bool atNext(const iterator< const TYPE > *other) const override
Checks if other is next to this.
Definition sets.h:1497
Iterator & operator=(const Iterator &other)
Copy assignment operator.
Definition sets.h:1436
Iterator(skipListNode *cur)
Constructs iterator pointing to specific skip list node.
Definition sets.h:1427
Iterator * getPrev() const override
Not supported (throws unSupportedMethodError)
Definition sets.h:1514
void next() const override
Moves to next element.
Definition sets.h:1503
void operator-=(integer steps) const override
Not supported (throws unSupportedMethodError)
Definition sets.h:1459
std::string className() const override
Gets iterator class name.
Definition sets.h:1449
void operator+=(integer steps) const override
Advances iterator by steps.
Definition sets.h:1454
bool hasPrev() const override
Not supported (throws unSupportedMethodError)
Definition sets.h:1481
const TYPE & get() override
Gets current element (non-const)
Definition sets.h:1519
integer operator-(const iterator< const TYPE > &other) const override
Calculates distance between iterators.
Definition sets.h:1465
bool atPrev(const iterator< const TYPE > *other) const override
Checks if other is previous to this.
Definition sets.h:1486
void set(const TYPE &data) override
Not supported (throws unSupportedMethodError)
Definition sets.h:1529
Iterator * clone() const override
Creates a copy of this iterator.
Definition sets.h:1443
bool isValid() const override
Checks if iterator is valid.
Definition sets.h:1534
Skip List based implementation of the set interface.
Definition sets.h:655
JSet(Compare comp=Compare{}, ALLOC alloc=ALLOC{})
Constructs empty JSet.
Definition sets.h:1539
std::string className() const override
Gets class name.
Definition sets.h:1624
~JSet() override
Destructor.
JSet & operator=(const JSet &other)
Copy assignment operator.
Definition sets.h:1550
Iterator * begins() const override
Gets begin iterator.
Definition sets.h:1613
std::string toString(bool enter) const override
Converts to string representation.
Definition sets.h:1629
bool add(const TYPE &e) override
Adds new element.
Definition sets.h:1602
bool remove(const TYPE &e) override
Removes element.
Definition sets.h:1607
u_integer size() const override
Gets number of elements.
Definition sets.h:1592
bool contains(const TYPE &e) const override
Checks if element exists.
Definition sets.h:1597
Iterator * ends() const override
Gets end iterator.
Definition sets.h:1619
RBNode * cur_
Definition RBTree.h:222
RBTree * tree_
Definition RBTree.h:221
Red-Black Tree container implementation.
Definition RBTree.h:40
Default memory allocator using allocators utilities.
Definition allocator.h:154
A base class for basic iterators.
Definition iterator.h:296
Forward declaration of hash class template.
Definition hash.h:80
Forward iterator for hashSet.
Definition sets.h:108
bool atNext(const iterator< const TYPE > *other) const override
Checks if other is next to this.
Definition sets.h:1001
bool hasNext() const override
Checks if more elements exist.
Definition sets.h:976
void operator-=(integer steps) const override
Not supported (throws unSupportedMethodError)
Definition sets.h:965
void next() const override
Moves to next element.
Definition sets.h:1006
bool atPrev(const iterator< const TYPE > *other) const override
Checks if other is previous to this.
Definition sets.h:986
Iterator * clone() const override
Creates a copy of this iterator.
Definition sets.h:950
bool hasPrev() const override
Not supported (throws unSupportedMethodError)
Definition sets.h:981
void set(const TYPE &data) override
Not supported (throws unSupportedMethodError)
Definition sets.h:1032
Iterator * getPrev() const override
Not supported (throws unSupportedMethodError)
Definition sets.h:1017
Iterator & operator=(const Iterator &other)
Copy assignment operator.
Definition sets.h:939
bool isValid() const override
Checks if iterator is valid.
Definition sets.h:1037
const TYPE & get() override
Gets current element (non-const)
Definition sets.h:1022
integer operator-(const iterator< const TYPE > &other) const override
Not supported (throws unSupportedMethodError)
Definition sets.h:971
std::string className() const override
Gets iterator class name.
Definition sets.h:955
void prev() const override
Not supported (throws unSupportedMethodError)
Definition sets.h:1011
void operator+=(integer steps) const override
Advances iterator by steps.
Definition sets.h:960
Hash table based implementation of the set interface.
Definition sets.h:79
std::string className() const override
Gets class name.
Definition sets.h:1135
u_integer size() const override
Gets number of elements.
Definition sets.h:1092
hashSet(HASH hash=HASH{}, ALLOC alloc=ALLOC{})
Constructs empty hashSet.
Definition sets.h:1042
bool add(const TYPE &e) override
Adds new element.
Definition sets.h:1102
std::string toString(bool enter) const override
Converts to string representation.
Definition sets.h:1140
bool remove(const TYPE &e) override
Removes element.
Definition sets.h:1107
bool contains(const TYPE &e) const override
Checks if element exists.
Definition sets.h:1097
hashSet & operator=(const hashSet &other)
Copy assignment operator.
Definition sets.h:1053
Iterator * ends() const override
Gets end iterator.
Definition sets.h:1124
Iterator * begins() const override
Gets begin iterator.
Definition sets.h:1113
void next() const
Advances to the next element.
Definition hashTable.h:634
couple< const K_TYPE, V_TYPE > & get()
Gets current key-value pair (non-const)
Definition hashTable.h:668
Iterator & operator=(const Iterator &other)
Copy assignment operator.
Definition hashTable.h:615
static u_integer findPrevValidBucket(vector< hashNode *, rebind_alloc_pointer > *buckets, u_integer bucket)
Finds the previous non-empty bucket.
Definition hashTable.h:590
void operator+=(integer steps) const
Advances iterator by steps positions.
Definition hashTable.h:656
bool isValid() const
Checks if iterator points to valid element.
Definition hashTable.h:687
bool hasNext() const
Checks if more elements are available.
Definition hashTable.h:625
static u_integer findNextValidBucket(vector< hashNode *, rebind_alloc_pointer > *buckets, u_integer bucket)
Finds the next non-empty bucket.
Definition hashTable.h:579
Internal node type for hash table storage.
Definition hashTable.h:71
Hash table implementation with separate chaining.
Definition hashTable.h:55
typename ALLOC::template rebind_alloc< hashNode * > rebind_alloc_pointer
Rebound allocator type for pointer storage.
Definition hashTable.h:174
Comparator for increasing comparison (less than).
Definition comparator.h:63
A base class for iterable containers that support multiple iteration patterns.
Definition iterable.h:59
iterAdaptor first()
Definition iterable.h:561
iterAdaptor end()
Definition iterable.h:542
iterAdaptor begin()
Definition iterable.h:537
Base iterator interface that supports common operations for iteration.
Definition iterator.h:37
virtual bool atNext(const iterator *other) const =0
Checks if this iterator is positioned at the next element.
virtual bool atPrev(const iterator *other) const =0
Checks if this iterator is positioned at the previous element.
Unique ownership smart pointer with move semantics.
Definition ownerPtr.h:30
Base class providing polymorphic string conversion capabilities.
Definition printable.h:29
static std::string formatString(const TYPE &t)
Universal value-to-string conversion.
Abstract base class for unique element containers.
Definition set.h:44
Skip List container implementation.
Definition skipList.h:45
Bidirectional iterator for treeSet.
Definition sets.h:391
bool isValid() const override
Checks if iterator is valid.
Definition sets.h:1300
void next() const override
Moves to next element.
Definition sets.h:1261
bool atPrev(const iterator< const TYPE > *other) const override
Checks if other is previous to this.
Definition sets.h:1239
void operator-=(integer steps) const override
Rewinds iterator by steps.
Definition sets.h:1214
const TYPE & get() override
Gets current element (non-const)
Definition sets.h:1282
void set(const TYPE &data) override
Not supported.
Definition sets.h:1294
std::string className() const override
Gets iterator class name.
Definition sets.h:1202
bool atNext(const iterator< const TYPE > *other) const override
Checks if other is next to this.
Definition sets.h:1255
void operator+=(integer steps) const override
Advances iterator by steps.
Definition sets.h:1208
Iterator & operator=(const Iterator &other)
Copy assignment operator.
Definition sets.h:1183
void prev() const override
Moves to previous element.
Definition sets.h:1267
bool hasNext() const override
Checks if more elements exist in forward direction.
Definition sets.h:1227
integer operator-(const iterator< const TYPE > &other) const override
Not supported (throws unSupportedMethodError)
Definition sets.h:1221
bool hasPrev() const override
Checks if more elements exist in backward direction.
Definition sets.h:1233
Iterator * getPrev() const override
Gets previous iterator.
Definition sets.h:1274
Iterator * clone() const override
Creates a copy of this iterator.
Definition sets.h:1196
Red-Black Tree based implementation of the set interface.
Definition sets.h:367
bool contains(const TYPE &e) const override
Checks if element exists.
Definition sets.h:1364
bool remove(const TYPE &e) override
Removes element.
Definition sets.h:1374
treeSet(Compare comp=Compare{}, ALLOC alloc=ALLOC{})
Constructs empty treeSet.
Definition sets.h:1306
treeSet & operator=(const treeSet &other)
Copy assignment operator.
Definition sets.h:1317
Iterator * ends() const override
Gets end iterator.
Definition sets.h:1387
~treeSet() override
Destructor.
std::string className() const override
Gets class name.
Definition sets.h:1393
Iterator * begins() const override
Gets begin iterator.
Definition sets.h:1380
bool add(const TYPE &e) override
Adds new element.
Definition sets.h:1369
u_integer size() const override
Gets number of elements.
Definition sets.h:1359
std::string toString(bool enter) const override
Converts to string representation.
Definition sets.h:1398
Exception for unimplemented method calls.
Definition error.h:123
Dynamic array container with amortized constant time operations.
Definition vector.h:43
Comparator base class and concrete comparator classes.
Combines Comparable and CallbackOf for comparison callbacks.
Definition types.h:92
Generic pair container implementation.
Provides a generic hashing utility and a base interface for hashable types.
Implementation of hashTable container.
Main namespace for the project Original.
Definition algorithms.h:21
std::uint32_t u_integer
32-bit unsigned integer type for sizes and indexes
Definition config.h:43
std::int64_t integer
64-bit signed integer type for arithmetic operations
Definition config.h:35
Exclusive-ownership smart pointer implementation.
Abstract base class for set container implementations.
Skip List container implementation.