81 template <
typename K_TYPE,
83 typename HASH = hash<K_TYPE>,
84 typename ALLOC = allocator<couple<const K_TYPE, V_TYPE>>>
86 :
public hashTable<K_TYPE, V_TYPE, ALLOC, HASH>,
87 public map<K_TYPE, V_TYPE, ALLOC>,
88 public iterable<couple<const K_TYPE, V_TYPE>>,
128 u_integer bucket = 0, hashNode* node =
nullptr);
163 [[nodiscard]] std::string
className()
const override;
188 [[nodiscard]]
bool hasNext()
const override;
194 [[nodiscard]]
bool hasPrev()
const override;
213 void next()
const override;
219 void prev()
const override;
249 [[nodiscard]]
bool isValid()
const override;
259 explicit hashMap(HASH
hash = HASH{}, ALLOC alloc = ALLOC{});
267 hashMap(
const hashMap& other);
276 hashMap&
operator=(
const hashMap& other);
284 hashMap(hashMap&& other)
noexcept;
294 hashMap&
operator=(hashMap&& other)
noexcept;
307 bool contains(
const couple<const K_TYPE, V_TYPE> &e)
const override;
315 bool add(
const K_TYPE &k,
const V_TYPE &v)
override;
322 bool remove(
const K_TYPE &k)
override;
329 [[nodiscard]]
bool containsKey(
const K_TYPE &k)
const override;
337 V_TYPE
get(
const K_TYPE &k)
const override;
345 bool update(
const K_TYPE &key,
const V_TYPE &value)
override;
353 const V_TYPE &
operator[](
const K_TYPE &k)
const override;
361 V_TYPE &
operator[](
const K_TYPE &k)
override;
367 Iterator*
begins()
const override;
373 Iterator*
ends()
const override;
379 [[nodiscard]] std::string
className()
const override;
386 [[nodiscard]] std::string
toString(
bool enter)
const override;
417 template <
typename K_TYPE,
419 typename Compare = increaseComparator<K_TYPE>,
420 typename ALLOC = allocator<couple<const K_TYPE, V_TYPE>>>
422 public map<K_TYPE, V_TYPE, ALLOC>,
423 public iterable<couple<const K_TYPE, V_TYPE>>,
495 [[nodiscard]] std::string
className()
const override;
518 [[nodiscard]]
bool hasNext()
const override;
524 [[nodiscard]]
bool hasPrev()
const override;
543 void next()
const override;
548 void prev()
const override;
578 [[nodiscard]]
bool isValid()
const override;
598 treeMap(
const treeMap& other);
607 treeMap&
operator=(
const treeMap& other);
615 treeMap(treeMap&& other)
noexcept;
625 treeMap&
operator=(treeMap&& other)
noexcept;
638 bool contains(
const couple<const K_TYPE, V_TYPE> &e)
const override;
646 bool add(
const K_TYPE &k,
const V_TYPE &v)
override;
653 bool remove(
const K_TYPE &k)
override;
660 [[nodiscard]]
bool containsKey(
const K_TYPE &k)
const override;
668 V_TYPE
get(
const K_TYPE &k)
const override;
676 bool update(
const K_TYPE &key,
const V_TYPE &value)
override;
684 const V_TYPE &
operator[](
const K_TYPE &k)
const override;
692 V_TYPE &
operator[](
const K_TYPE &k)
override;
698 Iterator*
begins()
const override;
704 Iterator*
ends()
const override;
710 [[nodiscard]] std::string
className()
const override;
717 [[nodiscard]] std::string
toString(
bool enter)
const override;
751 template <
typename K_TYPE,
755 class JMap final :
public skipList<const K_TYPE, V_TYPE, ALLOC, Compare>,
756 public map<K_TYPE, V_TYPE, ALLOC>,
757 public iterable<couple<const K_TYPE, V_TYPE>>,
801 explicit Iterator(skipListNode* cur);
826 [[nodiscard]] std::string
className()
const override;
851 [[nodiscard]]
bool hasNext()
const override;
856 [[nodiscard]]
bool hasPrev()
const override;
875 void next()
const override;
880 void prev()
const override;
908 [[nodiscard]]
bool isValid()
const override;
928 JMap(
const JMap& other);
945 JMap(JMap&& other)
noexcept;
968 bool contains(
const couple<const K_TYPE, V_TYPE> &e)
const override;
976 bool add(
const K_TYPE &k,
const V_TYPE &v)
override;
983 bool remove(
const K_TYPE &k)
override;
990 [[nodiscard]]
bool containsKey(
const K_TYPE &k)
const override;
998 V_TYPE
get(
const K_TYPE &k)
const override;
1006 bool update(
const K_TYPE &key,
const V_TYPE &value)
override;
1014 const V_TYPE &
operator[](
const K_TYPE &k)
const override;
1022 V_TYPE &
operator[](
const K_TYPE &k)
override;
1028 Iterator*
begins()
const override;
1034 Iterator*
ends()
const override;
1040 [[nodiscard]] std::string
className()
const override;
1047 [[nodiscard]] std::string
toString(
bool enter)
const override;
1057template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1059 vector<hashNode *, rebind_alloc_pointer> *buckets, u_integer bucket, hashNode *node)
1060 : hashTable<K_TYPE, V_TYPE, ALLOC, HASH>::Iterator(
1061 const_cast<vector<hashNode*, rebind_alloc_pointer>*>(buckets), bucket, node) {}
1063template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1065 const iterator<couple<const K_TYPE, V_TYPE>>* other)
const {
1066 auto other_it =
dynamic_cast<const Iterator*
>(other);
1068 this->p_buckets == other_it->p_buckets &&
1069 this->cur_bucket == other_it->cur_bucket &&
1070 this->p_node == other_it->p_node;
1073template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1078template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1088template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1094template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1096 return "hashMap::Iterator";
1099template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1104template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1109template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1115template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1120template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1125template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1128 auto other_it =
dynamic_cast<const Iterator*
>(other);
1132 auto next =
ownerPtr(this->clone());
1133 if (!next->isValid()){
1138 return next->equalPtr(other_it);
1141template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1144 return other->atPrev(*
this);
1147template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1152template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1157template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1163template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1169template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1175template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1180template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1185template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1188 map<K_TYPE, V_TYPE, ALLOC>(std::move(alloc)) {}
1190template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1195template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1198 if (
this == &other) {
1202 this->buckets = this->bucketsCopy(other.buckets);
1203 this->size_ = other.size_;
1204 this->hash_ = other.hash_;
1205 if constexpr(ALLOC::propagate_on_container_copy_assignment::value) {
1207 this->rebind_alloc = other.rebind_alloc;
1212template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1214 this->operator=(std::move(other));
1217template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1220 if (
this == &other) {
1224 this->buckets = std::move(other.buckets);
1225 this->size_ = other.size_;
1227 this->hash_ = std::move(other.hash_);
1228 if constexpr(ALLOC::propagate_on_container_move_assignment::value) {
1229 this->
allocator = std::move(other.allocator);
1230 this->rebind_alloc = std::move(other.rebind_alloc);
1235template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1241template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1247template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1249 return this->insert(k, v);
1252template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1254 return this->erase(k);
1257template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1259 return this->find(k);
1262template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1264 auto node = this->find(k);
1267 return node->getValue();
1270template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1272 return this->modify(key, value);
1275template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1277 auto node = this->find(k);
1280 return node->getValue();
1283template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1285 auto node = this->find(k);
1287 this->insert(k, V_TYPE{});
1288 node = this->find(k);
1290 return node->getValue();
1293template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1297 if (this->buckets[0]) {
1298 return new Iterator(p_buckets, 0, this->buckets[0]);
1300 auto bucket = Iterator::findNextValidBucket(p_buckets, 0);
1301 return new Iterator(p_buckets, bucket, p_buckets->get(bucket));
1304template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1308 auto bucket = Iterator::findPrevValidBucket(p_buckets, this->buckets.size());
1309 auto node = this->buckets[bucket];
1310 while (node && node->getPNext()) {
1311 node = node->getPNext();
1313 return new Iterator(p_buckets, bucket, node);
1316template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1321template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1323 std::stringstream ss;
1324 ss << this->className();
1327 for (
auto it = this->begin(); it != this->end(); it.next()){
1341template<
typename K_TYPE,
typename V_TYPE,
typename HASH,
typename ALLOC>
1344template <
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1346 : RBTreeType::Iterator(tree, cur) {}
1348template <
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1351 const iterator<couple<const K_TYPE, V_TYPE>>* other)
const
1353 auto other_it =
dynamic_cast<const Iterator*
>(other);
1355 this->tree_ == other_it->tree_ &&
1356 this->cur_ == other_it->cur_;
1359template <
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1365template <
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1369 if (
this == &other) {
1373 this->tree_ = other.
tree_;
1374 this->cur_ = other.
cur_;
1378template <
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1385template <
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1388 return "treeMap::Iterator";
1391template <
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1394 RBTreeType::Iterator::operator+=(steps);
1397template <
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1400 RBTreeType::Iterator::operator-=(steps);
1403template <
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1411template <
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1414 return RBTreeType::Iterator::hasNext();
1417template <
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1420 return RBTreeType::Iterator::hasPrev();
1423template <
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1427 auto other_it =
dynamic_cast<const Iterator*
>(other);
1431 auto next =
ownerPtr(this->clone());
1432 if (!next->isValid()){
1437 return next->equalPtr(other_it);
1440template <
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1444 return other->atNext(*
this);
1447template <
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1450 RBTreeType::Iterator::next();
1453template <
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1456 RBTreeType::Iterator::prev();
1459template <
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1463 auto it = this->clone();
1468template <
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1471 return RBTreeType::Iterator::get();
1474template <
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1477 return RBTreeType::Iterator::get();
1480template <
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1486template <
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1489 return RBTreeType::Iterator::isValid();
1492template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1495 map<K_TYPE, V_TYPE, ALLOC>(std::move(alloc)) {}
1497template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1502template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1505 if (
this == &other){
1509 this->destroyTree();
1510 this->root_ = other.treeCopy();
1511 this->size_ = other.size_;
1512 this->compare_ = other.compare_;
1513 if constexpr(ALLOC::propagate_on_container_copy_assignment::value) {
1515 this->rebind_alloc = other.rebind_alloc;
1520template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1522 this->operator=(std::move(other));
1525template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1528 if (
this == &other){
1532 this->destroyTree();
1533 this->root_ = other.root_;
1534 other.root_ =
nullptr;
1535 this->size_ = other.size_;
1537 this->compare_ = std::move(other.compare_);
1538 if constexpr(ALLOC::propagate_on_container_move_assignment::value) {
1539 this->
allocator = std::move(other.allocator);
1540 this->rebind_alloc = std::move(other.rebind_alloc);
1545template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1550template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1556template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1558 return this->insert(k, v);
1561template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1563 return this->erase(k);
1566template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1568 return this->find(k);
1571template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1573 auto node = this->find(k);
1576 return node->getValue();
1579template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1581 return this->modify(key, value);
1584template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1586 auto node = this->find(k);
1589 return node->getValue();
1592template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1594 auto node = this->find(k);
1596 this->insert(k, V_TYPE{});
1597 node = this->find(k);
1599 return node->getValue();
1602template <
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1609template <
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1616template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1621template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1623 std::stringstream ss;
1624 ss << this->className();
1627 for (
auto it = this->begin(); it != this->end(); it.next()){
1641template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1644template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1647 auto other_it =
dynamic_cast<const Iterator*
>(other);
1648 return other_it && this->cur_ == other_it->cur_;
1651template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1655template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1659template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1662 skipListType::Iterator::operator=(other);
1666template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1672template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1675 return "JMap::Iterator";
1678template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1680 skipListType::Iterator::operator+=(steps);
1683template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1688template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1692 auto other_it =
dynamic_cast<const Iterator*
>(&other);
1693 if (other_it ==
nullptr)
1694 return this > &other ?
1695 std::numeric_limits<integer>::max() :
1696 std::numeric_limits<integer>::min();
1697 return skipListType::Iterator::operator-(*other_it);
1700template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1702 return skipListType::Iterator::hasNext();
1705template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1710template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1713 const auto other_it =
dynamic_cast<const Iterator*
>(other);
1717 auto cloned_it =
ownerPtr(other_it->clone());
1718 return this->equalPtr(cloned_it.get());
1721template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1724 return other->atPrev(*
this);
1727template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1729 skipListType::Iterator::next();
1732template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1737template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1743template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1745 return skipListType::Iterator::get();
1748template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1750 return skipListType::Iterator::get();
1753template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1758template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1760 return skipListType::Iterator::isValid();
1763template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1766 map<K_TYPE, V_TYPE, ALLOC>(std::move(alloc)) {}
1768template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1773template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1776 if (
this == &other){
1780 this->listDestroy();
1781 this->head_ = other.listCopy();
1782 this->size_ = other.size_;
1783 this->compare_ = other.compare_;
1784 if constexpr(ALLOC::propagate_on_container_copy_assignment::value) {
1786 this->rebind_alloc = other.rebind_alloc;
1791template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1793 this->operator=(std::move(other));
1796template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1799 if (
this == &other){
1803 this->listDestroy();
1804 this->head_ = other.head_;
1805 other.head_ = other.createNode();
1806 this->size_ = other.size_;
1808 this->compare_ = std::move(other.compare_);
1809 if constexpr(ALLOC::propagate_on_container_move_assignment::value) {
1810 this->
allocator = std::move(other.allocator);
1811 this->rebind_alloc = std::move(other.rebind_alloc);
1816template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1821template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1826template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1828 return this->insert(k, v);
1831template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1833 return this->erase(k);
1836template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1838 return this->find(k);
1841template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1843 auto node = this->find(k);
1846 return node->getValue();
1849template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1851 return this->modify(key, value);
1854template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1856 auto node = this->find(k);
1859 return node->getValue();
1862template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1864 auto node = this->find(k);
1866 this->insert(k, V_TYPE{});
1867 node = this->find(k);
1869 return node->getValue();
1872template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1875 return new Iterator(this->head_->getPNext(1));
1878template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1881 return new Iterator(this->findLastNode());
1884template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1889template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
1891 std::stringstream ss;
1892 ss << this->className();
1895 for (
auto it = this->begin(); it != this->end(); it.next()){
1909template<
typename K_TYPE,
typename V_TYPE,
typename Compare,
typename ALLOC>
Red-Black Tree implementation header.
Memory allocation interface and implementations.
Forward iterator for JMap.
Definition maps.h:783
Iterator & operator=(const Iterator &other)
Copy assignment operator.
Definition maps.h:1661
bool atNext(const iterator< couple< const K_TYPE, V_TYPE > > *other) const override
Checks if other is next to this.
Definition maps.h:1722
Iterator * getPrev() const override
Not supported (throws unSupportedMethodError)
Definition maps.h:1739
bool hasPrev() const override
Not supported (throws unSupportedMethodError)
Definition maps.h:1706
Iterator(skipListNode *cur)
Constructs iterator pointing to specific skip list node.
Definition maps.h:1652
std::string className() const override
Gets iterator class name.
Definition maps.h:1674
void prev() const override
Not supported (throws unSupportedMethodError)
Definition maps.h:1733
void operator+=(integer steps) const override
Advances iterator by steps.
Definition maps.h:1679
void operator-=(integer steps) const override
Not supported (throws unSupportedMethodError)
Definition maps.h:1684
void next() const override
Moves to next element.
Definition maps.h:1728
bool isValid() const override
Checks if iterator is valid.
Definition maps.h:1759
void set(const couple< const K_TYPE, V_TYPE > &data) override
Not supported (throws unSupportedMethodError)
Definition maps.h:1754
couple< const K_TYPE, V_TYPE > & get() override
Gets current element (non-const)
Definition maps.h:1744
bool hasNext() const override
Checks if more elements exist in forward direction.
Definition maps.h:1701
bool atPrev(const iterator< couple< const K_TYPE, V_TYPE > > *other) const override
Checks if other is previous to this.
Definition maps.h:1711
Iterator * clone() const override
Creates a copy of this iterator.
Definition maps.h:1668
Skip List based implementation of the map interface.
Definition maps.h:758
bool update(const K_TYPE &key, const V_TYPE &value) override
Updates value for existing key.
Definition maps.h:1850
std::string toString(bool enter) const override
Converts to string representation.
Definition maps.h:1890
Iterator * ends() const override
Gets end iterator.
Definition maps.h:1880
const V_TYPE & operator[](const K_TYPE &k) const override
Const element access.
Definition maps.h:1855
bool remove(const K_TYPE &k) override
Removes key-value pair.
Definition maps.h:1832
bool containsKey(const K_TYPE &k) const override
Checks if key exists.
Definition maps.h:1837
bool contains(const couple< const K_TYPE, V_TYPE > &e) const override
Checks if key-value pair exists.
Definition maps.h:1822
~JMap() override
Destructor.
u_integer size() const override
Gets number of elements.
Definition maps.h:1817
std::string className() const override
Gets class name.
Definition maps.h:1885
bool add(const K_TYPE &k, const V_TYPE &v) override
Adds new key-value pair.
Definition maps.h:1827
Iterator * begins() const override
Gets begin iterator.
Definition maps.h:1874
V_TYPE get(const K_TYPE &k) const override
Gets value for key.
Definition maps.h:1842
JMap & operator=(const JMap &other)
Copy assignment operator.
Definition maps.h:1775
JMap(Compare comp=Compare{}, ALLOC alloc=ALLOC{})
Constructs empty JMap.
Definition maps.h:1764
Bidirectional iterator for RBTree.
Definition RBTree.h:219
RBNode * cur_
Current node.
Definition RBTree.h:222
RBTree * tree_
Owning tree.
Definition RBTree.h:221
Internal node class for Red-Black Tree.
Definition RBTree.h:51
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
Container for two heterogeneous elements.
Definition couple.h:37
F_TYPE & first()
Access first element.
Definition couple.h:329
S_TYPE & second()
Access second element.
Definition couple.h:335
Bidirectional iterator for hashMap.
Definition maps.h:118
void next() const override
Moves to next element.
Definition maps.h:1148
bool atNext(const iterator< couple< const K_TYPE, V_TYPE > > *other) const override
Checks if other is next to this.
Definition maps.h:1142
Iterator * getPrev() const override
Not supported.
Definition maps.h:1159
Iterator & operator=(const Iterator &other)
Copy assignment operator.
Definition maps.h:1080
bool hasNext() const override
Checks if more elements exist.
Definition maps.h:1116
bool atPrev(const iterator< couple< const K_TYPE, V_TYPE > > *other) const override
Checks if other is previous to this.
Definition maps.h:1126
std::string className() const override
Gets iterator class name.
Definition maps.h:1095
void prev() const override
Not supported.
Definition maps.h:1153
void operator+=(integer steps) const override
Advances iterator by steps.
Definition maps.h:1100
void operator-=(integer steps) const override
Not supported.
Definition maps.h:1105
bool isValid() const override
Checks if iterator is valid.
Definition maps.h:1181
void set(const couple< const K_TYPE, V_TYPE > &data) override
Not supported.
Definition maps.h:1176
Iterator * clone() const override
Creates a copy of this iterator.
Definition maps.h:1090
couple< const K_TYPE, V_TYPE > & get() override
Gets current element (non-const)
Definition maps.h:1165
bool hasPrev() const override
Not supported.
Definition maps.h:1121
Hash table based implementation of the map interface.
Definition maps.h:89
hashMap(HASH hash=HASH{}, ALLOC alloc=ALLOC{})
Constructs empty hashMap.
Definition maps.h:1186
u_integer size() const override
Gets number of elements.
Definition maps.h:1237
bool add(const K_TYPE &k, const V_TYPE &v) override
Adds new key-value pair.
Definition maps.h:1248
bool remove(const K_TYPE &k) override
Removes key-value pair.
Definition maps.h:1253
Iterator * ends() const override
Gets end iterator.
Definition maps.h:1306
bool contains(const couple< const K_TYPE, V_TYPE > &e) const override
Checks if key-value pair exists.
Definition maps.h:1243
bool containsKey(const K_TYPE &k) const override
Checks if key exists.
Definition maps.h:1258
std::string className() const override
Gets class name.
Definition maps.h:1317
const V_TYPE & operator[](const K_TYPE &k) const override
Const element access.
Definition maps.h:1276
bool update(const K_TYPE &key, const V_TYPE &value) override
Updates value for existing key.
Definition maps.h:1271
Iterator * begins() const override
Gets begin iterator.
Definition maps.h:1295
std::string toString(bool enter) const override
Converts to string representation.
Definition maps.h:1322
hashMap & operator=(const hashMap &other)
Copy assignment operator.
Definition maps.h:1197
V_TYPE get(const K_TYPE &k) const override
Gets value for key.
Definition maps.h:1263
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
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
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
Generic hash function object supporting multiple types.
Definition hash.h:62
Comparator for increasing comparison (less than).
Definition comparator.h:64
A base class for iterable containers that support multiple iteration patterns.
Definition iterable.h:59
Base iterator interface that supports common operations for iteration.
Definition iterator.h:37
friend iterator< T > * operator-(const iterator< T > &it, integer steps)
Subtracts a number of steps from the iterator's current position and returns a new iterator.
Abstract base class for key-value mapping containers.
Definition map.h:49
Exception for missing element requests.
Definition error.h:213
Unique ownership smart pointer with move semantics.
Definition ownerPtr.h:37
Base class providing polymorphic string conversion capabilities.
Definition printable.h:39
static std::string formatString(const TYPE &t)
Universal value-to-string conversion.
Definition printable.h:263
Abstract base class for unique element containers.
Definition set.h:44
Forward iterator for skipList.
Definition skipList.h:164
Internal node class for Skip List.
Definition skipList.h:54
Skip List container implementation.
Definition skipList.h:45
Bidirectional iterator for treeMap.
Definition maps.h:453
couple< const K_TYPE, V_TYPE > & get() override
Gets current element (non-const)
Definition maps.h:1469
bool hasNext() const override
Checks if more elements exist in forward direction.
Definition maps.h:1412
void next() const override
Moves to next element.
Definition maps.h:1448
bool atNext(const iterator< couple< const K_TYPE, V_TYPE > > *other) const override
Checks if other is next to this.
Definition maps.h:1441
bool atPrev(const iterator< couple< const K_TYPE, V_TYPE > > *other) const override
Checks if other is previous to this.
Definition maps.h:1424
void operator-=(integer steps) const override
Rewinds iterator by steps.
Definition maps.h:1398
Iterator * getPrev() const override
Gets previous iterator.
Definition maps.h:1461
std::string className() const override
Gets iterator class name.
Definition maps.h:1386
Iterator * clone() const override
Creates a copy of this iterator.
Definition maps.h:1380
bool isValid() const override
Checks if iterator is valid.
Definition maps.h:1487
void prev() const override
Moves to previous element.
Definition maps.h:1454
Iterator & operator=(const Iterator &other)
Copy assignment operator.
Definition maps.h:1367
void operator+=(integer steps) const override
Advances iterator by steps.
Definition maps.h:1392
bool hasPrev() const override
Checks if more elements exist in backward direction.
Definition maps.h:1418
void set(const couple< const K_TYPE, V_TYPE > &data) override
Not supported.
Definition maps.h:1481
Red-Black Tree based implementation of the map interface.
Definition maps.h:424
Iterator * begins() const override
Gets begin iterator.
Definition maps.h:1604
treeMap & operator=(const treeMap &other)
Copy assignment operator.
Definition maps.h:1504
std::string className() const override
Gets class name.
Definition maps.h:1617
Iterator * ends() const override
Gets end iterator.
Definition maps.h:1611
bool containsKey(const K_TYPE &k) const override
Checks if key exists.
Definition maps.h:1567
V_TYPE get(const K_TYPE &k) const override
Gets value for key.
Definition maps.h:1572
~treeMap() override
Destructor.
std::string toString(bool enter) const override
Converts to string representation.
Definition maps.h:1622
bool contains(const couple< const K_TYPE, V_TYPE > &e) const override
Checks if key-value pair exists.
Definition maps.h:1552
bool remove(const K_TYPE &k) override
Removes key-value pair.
Definition maps.h:1562
bool add(const K_TYPE &k, const V_TYPE &v) override
Adds new key-value pair.
Definition maps.h:1557
const V_TYPE & operator[](const K_TYPE &k) const override
Const element access.
Definition maps.h:1585
bool update(const K_TYPE &key, const V_TYPE &value) override
Updates value for existing key.
Definition maps.h:1580
treeMap(Compare comp=Compare{}, ALLOC alloc=ALLOC{})
Constructs empty treeMap.
Definition maps.h:1493
u_integer size() const override
Gets number of elements.
Definition maps.h:1546
Exception for unimplemented method calls.
Definition error.h:192
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:298
Generic pair container implementation.
std::uint32_t u_integer
32-bit unsigned integer type for sizes and indexes
Definition config.h:263
std::int64_t integer
64-bit signed integer type for arithmetic operations
Definition config.h:254
Implementation of hashTable container.
Provides a generic hashing utility and interface for hashable types.
Abstract base class for map-like container implementations.
Main namespace for the project Original.
Definition algorithms.h:21
Exclusive-ownership smart pointer implementation.
Skip List container implementation.