Files
RobustToolbox/Robust.Shared/Physics/DynamicTree.Proxy.cs
Acruid 2183cd7ca1 Massive Namespace Cleanup (#1544)
* Removed the Interfaces folder.
* All objects inside the GameObjects subfolders are now in the GameObjects namespace.
* Added a Resharper DotSettings file to mark the GameObjects subfolders as not providing namespaces.
* Simplified Robust.client.Graphics namespace.
* Automated remove redundant using statements.
2021-02-10 23:27:19 -08:00

71 lines
2.4 KiB
C#

using System;
using System.Runtime.CompilerServices;
namespace Robust.Shared.Physics
{
public partial class DynamicTree
{
public readonly struct Proxy : IEquatable<Proxy>, IComparable<Proxy>
{
private readonly int _value;
public static Proxy Free
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => new(-1);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Proxy(int v) => _value = v;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(Proxy other)
=> _value == other._value;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int CompareTo(Proxy other)
=> _value.CompareTo(other._value);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override bool Equals(object? obj)
=> obj is Proxy other && Equals(other);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() => _value;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator int(Proxy n) => n._value;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator Proxy(int v) => new(v);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(Proxy a, Proxy b) => a._value == b._value;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator !=(Proxy a, Proxy b) => a._value != b._value;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator >(Proxy a, Proxy b) => a._value > b._value;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator <(Proxy a, Proxy b) => a._value < b._value;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator >=(Proxy a, Proxy b) => a._value >= b._value;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator <=(Proxy a, Proxy b) => a._value <= b._value;
public override string ToString()
=> _value.ToString();
}
}
}