-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSimulationParameters.cs
109 lines (93 loc) · 2.82 KB
/
SimulationParameters.cs
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
/*
* Created by SharpDevelop.
* User: oferfrid
* Date: 23/01/2011
* Time: 16:54
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
namespace CyclicSimulation
{
/// <summary>
/// Description of SimulationParameters.
/// </summary>
public struct SimulationParameters : IEquatable<SimulationParameters>
{
public double NfGrow;
public double NfKill;
public double MutationRatio;
public double tauNormalKill;
public double tauPersisterKill;
public double tauGrowNormal;
public double tauGrowResistant;
public double Persistersfraction;
public double Dilution;
public SimulationParameters(
double _NfGrow,
double _NfKill,
double _MutationRatio,
double _tauNormalKill,
double _tauPersisterKill,
double _tauGrowNormal,
double _tauGrowResistant,
double _Persistersfraction,
double _Dilution)
{
NfGrow = _NfGrow;
NfKill=_NfKill;
MutationRatio = _MutationRatio;
tauNormalKill=_tauNormalKill;
tauPersisterKill=_tauPersisterKill;
tauGrowNormal=_tauGrowNormal;
tauGrowResistant= _tauGrowResistant;
Persistersfraction=_Persistersfraction;
Dilution = _Dilution;
}
#region Equals and GetHashCode implementation
// The code in this region is useful if you want to use this structure in collections.
// If you don't need it, you can just remove the region and the ": IEquatable<SimulationParameters>" declaration.
public override bool Equals(object obj)
{
if (obj is SimulationParameters)
return Equals((SimulationParameters)obj); // use Equals method below
else
return false;
}
public bool Equals(SimulationParameters other)
{
// add comparisions for all members here
return this.NfGrow == other.NfGrow &
this.NfKill == other.NfKill &
this.MutationRatio == other.MutationRatio &
this.tauNormalKill == other.tauNormalKill &
this.tauPersisterKill == other.tauPersisterKill &
this.tauGrowNormal == other.tauGrowNormal &
this.tauGrowResistant == other.tauGrowResistant &
this.Persistersfraction == other.Persistersfraction &
this.Dilution ==other.Dilution;
}
public override int GetHashCode()
{
// combine the hash codes of all members here (e.g. with XOR operator ^)
return NfGrow.GetHashCode()^
NfKill.GetHashCode()^
MutationRatio.GetHashCode()^
tauNormalKill.GetHashCode()^
tauPersisterKill.GetHashCode()^
tauGrowNormal.GetHashCode()^
tauGrowResistant.GetHashCode()^
Persistersfraction.GetHashCode()^
Dilution.GetHashCode();
}
public static bool operator ==(SimulationParameters left, SimulationParameters right)
{
return left.Equals(right);
}
public static bool operator !=(SimulationParameters left, SimulationParameters right)
{
return !left.Equals(right);
}
#endregion
}
}