-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEvent.cs
79 lines (64 loc) · 1.85 KB
/
Event.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CollisionSimulation
{
public class Event
{
/***************************************************************************
* - a and b both null: redraw event
* - a not null, b null: collision with vertical wall
* - a null, b not null: collision with horizontal wall
* - a and b both not null: binary collision between a and b
*
***************************************************************************/
private Particle a, b;
private int countA, countB;
public double time { get; private set; }
public Event(double time, Particle a, Particle b)
{
this.a = a;
this.b = b;
this.time = time;
if (a != null)
{
countA = a.getCount();
}
else
{
countA = -1;
}
if (b != null)
{
countA = b.getCount();
}
else
{
countB = -1;
}
}
//public Event(double time)
//{
// this.time = time;
// this.a = new Particle();
// this.b = new Particle();
//}
public Boolean isValid(double currentTime)
{
if (time < currentTime) return false;
if (a != null && a.getCount() == countA) return true;
if (b != null && b.getCount() == countB) return true;
return false; //lesson put as true??
}
public Particle getParticleA()
{
return a;
}
public Particle getParticleB()
{
return b;
}
}
}