-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIndivid.java
More file actions
95 lines (87 loc) · 2.04 KB
/
Individ.java
File metadata and controls
95 lines (87 loc) · 2.04 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
package com.company;
/**
* Created by ben on 2017-09-26.
*/
public class Individ
{
String name;
Boolean infect;
Boolean islive;
Boolean immun;
int [] lifetime;
pos position;
int nb_days_sickness = 0;
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;
lifetime[1] = 10;
this.position = new pos(x,y);
//numbers of days elapsed since the individ were infected
this.nb_days_sickness = 0;
}
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.position = new pos(x,y);
//numbers of days elapsed since the individ were infected
this.nb_days_sickness = 1;
}
Individ()
{
this.infect = false;
this.islive = true;
this.immun = false;
this.lifetime = new int [2];
lifetime[0] = 5;
lifetime[1] = 10;
}
public void setInfect(Boolean f)
{
this.infect = f;
this.nb_days_sickness++;
}
public void setIslive(Boolean l)
{
this.islive = l;
}
public void setLifetime(int min, int max)
{
this.lifetime[0] = min;
this.lifetime[1] = max;
}
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 String toString()
{
return "[ Id = " + name + " , infect = " + infect + " , pos = " + position + " ] ";
}
}