forked from RemoteTechnologiesGroup/RemoteTech
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBidirectionalEdge.cs
More file actions
41 lines (35 loc) · 942 Bytes
/
Copy pathBidirectionalEdge.cs
File metadata and controls
41 lines (35 loc) · 942 Bytes
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
using System;
namespace RemoteTech.SimpleTypes
{
public enum LinkType
{
None,
Dish,
Omni,
}
public class BidirectionalEdge<T> : IEquatable<BidirectionalEdge<T>>
{
public bool Equals(BidirectionalEdge<T> other)
{
return (A.Equals(other.A) || A.Equals(other.B)) &&
(B.Equals(other.A) || B.Equals(other.B));
}
public readonly T A;
public readonly T B;
public readonly LinkType Type;
public BidirectionalEdge(T a, T b, LinkType type)
{
A = a;
B = b;
Type = type;
}
public override int GetHashCode()
{
return A.GetHashCode() + B.GetHashCode();
}
public override string ToString()
{
return String.Format("BidirectionalEdge(A: {0}, B: {1}, Type {2})", A, B, Type.ToString());
}
}
}