Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ScAction.cs
1using System;
2using System.Collections.Generic;
3using System.Runtime.InteropServices;
5
7{
8 [StructLayout(LayoutKind.Sequential)]
9 public struct ScAction : IEquatable<ScAction>
10 {
11 private ScActionType _Type;
12 private uint _Delay;
13
14 public ScActionType Type
15 {
16 get => _Type;
17 set => _Type = value;
18 }
19
20 public TimeSpan Delay
21 {
22 get => TimeSpan.FromMilliseconds(_Delay);
23 set => _Delay = (uint)Math.Round(value.TotalMilliseconds);
24 }
25
26 public bool Equals(ScAction other)
27 {
28 return _Type == other._Type && _Delay == other._Delay;
29 }
30
31 public override bool Equals(object obj)
32 {
33 if (obj is null)
34 return false;
35
36 return obj is ScAction && Equals((ScAction)obj);
37 }
38
39 public override int GetHashCode()
40 {
41 int h1 = this.Delay.GetHashCode();
42 int h2 = this.Type.GetHashCode();
43
44 return ((h1 << 5) + h1) ^ h2;
45 }
46 }
47}