-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSquadratic.h
81 lines (76 loc) · 2.92 KB
/
Squadratic.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef SQUADRATIC_H
#define SQUADRATIC_H
#include "MicroOrganism.h"
#include "Tissue.h"
class Squadratic : public MicroOrganism {
private: float edge_length;
vector<Squadratic*> children;
Squadratic(int id, vector<Wall*> edges, float length, Cell* cell_id) :MicroOrganism(id,edges) {edge_length= length;
attached_cell=cell_id;//kid sticks to the same cell
located=true;
}
public: // Do NOT make any modifications below!
/*********************************************************************
* Constructor
*
* The first @param is the id of the cell
* The second @param is the edge length in the boundary
*/
Squadratic(int, float);
/*********************************************************************
* Copy Constructor
*
* Deep copy
*/
Squadratic(const Squadratic&);
/*********************************************************************
* Destructor
*
*/
~Squadratic();
/*********************************************************************
* ConnectToCell
*
* See the base class explanation.
*/
void ConnectToCell(Cell* const);
/*********************************************************************
* DoesFitInto
*
* See the base class explanation.
*/
bool DoesFitInto(const Cell&) const;
/*********************************************************************
* React
*
* This type of microorganism proceeds into meiosis division as follows:
The current squadratic microorganism becomes a parent of 4 children
such that each child is a new squadratic microorganism whose edge
length is half of the parent organism's edge length.
* Id of the child microorganisms does not matter. Give anything you
want different than the previous microorganism ids.
* Each child squadratic positions into a different corner of the cell
such that one of their top left, bottom left, top right and bottom
right corners match with one of the corresponding corner of the cell.
* React() method can also be called for child microorganisms.
*/
void React();
/*********************************************************************
* GetChild
*
* Special to this type of microorganism
* @return the child microorganism which is located between the minimum
and maximum x and y coordinates given in the @param.
* The first @param is the minimum x border.
* The second @param is the maximum x border.
* The third @param is the minimum y border.
* The fourth @param is the maximum y border.
* This method either directly returns the child whose border coordinates
exactly equal to the parameters, or throws NotBornChildException in
case that the asked child was created yet (the microorganism may
have not been divided upto that level.)
*/
Squadratic& GetChild(float, float, float, float) const;
/*********************************************************************/
};
#endif