/
Event.cs
41 lines (35 loc) · 1.26 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
/*
* Copyright Lamont Granquist, Sebastien Gaggini and the MechJeb contributors
* SPDX-License-Identifier: LicenseRef-PD-hp OR Unlicense OR CC0-1.0 OR 0BSD OR MIT-0 OR MIT OR LGPL-2.1+
*/
#nullable enable
using System;
using System.Collections.Generic;
namespace MechJebLib.Core.ODE
{
using ConditionFunc = Func<double, IList<double>, AbstractIVP, double>;
using AssertFunc = Action<AbstractIVP>;
public class Event : IComparable<Event>
{
public readonly ConditionFunc F;
public readonly AssertFunc? Assert;
public bool SaveBefore = true;
public bool SaveAfter = true;
public readonly bool Terminal = true;
public readonly int Direction = 0;
public double LastValue;
public double NewValue;
public double Time;
public Event(ConditionFunc f, AssertFunc? assert = null)
{
F = f;
Assert = assert;
}
public int CompareTo(Event other)
{
if (ReferenceEquals(this, other)) return 0;
if (ReferenceEquals(null, other)) return 1;
return Time.CompareTo(other.Time);
}
}
}