-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIndivid.java
More file actions
135 lines (126 loc) · 3.03 KB
/
Individ.java
File metadata and controls
135 lines (126 loc) · 3.03 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
package com.company;
/**
* Created by ben on 2017-09-26.
*/
public class Individ
{
String name;
Boolean infect;
Boolean islive;
Boolean immun;
int min;
int max;
pos position;
int nb_days_sickness;
int newly;
Individ(String n, int x,int y)
{
this.name = n;
this.infect = false;
this.islive = true;
this.immun = false;
//this.lifetime = new int [2];
//lifetime[0] = 5;
this.min = 3;
//lifetime[1] = 10;
this.max = 5;
this.position = new pos(x,y);
//numbers of days elapsed since the individ were infected
this.nb_days_sickness = 0;
newly = -1;
}
Individ(String n, int x,int y, boolean inf)
{
this.name = n;
this.infect = inf;
this.islive = true;
this.immun = false;
//this.lifetime = new int [2];
//lifetime[0] = 5;
//lifetime[1] = 10;
this.min = 3;
//lifetime[1] = 10;
this.max = 5;
this.position = new pos(x,y);
//numbers of days elapsed since the individ were infected
//make sure to make to 2 so that people newly infected with
// value 1 cannot infect theirs neighbours until their values
// increment to 2 or more in the next days of infection
this.nb_days_sickness = 1;
this.newly = 0;
}
public void setNewly(int k)
{
this.newly = k;
}
public int getNewly()
{
return this.newly;
}
Individ()
{
this.infect = false;
this.islive = true;
this.immun = false;
this.min = 5;
//lifetime[1] = 10;
this.max = 10;
}
public void setInfect(Boolean f)
{
this.infect = f;
this.nb_days_sickness++;
this.newly = 1;
}
public void setInfectImmun(Boolean f)
{
this.infect = f;
}
public void setIslive(Boolean l)
{
this.islive = l;
}
public void setLifetime(int m, int mx)
{
this.min = m;
//lifetime[1] = 10;
this.max = mx;
}
public int getMax()
{
return this.max;
}
public int getMin()
{
return this.min;
}
public void setImmun(Boolean i)
{
this.immun = i;
}
public boolean isLive()
{
return islive;
}
public boolean isInfect()
{
return infect;
}
public boolean isImmun()
{
return immun;
}
public void days_infection()
{
this.nb_days_sickness++;
}
public void setInfect_days(int f)
{
this.nb_days_sickness = f;
}
public String toString()
{
//return "[ Id = " + name + " , infect = " + infect + " , days_of_sick = " + nb_days_sickness + " ] ";
return "[" + " inf = " + infect + " , sick_d = " + nb_days_sickness + ", im = " + this.immun + ", isliv " + isLive() + " ] ";
}
}