-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTrainMetaData.cs
62 lines (55 loc) · 1.62 KB
/
TrainMetaData.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DBSharp
{
[Flags]
public enum DistanceClass : byte
{
NoneOrUnknown = byte.MinValue,
D = 1,
S = 2,
N = 4,
F = 8,
All = byte.MaxValue
}
/// <summary>
/// Holds information about the Train
/// </summary>
public class TrainMetaData : IMergeable<TrainMetaData>
{
/// <summary>
/// f = D/N/S/F
/// </summary>
public DistanceClass DistanceClass { get; set; } = DistanceClass.NoneOrUnknown;
/// <summary>
/// t = p
/// </summary>
public string TransportClass { get; set; }
/// <summary>
/// c = S/ICE/ABR/...
/// </summary>
public string ModelClass { get; set; }
/// <summary>
/// n = [NUMBER/NAME]
/// </summary>
public string TrainNumber { get; set; }
/// <summary>
/// o = 03/80/R2/...
/// </summary>
public string TrainOwner { get; set; }
public virtual void MergeChanges(TrainMetaData changes)
{
if (changes != null)
{
DistanceClass = (changes.DistanceClass == DistanceClass.NoneOrUnknown ? DistanceClass : changes.DistanceClass);
ModelClass = changes.ModelClass ?? ModelClass;
TrainNumber = changes.TrainNumber ?? TrainNumber;
TransportClass = changes.TransportClass ?? TransportClass;
TrainOwner = changes.TrainOwner ?? TrainOwner;
}
}
}
}