Microscopic Traffic Simulator
SimulationEventGeneratorKey.cs
Go to the documentation of this file.
1 using System;
2 
3 namespace Microscopic_Traffic_Simulator___Model.SimulationControl
4 {
8  internal struct SimulationEventGeneratorKey : IComparable
9  {
13  internal TimeSpan Time;
14 
18  internal int Priority;
19 
25  internal SimulationEventGeneratorKey(TimeSpan time, int priority)
26  {
27  Time = time;
28  Priority = priority;
29  }
30 
37  public int CompareTo(object obj)
38  {
39  if (!(obj is SimulationEventGeneratorKey))
40  {
41  throw new ArgumentException();
42  }
43 
44  SimulationEventGeneratorKey other = (SimulationEventGeneratorKey) obj;
45 
46  int timeCompareResult = Time.CompareTo(other.Time);
47  if (timeCompareResult == 0)
48  {
49  return Priority.CompareTo(other.Priority);
50  }
51  else
52  {
53  return timeCompareResult;
54  }
55  }
56  }
57 }