-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEntrySet.cs
84 lines (73 loc) · 1.75 KB
/
EntrySet.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Timer
{
// driver and all corresponding entries
public class EntrySet
{
private int rank;
private Driver driver;
private List<Entry> entries = new List<Entry>();
public EntrySet(int rank,Driver driver)
{
this.rank = rank;
this.driver = driver;
}
public Entry Fastest
{
// get fastest entry for this driver
get
{
if (entries.Count() < 1)
return null;
Entry fastest = entries[0];
for (int i = 0; i < entries.Count(); i++)
if (entries[i].Value < fastest.Value)
fastest = entries[i];
return fastest;
}
}
public List<Entry> Entries
{
get { return entries; }
}
public Driver Driver
{
// get driver
get
{
return driver;
}
}
public int Rank
{
get
{
return rank;
}
set
{
rank = value;
}
}
public String FormattedLine
{
// get formatted output for standings box
get
{
return rank + ". " + Fastest.Msec + ": " + driver.Number + ". " + driver.Name;
}
}
public int Count()
{
// return number of entries
return entries.Count();
}
public void Add(Entry entry)
{
entries.Add(entry);
}
}
}