Initial commit

This commit is contained in:
user
2026-07-12 14:22:00 +04:00
commit 49ecd4784c
90 changed files with 6910 additions and 0 deletions
@@ -0,0 +1,35 @@
#ifndef CREATOR_ALGHORITHM_LINEAR_PROBING_H
#define CREATOR_ALGHORITHM_LINEAR_PROBING_H
#include "linearProbing.h"
#include "creatorOne.h"
BEGIN_NAMESPACE(BusinessLogic)
BEGIN_NAMESPACE(Hash)
BEGIN_NAMESPACE(Algorithm)
BEGIN_NAMESPACE(LinearProbing)
class Creator : public One::Creator
{
private:
/* A number that is not mutually prime to the size will not apply */
const size_t m_coefficient;
public:
Creator(size_t coefficient = 1) : m_coefficient(coefficient)
{
}
public:
virtual std::unique_ptr<Abstract::Product> create() const override {
return std::unique_ptr<Abstract::Product>(new Product(m_coefficient));
}
};
END_NAMESPACE // LinearProbing
END_NAMESPACE // Algorithm
END_NAMESPACE // Hash
END_NAMESPACE // BusinessLogic
#endif // !CREATOR_ALGHORITHM_LINEAR_PROBING_H
@@ -0,0 +1,24 @@
#ifndef CREATOR_ALGHORITHM_ONE_H
#define CREATOR_ALGHORITHM_ONE_H
#include "../creatorAbstract.h"
BEGIN_NAMESPACE(BusinessLogic)
BEGIN_NAMESPACE(Hash)
BEGIN_NAMESPACE(Algorithm)
BEGIN_NAMESPACE(One)
class Creator : public Abstract::Creator
{
protected:
Creator()
{
}
};
END_NAMESPACE // One
END_NAMESPACE // Algorithm
END_NAMESPACE // Hash
END_NAMESPACE // BusinessLogic
#endif // !CREATOR_ALGHORITHM_ONE_H
@@ -0,0 +1,30 @@
#ifndef CREATOR_ALGHORITHM_QUADRATIC_PROBING_H
#define CREATOR_ALGHORITHM_QUADRATIC_PROBING_H
#include "quadraticProbing.h"
#include "creatorOne.h"
BEGIN_NAMESPACE(BusinessLogic)
BEGIN_NAMESPACE(Hash)
BEGIN_NAMESPACE(Algorithm)
BEGIN_NAMESPACE(QuadraticProbing)
class Creator : public One::Creator
{
public:
Creator()
{
}
public:
virtual std::unique_ptr<Abstract::Product> create() const override {
return std::unique_ptr<Abstract::Product>(new Product());
}
};
END_NAMESPACE // LinearProbing
END_NAMESPACE // Algorithm
END_NAMESPACE // Hash
END_NAMESPACE // BusinessLogic
#endif // !CREATOR_ALGHORITHM_QUADRATIC_PROBING_H
@@ -0,0 +1,41 @@
#ifndef ALGHORITHM_LINEAR_PROBING_H
#define ALGHORITHM_LINEAR_PROBING_H
#include "one.h"
BEGIN_NAMESPACE(BusinessLogic)
BEGIN_NAMESPACE(Hash)
BEGIN_NAMESPACE(Algorithm)
BEGIN_NAMESPACE(LinearProbing)
class Product final : public One::Product
{
private:
/* A number that is not mutually prime to the size will not apply */
const size_t m_coefficient;
private:
friend Creator;
Product(size_t coefficient)
: m_coefficient(coefficient == 0 ? 1 : coefficient)
{
}
protected:
// virtual bool isValidInput() const override {
// return gcd(m_coefficient, size()) == 1;
// }
virtual size_t getFirstCoefficient() override {
return m_hashFunction->getHash(m_convertValue);
}
virtual size_t getSecondCoefficient(size_t counter) override {
return counter * m_coefficient;
}
};
END_NAMESPACE // LinearProbing
END_NAMESPACE // Algorithm
END_NAMESPACE // Hash
END_NAMESPACE // BusinessLogic
#endif // !ALGHORITHM_LINEAR_PROBING_H
@@ -0,0 +1,36 @@
#ifndef ALGHORITHM_ONE_H
#define ALGHORITHM_ONE_H
#include "../../Function/One/one.h"
#include "../abstract.h"
BEGIN_NAMESPACE(BusinessLogic)
BEGIN_NAMESPACE(Hash)
BEGIN_NAMESPACE(Algorithm)
BEGIN_NAMESPACE(One)
class Product : public Abstract::Product
{
public:
using function_type = Function::One::Product;
protected:
const function_type *m_hashFunction;
protected:
Product() : m_hashFunction(nullptr)
{
}
public:
void setHashFunction(const function_type &hashFunction) {
m_hashFunction = &hashFunction;
}
};
END_NAMESPACE // One
END_NAMESPACE // Algorithm
END_NAMESPACE // Hash
END_NAMESPACE // BusinessLogic
#endif // !ALGHORITHM_ONE_H
@@ -0,0 +1,36 @@
#ifndef ALGHORITHM_QUADRATIC_PROBING_H
#define ALGHORITHM_QUADRATIC_PROBING_H
#include "one.h"
BEGIN_NAMESPACE(BusinessLogic)
BEGIN_NAMESPACE(Hash)
BEGIN_NAMESPACE(Algorithm)
BEGIN_NAMESPACE(QuadraticProbing)
class Product final : public One::Product
{
private:
friend Creator;
Product()
{
}
protected:
// virtual bool isValidInput() const override {
// return isPrimeNumber(size());
// }
virtual size_t getFirstCoefficient() override {
return m_hashFunction->getHash(m_convertValue);
}
virtual size_t getSecondCoefficient(size_t counter) override {
return std::pow(size(), counter);
}
};
END_NAMESPACE // LinearProbing
END_NAMESPACE // Algorithm
END_NAMESPACE // Hash
END_NAMESPACE // BusinessLogic
#endif // !ALGHORITHM_QUADRATIC_PROBING_H