-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainDataStructure.h
48 lines (39 loc) · 1.71 KB
/
MainDataStructure.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// this is the main system
#ifndef MAINDATASTRCTURE_H
#define MAINDATASTRCTURE_H
#include "Company.h"
#include "Employee.h"
#include "AVLTree.h"
#include "Exceptions.h"
class MainDataStructure
{
private:
AVLTree<Company *> companies_tree;
AVLTree<Company *> companies_with_employees_tree;
AVLTree<Employee *> employees_tree;
AVLTree<Employee *> employees_tree_by_salary;
Employee *highest_earner;
public:
MainDataStructure();
void AddCompany(int companyID, int value);
void RemoveCompany(int companyID, bool force = false);
void AddEmployee(int employeeID, int companyID, int salary, int grade);
void RemoveEmployee(int employeeID);
bool AcquireCompany(int companyId, int aquiredCompanyId, double factor);
int GetHighestEarner(int companyId);
void setHighesEarner(Employee *emp);
int GetAllEmployeesBySalary(int companyId, int **employees); // returns num of employees
void GetHighestEarnerInEachCompany(int numOfCompanies, int **highestEarners);
int GetNumEmployeesMatching(int companyId, int minId, int maxId, int minSalary, int minGrad, int *inRange);
void GetCompanyInfo(int companyId, int *value, int *numOfEmployees);
void GetEmployeeInfo(int employeeID, int *employerID, int *salary, int *grade);
void IncreaseCompanyValue(int companyID, int valueIncrease);
void PromoteEmployee(int EmployeeID, int salaryIncrease, int bumpGrade);
void HireEmployee(int EmployeeID, int newCompanyID);
~MainDataStructure();
private:
void checkInRangeRocourisve(Node<Employee *> *current, int minId, int maxId, int minSalary, int minGrade, int *inRange, int *numOfEmployees);
Company *findCompanyById(int id);
Employee *findEmployeeById(int id);
};
#endif