| | 1 | | //------------------------------------------------------------------------------ |
| | 2 | | // <auto-generated> |
| | 3 | | // This code was generated from "Tools\Towel_Generating\LinkGenerator.cs". |
| | 4 | | // </auto-generated> |
| | 5 | | //------------------------------------------------------------------------------ |
| | 6 | |
|
| | 7 | | namespace Towel.DataStructures; |
| | 8 | |
|
| | 9 | | /// <summary>Represents a link between objects.</summary> |
| | 10 | | public interface Link : IDataStructure<object>, System.Runtime.CompilerServices.ITuple |
| | 11 | | { |
| | 12 | | #region Properties |
| | 13 | |
|
| | 14 | | int System.Runtime.CompilerServices.ITuple.Length => Size; |
| | 15 | |
|
| | 16 | | /// <summary>The number of values in the tuple.</summary> |
| | 17 | | int Size { get; } |
| | 18 | |
|
| | 19 | | #endregion |
| | 20 | | } |
| | 21 | |
|
| | 22 | | /// <summary>Represents a link between objects.</summary> |
| | 23 | | /// <typeparam name="T1">The type of #1 value in the link.</typeparam> |
| | 24 | | public class Link<T1> : Link, ICloneable<Link<T1>> |
| | 25 | | { |
| | 26 | | /// <summary>The #1 value of the link.</summary> |
| | 27 | | public T1 Value1 { get; set; } |
| | 28 | |
|
| | 29 | | #region Constructors |
| | 30 | |
|
| | 31 | | /// <summary>Constructs a link of values.</summary> |
| | 32 | | /// <param name="value1">The #1 value to be linked.</param> |
| | 33 | | public Link(T1 value1) |
| | 34 | | { |
| | 35 | | Value1 = value1; |
| | 36 | | } |
| | 37 | |
|
| | 38 | | #endregion |
| | 39 | |
|
| | 40 | | #region Properties |
| | 41 | |
|
| | 42 | | /// <inheritdoc/> |
| | 43 | | public int Size => 1; |
| | 44 | |
|
| | 45 | | /// <inheritdoc/> |
| | 46 | | public object this[int index] |
| | 47 | | { |
| | 48 | | get => index switch |
| | 49 | | { |
| | 50 | | 1 => Value1, |
| | 51 | | _ => throw new IndexOutOfRangeException($"{nameof(index)} < 1 || 1 < {nameof(index)}"), |
| | 52 | | }; |
| | 53 | | } |
| | 54 | |
|
| | 55 | | #endregion |
| | 56 | |
|
| | 57 | | #region Operators |
| | 58 | |
|
| | 59 | | /// <summary>Converts a tuple to a link.</summary> |
| | 60 | | /// <param name="tuple">The tuple to convert to a link.</param> |
| | 61 | | public static implicit operator Link<T1>(ValueTuple<T1> tuple) => |
| | 62 | | new(tuple.Item1); |
| | 63 | |
|
| | 64 | | /// <summary>Converts a link to a tuple.</summary> |
| | 65 | | /// <param name="link">The link to convert to a tuple.</param> |
| | 66 | | public static implicit operator ValueTuple<T1>(Link<T1> link) => |
| | 67 | | new(link.Value1); |
| | 68 | |
|
| | 69 | | /// <summary>Converts a tuple to a link.</summary> |
| | 70 | | /// <param name="tuple">The tuple to convert to a link.</param> |
| | 71 | | public static implicit operator Link<T1>(Tuple<T1> tuple) => |
| | 72 | | new(tuple.Item1); |
| | 73 | |
|
| | 74 | | /// <summary>Converts a link to a tuple.</summary> |
| | 75 | | /// <param name="link">The link to convert to a tuple.</param> |
| | 76 | | public static implicit operator Tuple<T1>(Link<T1> link) => |
| | 77 | | new(link.Value1); |
| | 78 | |
|
| | 79 | | /// <summary>Converts a class link to a struct link.</summary> |
| | 80 | | /// <param name="link">The class link to convert to a struct link.</param> |
| | 81 | | public static implicit operator Link<T1>(LinkStruct<T1> link) => |
| | 82 | | new(link.Value1); |
| | 83 | |
|
| | 84 | | #endregion |
| | 85 | |
|
| | 86 | | #region Methods |
| | 87 | |
|
| | 88 | | System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); |
| | 89 | |
|
| | 90 | | /// <inheritdoc/> |
| | 91 | | public System.Collections.Generic.IEnumerator<object> GetEnumerator() |
| | 92 | | { |
| | 93 | | yield return Value1; |
| | 94 | | } |
| | 95 | |
|
| | 96 | | /// <summary>Gets the types of the values of this link.</summary> |
| | 97 | | /// <returns>The types of the values of this link.</returns> |
| | 98 | | public Type[] Types() => new[] { typeof(T1) }; |
| | 99 | |
|
| | 100 | | /// <inheritdoc/> |
| | 101 | | public StepStatus StepperBreak<TStep>(TStep step = default) |
| | 102 | | where TStep : struct, IFunc<object, StepStatus> |
| | 103 | | { |
| | 104 | | if (step.Invoke(Value1) is Break) return Break; |
| | 105 | | return Continue; |
| | 106 | | } |
| | 107 | |
|
| | 108 | | /// <inheritdoc/> |
| | 109 | | public Link<T1> Clone() => new(Value1); |
| | 110 | |
|
| | 111 | | /// <inheritdoc/> |
| | 112 | | public object[] ToArray() => new object[] { Value1 }; |
| | 113 | |
|
| | 114 | | /// <inheritdoc/> |
| | 115 | | public override int GetHashCode() => HashCode.Combine(Value1); |
| | 116 | |
|
| | 117 | | /// <inheritdoc/> |
| | 118 | | public override bool Equals(object obj) => |
| | 119 | | obj is LinkStruct<T1> linkStruct && Equals(linkStruct) || |
| | 120 | | obj is Link<T1> link && Equals(link) || |
| | 121 | | obj is ValueTuple<T1> valueTuple && Equals(valueTuple) || |
| | 122 | | obj is Tuple<T1> tuple && Equals(tuple); |
| | 123 | |
|
| | 124 | | /// <summary>Check for equality with another link.</summary> |
| | 125 | | /// <param name="b">The other link to check for equality with.</param> |
| | 126 | | /// <returns>True if equal; false if not.</returns> |
| | 127 | | public bool Equals(Link<T1> b) => |
| | 128 | | Equate(Value1, b.Value1); |
| | 129 | |
|
| | 130 | | /// <summary>Deconstructs the link.</summary> |
| | 131 | | /// <param name="value1">The #1 value of the link.</param> |
| | 132 | | public void Deconstruct(out T1 value1) |
| | 133 | | { |
| | 134 | | value1 = Value1; |
| | 135 | | } |
| | 136 | |
|
| | 137 | | #endregion |
| | 138 | | } |
| | 139 | |
|
| | 140 | | /// <summary>Represents a link between objects.</summary> |
| | 141 | | /// <typeparam name="T1">The type of #1 value in the link.</typeparam> |
| | 142 | | public struct LinkStruct<T1> : Link, ICloneable<LinkStruct<T1>> |
| | 143 | | { |
| | 144 | | /// <summary>The #1 value of the link.</summary> |
| | 145 | | public T1 Value1 { get; set; } |
| | 146 | |
|
| | 147 | | #region Constructors |
| | 148 | |
|
| | 149 | | /// <summary>Creates a link between objects.</summary> |
| | 150 | | /// <param name="value1">The #1 value to be linked.</param> |
| | 151 | | public LinkStruct(T1 value1) |
| | 152 | | { |
| | 153 | | Value1 = value1; |
| | 154 | | } |
| | 155 | |
|
| | 156 | | #endregion |
| | 157 | |
|
| | 158 | | #region Properties |
| | 159 | |
|
| | 160 | | /// <inheritdoc/> |
| | 161 | | public int Size => 1; |
| | 162 | |
|
| | 163 | | /// <inheritdoc/> |
| | 164 | | public object this[int index] |
| | 165 | | { |
| | 166 | | get => index switch |
| | 167 | | { |
| | 168 | | 1 => Value1, |
| | 169 | | _ => throw new IndexOutOfRangeException($"{nameof(index)} < 1 || 1 < {nameof(index)}"), |
| | 170 | | }; |
| | 171 | | } |
| | 172 | |
|
| | 173 | | #endregion |
| | 174 | |
|
| | 175 | | #region Operators |
| | 176 | |
|
| | 177 | | /// <summary>Converts a tuple to a link.</summary> |
| | 178 | | /// <param name="tuple">The tuple to convert to a link.</param> |
| | 179 | | public static implicit operator LinkStruct<T1>(ValueTuple<T1> tuple) => |
| | 180 | | new(tuple.Item1); |
| | 181 | |
|
| | 182 | | /// <summary>Converts a link to a tuple.</summary> |
| | 183 | | /// <param name="link">The link to convert to a tuple.</param> |
| | 184 | | public static implicit operator ValueTuple<T1>(LinkStruct<T1> link) => |
| | 185 | | new(link.Value1); |
| | 186 | |
|
| | 187 | | /// <summary>Converts a tuple to a link.</summary> |
| | 188 | | /// <param name="tuple">The tuple to convert to a link.</param> |
| | 189 | | public static implicit operator LinkStruct<T1>(Tuple<T1> tuple) => |
| | 190 | | new(tuple.Item1); |
| | 191 | |
|
| | 192 | | /// <summary>Converts a link to a tuple.</summary> |
| | 193 | | /// <param name="link">The link to convert to a tuple.</param> |
| | 194 | | public static implicit operator Tuple<T1>(LinkStruct<T1> link) => |
| | 195 | | new(link.Value1); |
| | 196 | |
|
| | 197 | | /// <summary>Converts a class link to a struct link.</summary> |
| | 198 | | /// <param name="link">The class link to convert to a struct link.</param> |
| | 199 | | public static implicit operator LinkStruct<T1>(Link<T1> link) => |
| | 200 | | new(link.Value1); |
| | 201 | |
|
| | 202 | | #endregion |
| | 203 | |
|
| | 204 | | #region Methods |
| | 205 | |
|
| | 206 | | System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); |
| | 207 | |
|
| | 208 | | /// <inheritdoc/> |
| | 209 | | public System.Collections.Generic.IEnumerator<object> GetEnumerator() |
| | 210 | | { |
| | 211 | | yield return Value1; |
| | 212 | | } |
| | 213 | |
|
| | 214 | | /// <summary>Gets the types of the values of this link.</summary> |
| | 215 | | /// <returns>The types of the values of this link.</returns> |
| | 216 | | public Type[] Types() => new[] { typeof(T1) }; |
| | 217 | |
|
| | 218 | | /// <inheritdoc/> |
| | 219 | | public StepStatus StepperBreak<TStep>(TStep step = default) |
| | 220 | | where TStep : struct, IFunc<object, StepStatus> |
| | 221 | | { |
| | 222 | | if (step.Invoke(Value1) is Break) return Break; |
| | 223 | | return Continue; |
| | 224 | | } |
| | 225 | |
|
| | 226 | | /// <inheritdoc/> |
| | 227 | | public LinkStruct<T1> Clone() => new(Value1); |
| | 228 | |
|
| | 229 | | /// <inheritdoc/> |
| | 230 | | public object[] ToArray() => new object[] { Value1 }; |
| | 231 | |
|
| | 232 | | /// <inheritdoc/> |
| | 233 | | public override int GetHashCode() => HashCode.Combine(Value1); |
| | 234 | |
|
| | 235 | | /// <inheritdoc/> |
| | 236 | | public override bool Equals(object obj) => |
| | 237 | | obj is LinkStruct<T1> linkStruct && Equals(linkStruct) || |
| | 238 | | obj is Link<T1> link && Equals(link) || |
| | 239 | | obj is ValueTuple<T1> valueTuple && Equals(valueTuple) || |
| | 240 | | obj is Tuple<T1> tuple && Equals(tuple); |
| | 241 | |
|
| | 242 | | /// <summary>Check for equality with another link.</summary> |
| | 243 | | /// <param name="b">The other link to check for equality with.</param> |
| | 244 | | /// <returns>True if equal; false if not.</returns> |
| | 245 | | public bool Equals(LinkStruct<T1> b) => |
| | 246 | | Equate(Value1, b.Value1); |
| | 247 | |
|
| | 248 | | /// <summary>Deconstructs the link.</summary> |
| | 249 | | /// <param name="value1">The #1 value of the link.</param> |
| | 250 | | public void Deconstruct(out T1 value1) |
| | 251 | | { |
| | 252 | | value1 = Value1; |
| | 253 | | } |
| | 254 | |
|
| | 255 | | #endregion |
| | 256 | | } |
| | 257 | |
|
| | 258 | | /// <summary>Represents a link between objects.</summary> |
| | 259 | | /// <typeparam name="T1">The type of #1 value in the link.</typeparam> |
| | 260 | | /// <typeparam name="T2">The type of #2 value in the link.</typeparam> |
| | 261 | | public class Link<T1, T2> : Link, ICloneable<Link<T1, T2>> |
| | 262 | | { |
| | 263 | | /// <summary>The #1 value of the link.</summary> |
| | 264 | | public T1 Value1 { get; set; } |
| | 265 | | /// <summary>The #2 value of the link.</summary> |
| | 266 | | public T2 Value2 { get; set; } |
| | 267 | |
|
| | 268 | | #region Constructors |
| | 269 | |
|
| | 270 | | /// <summary>Constructs a link of values.</summary> |
| | 271 | | /// <param name="value1">The #1 value to be linked.</param> |
| | 272 | | /// <param name="value2">The #2 value to be linked.</param> |
| | 273 | | public Link(T1 value1, T2 value2) |
| | 274 | | { |
| | 275 | | Value1 = value1; |
| | 276 | | Value2 = value2; |
| | 277 | | } |
| | 278 | |
|
| | 279 | | #endregion |
| | 280 | |
|
| | 281 | | #region Properties |
| | 282 | |
|
| | 283 | | /// <inheritdoc/> |
| | 284 | | public int Size => 2; |
| | 285 | |
|
| | 286 | | /// <inheritdoc/> |
| | 287 | | public object this[int index] |
| | 288 | | { |
| | 289 | | get => index switch |
| | 290 | | { |
| | 291 | | 1 => Value1, |
| | 292 | | 2 => Value2, |
| | 293 | | _ => throw new IndexOutOfRangeException($"{nameof(index)} < 1 || 2 < {nameof(index)}"), |
| | 294 | | }; |
| | 295 | | } |
| | 296 | |
|
| | 297 | | #endregion |
| | 298 | |
|
| | 299 | | #region Operators |
| | 300 | |
|
| | 301 | | /// <summary>Converts a tuple to a link.</summary> |
| | 302 | | /// <param name="tuple">The tuple to convert to a link.</param> |
| | 303 | | public static implicit operator Link<T1, T2>((T1, T2) tuple) => |
| | 304 | | new(tuple.Item1, tuple.Item2); |
| | 305 | |
|
| | 306 | | /// <summary>Converts a link to a tuple.</summary> |
| | 307 | | /// <param name="link">The link to convert to a tuple.</param> |
| | 308 | | public static implicit operator (T1, T2)(Link<T1, T2> link) => |
| | 309 | | (link.Value1, link.Value2); |
| | 310 | |
|
| | 311 | | /// <summary>Converts a tuple to a link.</summary> |
| | 312 | | /// <param name="tuple">The tuple to convert to a link.</param> |
| | 313 | | public static implicit operator Link<T1, T2>(Tuple<T1, T2> tuple) => |
| | 314 | | new(tuple.Item1, tuple.Item2); |
| | 315 | |
|
| | 316 | | /// <summary>Converts a link to a tuple.</summary> |
| | 317 | | /// <param name="link">The link to convert to a tuple.</param> |
| | 318 | | public static implicit operator Tuple<T1, T2>(Link<T1, T2> link) => |
| | 319 | | new(link.Value1, link.Value2); |
| | 320 | |
|
| | 321 | | /// <summary>Converts a class link to a struct link.</summary> |
| | 322 | | /// <param name="link">The class link to convert to a struct link.</param> |
| | 323 | | public static implicit operator Link<T1, T2>(LinkStruct<T1, T2> link) => |
| | 324 | | new(link.Value1, link.Value2); |
| | 325 | |
|
| | 326 | | #endregion |
| | 327 | |
|
| | 328 | | #region Methods |
| | 329 | |
|
| | 330 | | System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); |
| | 331 | |
|
| | 332 | | /// <inheritdoc/> |
| | 333 | | public System.Collections.Generic.IEnumerator<object> GetEnumerator() |
| | 334 | | { |
| | 335 | | yield return Value1; |
| | 336 | | yield return Value2; |
| | 337 | | } |
| | 338 | |
|
| | 339 | | /// <summary>Gets the types of the values of this link.</summary> |
| | 340 | | /// <returns>The types of the values of this link.</returns> |
| | 341 | | public Type[] Types() => new[] { typeof(T1), typeof(T2) }; |
| | 342 | |
|
| | 343 | | /// <inheritdoc/> |
| | 344 | | public StepStatus StepperBreak<TStep>(TStep step = default) |
| | 345 | | where TStep : struct, IFunc<object, StepStatus> |
| | 346 | | { |
| | 347 | | if (step.Invoke(Value1) is Break) return Break; |
| | 348 | | if (step.Invoke(Value2) is Break) return Break; |
| | 349 | | return Continue; |
| | 350 | | } |
| | 351 | |
|
| | 352 | | /// <inheritdoc/> |
| | 353 | | public Link<T1, T2> Clone() => new(Value1, Value2); |
| | 354 | |
|
| | 355 | | /// <inheritdoc/> |
| | 356 | | public object[] ToArray() => new object[] { Value1, Value2 }; |
| | 357 | |
|
| | 358 | | /// <inheritdoc/> |
| | 359 | | public override int GetHashCode() => HashCode.Combine(Value1, Value2); |
| | 360 | |
|
| | 361 | | /// <inheritdoc/> |
| | 362 | | public override bool Equals(object obj) => |
| | 363 | | obj is LinkStruct<T1, T2> linkStruct && Equals(linkStruct) || |
| | 364 | | obj is Link<T1, T2> link && Equals(link) || |
| | 365 | | obj is ValueTuple<T1, T2> valueTuple && Equals(valueTuple) || |
| | 366 | | obj is Tuple<T1, T2> tuple && Equals(tuple); |
| | 367 | |
|
| | 368 | | /// <summary>Check for equality with another link.</summary> |
| | 369 | | /// <param name="b">The other link to check for equality with.</param> |
| | 370 | | /// <returns>True if equal; false if not.</returns> |
| | 371 | | public bool Equals(Link<T1, T2> b) => |
| | 372 | | Equate(Value1, b.Value1) && |
| | 373 | | Equate(Value2, b.Value2); |
| | 374 | |
|
| | 375 | | /// <summary>Deconstructs the link.</summary> |
| | 376 | | /// <param name="value1">The #1 value of the link.</param> |
| | 377 | | /// <param name="value2">The #2 value of the link.</param> |
| | 378 | | public void Deconstruct(out T1 value1, out T2 value2) |
| | 379 | | { |
| | 380 | | value1 = Value1; |
| | 381 | | value2 = Value2; |
| | 382 | | } |
| | 383 | |
|
| | 384 | | #endregion |
| | 385 | | } |
| | 386 | |
|
| | 387 | | /// <summary>Represents a link between objects.</summary> |
| | 388 | | /// <typeparam name="T1">The type of #1 value in the link.</typeparam> |
| | 389 | | /// <typeparam name="T2">The type of #2 value in the link.</typeparam> |
| | 390 | | public struct LinkStruct<T1, T2> : Link, ICloneable<LinkStruct<T1, T2>> |
| | 391 | | { |
| | 392 | | /// <summary>The #1 value of the link.</summary> |
| | 393 | | public T1 Value1 { get; set; } |
| | 394 | | /// <summary>The #2 value of the link.</summary> |
| | 395 | | public T2 Value2 { get; set; } |
| | 396 | |
|
| | 397 | | #region Constructors |
| | 398 | |
|
| | 399 | | /// <summary>Creates a link between objects.</summary> |
| | 400 | | /// <param name="value1">The #1 value to be linked.</param> |
| | 401 | | /// <param name="value2">The #2 value to be linked.</param> |
| | 402 | | public LinkStruct(T1 value1, T2 value2) |
| | 403 | | { |
| | 404 | | Value1 = value1; |
| | 405 | | Value2 = value2; |
| | 406 | | } |
| | 407 | |
|
| | 408 | | #endregion |
| | 409 | |
|
| | 410 | | #region Properties |
| | 411 | |
|
| | 412 | | /// <inheritdoc/> |
| | 413 | | public int Size => 2; |
| | 414 | |
|
| | 415 | | /// <inheritdoc/> |
| | 416 | | public object this[int index] |
| | 417 | | { |
| | 418 | | get => index switch |
| | 419 | | { |
| | 420 | | 1 => Value1, |
| | 421 | | 2 => Value2, |
| | 422 | | _ => throw new IndexOutOfRangeException($"{nameof(index)} < 1 || 2 < {nameof(index)}"), |
| | 423 | | }; |
| | 424 | | } |
| | 425 | |
|
| | 426 | | #endregion |
| | 427 | |
|
| | 428 | | #region Operators |
| | 429 | |
|
| | 430 | | /// <summary>Converts a tuple to a link.</summary> |
| | 431 | | /// <param name="tuple">The tuple to convert to a link.</param> |
| | 432 | | public static implicit operator LinkStruct<T1, T2>((T1, T2) tuple) => |
| | 433 | | new(tuple.Item1, tuple.Item2); |
| | 434 | |
|
| | 435 | | /// <summary>Converts a link to a tuple.</summary> |
| | 436 | | /// <param name="link">The link to convert to a tuple.</param> |
| | 437 | | public static implicit operator (T1, T2)(LinkStruct<T1, T2> link) => |
| | 438 | | (link.Value1, link.Value2); |
| | 439 | |
|
| | 440 | | /// <summary>Converts a tuple to a link.</summary> |
| | 441 | | /// <param name="tuple">The tuple to convert to a link.</param> |
| | 442 | | public static implicit operator LinkStruct<T1, T2>(Tuple<T1, T2> tuple) => |
| | 443 | | new(tuple.Item1, tuple.Item2); |
| | 444 | |
|
| | 445 | | /// <summary>Converts a link to a tuple.</summary> |
| | 446 | | /// <param name="link">The link to convert to a tuple.</param> |
| | 447 | | public static implicit operator Tuple<T1, T2>(LinkStruct<T1, T2> link) => |
| | 448 | | new(link.Value1, link.Value2); |
| | 449 | |
|
| | 450 | | /// <summary>Converts a class link to a struct link.</summary> |
| | 451 | | /// <param name="link">The class link to convert to a struct link.</param> |
| | 452 | | public static implicit operator LinkStruct<T1, T2>(Link<T1, T2> link) => |
| | 453 | | new(link.Value1, link.Value2); |
| | 454 | |
|
| | 455 | | #endregion |
| | 456 | |
|
| | 457 | | #region Methods |
| | 458 | |
|
| | 459 | | System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); |
| | 460 | |
|
| | 461 | | /// <inheritdoc/> |
| | 462 | | public System.Collections.Generic.IEnumerator<object> GetEnumerator() |
| | 463 | | { |
| | 464 | | yield return Value1; |
| | 465 | | yield return Value2; |
| | 466 | | } |
| | 467 | |
|
| | 468 | | /// <summary>Gets the types of the values of this link.</summary> |
| | 469 | | /// <returns>The types of the values of this link.</returns> |
| | 470 | | public Type[] Types() => new[] { typeof(T1), typeof(T2) }; |
| | 471 | |
|
| | 472 | | /// <inheritdoc/> |
| | 473 | | public StepStatus StepperBreak<TStep>(TStep step = default) |
| | 474 | | where TStep : struct, IFunc<object, StepStatus> |
| | 475 | | { |
| | 476 | | if (step.Invoke(Value1) is Break) return Break; |
| | 477 | | if (step.Invoke(Value2) is Break) return Break; |
| | 478 | | return Continue; |
| | 479 | | } |
| | 480 | |
|
| | 481 | | /// <inheritdoc/> |
| | 482 | | public LinkStruct<T1, T2> Clone() => new(Value1, Value2); |
| | 483 | |
|
| | 484 | | /// <inheritdoc/> |
| | 485 | | public object[] ToArray() => new object[] { Value1, Value2 }; |
| | 486 | |
|
| | 487 | | /// <inheritdoc/> |
| | 488 | | public override int GetHashCode() => HashCode.Combine(Value1, Value2); |
| | 489 | |
|
| | 490 | | /// <inheritdoc/> |
| | 491 | | public override bool Equals(object obj) => |
| | 492 | | obj is LinkStruct<T1, T2> linkStruct && Equals(linkStruct) || |
| | 493 | | obj is Link<T1, T2> link && Equals(link) || |
| | 494 | | obj is ValueTuple<T1, T2> valueTuple && Equals(valueTuple) || |
| | 495 | | obj is Tuple<T1, T2> tuple && Equals(tuple); |
| | 496 | |
|
| | 497 | | /// <summary>Check for equality with another link.</summary> |
| | 498 | | /// <param name="b">The other link to check for equality with.</param> |
| | 499 | | /// <returns>True if equal; false if not.</returns> |
| | 500 | | public bool Equals(LinkStruct<T1, T2> b) => |
| | 501 | | Equate(Value1, b.Value1) && |
| | 502 | | Equate(Value2, b.Value2); |
| | 503 | |
|
| | 504 | | /// <summary>Deconstructs the link.</summary> |
| | 505 | | /// <param name="value1">The #1 value of the link.</param> |
| | 506 | | /// <param name="value2">The #2 value of the link.</param> |
| | 507 | | public void Deconstruct(out T1 value1, out T2 value2) |
| | 508 | | { |
| | 509 | | value1 = Value1; |
| | 510 | | value2 = Value2; |
| | 511 | | } |
| | 512 | |
|
| | 513 | | #endregion |
| | 514 | | } |
| | 515 | |
|
| | 516 | | /// <summary>Represents a link between objects.</summary> |
| | 517 | | /// <typeparam name="T1">The type of #1 value in the link.</typeparam> |
| | 518 | | /// <typeparam name="T2">The type of #2 value in the link.</typeparam> |
| | 519 | | /// <typeparam name="T3">The type of #3 value in the link.</typeparam> |
| | 520 | | public class Link<T1, T2, T3> : Link, ICloneable<Link<T1, T2, T3>> |
| | 521 | | { |
| | 522 | | /// <summary>The #1 value of the link.</summary> |
| | 523 | | public T1 Value1 { get; set; } |
| | 524 | | /// <summary>The #2 value of the link.</summary> |
| | 525 | | public T2 Value2 { get; set; } |
| | 526 | | /// <summary>The #3 value of the link.</summary> |
| | 527 | | public T3 Value3 { get; set; } |
| | 528 | |
|
| | 529 | | #region Constructors |
| | 530 | |
|
| | 531 | | /// <summary>Constructs a link of values.</summary> |
| | 532 | | /// <param name="value1">The #1 value to be linked.</param> |
| | 533 | | /// <param name="value2">The #2 value to be linked.</param> |
| | 534 | | /// <param name="value3">The #3 value to be linked.</param> |
| | 535 | | public Link(T1 value1, T2 value2, T3 value3) |
| | 536 | | { |
| | 537 | | Value1 = value1; |
| | 538 | | Value2 = value2; |
| | 539 | | Value3 = value3; |
| | 540 | | } |
| | 541 | |
|
| | 542 | | #endregion |
| | 543 | |
|
| | 544 | | #region Properties |
| | 545 | |
|
| | 546 | | /// <inheritdoc/> |
| | 547 | | public int Size => 3; |
| | 548 | |
|
| | 549 | | /// <inheritdoc/> |
| | 550 | | public object this[int index] |
| | 551 | | { |
| | 552 | | get => index switch |
| | 553 | | { |
| | 554 | | 1 => Value1, |
| | 555 | | 2 => Value2, |
| | 556 | | 3 => Value3, |
| | 557 | | _ => throw new IndexOutOfRangeException($"{nameof(index)} < 1 || 3 < {nameof(index)}"), |
| | 558 | | }; |
| | 559 | | } |
| | 560 | |
|
| | 561 | | #endregion |
| | 562 | |
|
| | 563 | | #region Operators |
| | 564 | |
|
| | 565 | | /// <summary>Converts a tuple to a link.</summary> |
| | 566 | | /// <param name="tuple">The tuple to convert to a link.</param> |
| | 567 | | public static implicit operator Link<T1, T2, T3>((T1, T2, T3) tuple) => |
| | 568 | | new(tuple.Item1, tuple.Item2, tuple.Item3); |
| | 569 | |
|
| | 570 | | /// <summary>Converts a link to a tuple.</summary> |
| | 571 | | /// <param name="link">The link to convert to a tuple.</param> |
| | 572 | | public static implicit operator (T1, T2, T3)(Link<T1, T2, T3> link) => |
| | 573 | | (link.Value1, link.Value2, link.Value3); |
| | 574 | |
|
| | 575 | | /// <summary>Converts a tuple to a link.</summary> |
| | 576 | | /// <param name="tuple">The tuple to convert to a link.</param> |
| | 577 | | public static implicit operator Link<T1, T2, T3>(Tuple<T1, T2, T3> tuple) => |
| | 578 | | new(tuple.Item1, tuple.Item2, tuple.Item3); |
| | 579 | |
|
| | 580 | | /// <summary>Converts a link to a tuple.</summary> |
| | 581 | | /// <param name="link">The link to convert to a tuple.</param> |
| | 582 | | public static implicit operator Tuple<T1, T2, T3>(Link<T1, T2, T3> link) => |
| | 583 | | new(link.Value1, link.Value2, link.Value3); |
| | 584 | |
|
| | 585 | | /// <summary>Converts a class link to a struct link.</summary> |
| | 586 | | /// <param name="link">The class link to convert to a struct link.</param> |
| | 587 | | public static implicit operator Link<T1, T2, T3>(LinkStruct<T1, T2, T3> link) => |
| | 588 | | new(link.Value1, link.Value2, link.Value3); |
| | 589 | |
|
| | 590 | | #endregion |
| | 591 | |
|
| | 592 | | #region Methods |
| | 593 | |
|
| | 594 | | System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); |
| | 595 | |
|
| | 596 | | /// <inheritdoc/> |
| | 597 | | public System.Collections.Generic.IEnumerator<object> GetEnumerator() |
| | 598 | | { |
| | 599 | | yield return Value1; |
| | 600 | | yield return Value2; |
| | 601 | | yield return Value3; |
| | 602 | | } |
| | 603 | |
|
| | 604 | | /// <summary>Gets the types of the values of this link.</summary> |
| | 605 | | /// <returns>The types of the values of this link.</returns> |
| | 606 | | public Type[] Types() => new[] { typeof(T1), typeof(T2), typeof(T3) }; |
| | 607 | |
|
| | 608 | | /// <inheritdoc/> |
| | 609 | | public StepStatus StepperBreak<TStep>(TStep step = default) |
| | 610 | | where TStep : struct, IFunc<object, StepStatus> |
| | 611 | | { |
| | 612 | | if (step.Invoke(Value1) is Break) return Break; |
| | 613 | | if (step.Invoke(Value2) is Break) return Break; |
| | 614 | | if (step.Invoke(Value3) is Break) return Break; |
| | 615 | | return Continue; |
| | 616 | | } |
| | 617 | |
|
| | 618 | | /// <inheritdoc/> |
| | 619 | | public Link<T1, T2, T3> Clone() => new(Value1, Value2, Value3); |
| | 620 | |
|
| | 621 | | /// <inheritdoc/> |
| | 622 | | public object[] ToArray() => new object[] { Value1, Value2, Value3 }; |
| | 623 | |
|
| | 624 | | /// <inheritdoc/> |
| | 625 | | public override int GetHashCode() => HashCode.Combine(Value1, Value2, Value3); |
| | 626 | |
|
| | 627 | | /// <inheritdoc/> |
| | 628 | | public override bool Equals(object obj) => |
| | 629 | | obj is LinkStruct<T1, T2, T3> linkStruct && Equals(linkStruct) || |
| | 630 | | obj is Link<T1, T2, T3> link && Equals(link) || |
| | 631 | | obj is ValueTuple<T1, T2, T3> valueTuple && Equals(valueTuple) || |
| | 632 | | obj is Tuple<T1, T2, T3> tuple && Equals(tuple); |
| | 633 | |
|
| | 634 | | /// <summary>Check for equality with another link.</summary> |
| | 635 | | /// <param name="b">The other link to check for equality with.</param> |
| | 636 | | /// <returns>True if equal; false if not.</returns> |
| | 637 | | public bool Equals(Link<T1, T2, T3> b) => |
| | 638 | | Equate(Value1, b.Value1) && |
| | 639 | | Equate(Value2, b.Value2) && |
| | 640 | | Equate(Value3, b.Value3); |
| | 641 | |
|
| | 642 | | /// <summary>Deconstructs the link.</summary> |
| | 643 | | /// <param name="value1">The #1 value of the link.</param> |
| | 644 | | /// <param name="value2">The #2 value of the link.</param> |
| | 645 | | /// <param name="value3">The #3 value of the link.</param> |
| | 646 | | public void Deconstruct(out T1 value1, out T2 value2, out T3 value3) |
| | 647 | | { |
| | 648 | | value1 = Value1; |
| | 649 | | value2 = Value2; |
| | 650 | | value3 = Value3; |
| | 651 | | } |
| | 652 | |
|
| | 653 | | #endregion |
| | 654 | | } |
| | 655 | |
|
| | 656 | | /// <summary>Represents a link between objects.</summary> |
| | 657 | | /// <typeparam name="T1">The type of #1 value in the link.</typeparam> |
| | 658 | | /// <typeparam name="T2">The type of #2 value in the link.</typeparam> |
| | 659 | | /// <typeparam name="T3">The type of #3 value in the link.</typeparam> |
| | 660 | | public struct LinkStruct<T1, T2, T3> : Link, ICloneable<LinkStruct<T1, T2, T3>> |
| | 661 | | { |
| | 662 | | /// <summary>The #1 value of the link.</summary> |
| | 663 | | public T1 Value1 { get; set; } |
| | 664 | | /// <summary>The #2 value of the link.</summary> |
| | 665 | | public T2 Value2 { get; set; } |
| | 666 | | /// <summary>The #3 value of the link.</summary> |
| | 667 | | public T3 Value3 { get; set; } |
| | 668 | |
|
| | 669 | | #region Constructors |
| | 670 | |
|
| | 671 | | /// <summary>Creates a link between objects.</summary> |
| | 672 | | /// <param name="value1">The #1 value to be linked.</param> |
| | 673 | | /// <param name="value2">The #2 value to be linked.</param> |
| | 674 | | /// <param name="value3">The #3 value to be linked.</param> |
| | 675 | | public LinkStruct(T1 value1, T2 value2, T3 value3) |
| | 676 | | { |
| | 677 | | Value1 = value1; |
| | 678 | | Value2 = value2; |
| | 679 | | Value3 = value3; |
| | 680 | | } |
| | 681 | |
|
| | 682 | | #endregion |
| | 683 | |
|
| | 684 | | #region Properties |
| | 685 | |
|
| | 686 | | /// <inheritdoc/> |
| | 687 | | public int Size => 3; |
| | 688 | |
|
| | 689 | | /// <inheritdoc/> |
| | 690 | | public object this[int index] |
| | 691 | | { |
| | 692 | | get => index switch |
| | 693 | | { |
| | 694 | | 1 => Value1, |
| | 695 | | 2 => Value2, |
| | 696 | | 3 => Value3, |
| | 697 | | _ => throw new IndexOutOfRangeException($"{nameof(index)} < 1 || 3 < {nameof(index)}"), |
| | 698 | | }; |
| | 699 | | } |
| | 700 | |
|
| | 701 | | #endregion |
| | 702 | |
|
| | 703 | | #region Operators |
| | 704 | |
|
| | 705 | | /// <summary>Converts a tuple to a link.</summary> |
| | 706 | | /// <param name="tuple">The tuple to convert to a link.</param> |
| | 707 | | public static implicit operator LinkStruct<T1, T2, T3>((T1, T2, T3) tuple) => |
| | 708 | | new(tuple.Item1, tuple.Item2, tuple.Item3); |
| | 709 | |
|
| | 710 | | /// <summary>Converts a link to a tuple.</summary> |
| | 711 | | /// <param name="link">The link to convert to a tuple.</param> |
| | 712 | | public static implicit operator (T1, T2, T3)(LinkStruct<T1, T2, T3> link) => |
| | 713 | | (link.Value1, link.Value2, link.Value3); |
| | 714 | |
|
| | 715 | | /// <summary>Converts a tuple to a link.</summary> |
| | 716 | | /// <param name="tuple">The tuple to convert to a link.</param> |
| | 717 | | public static implicit operator LinkStruct<T1, T2, T3>(Tuple<T1, T2, T3> tuple) => |
| | 718 | | new(tuple.Item1, tuple.Item2, tuple.Item3); |
| | 719 | |
|
| | 720 | | /// <summary>Converts a link to a tuple.</summary> |
| | 721 | | /// <param name="link">The link to convert to a tuple.</param> |
| | 722 | | public static implicit operator Tuple<T1, T2, T3>(LinkStruct<T1, T2, T3> link) => |
| | 723 | | new(link.Value1, link.Value2, link.Value3); |
| | 724 | |
|
| | 725 | | /// <summary>Converts a class link to a struct link.</summary> |
| | 726 | | /// <param name="link">The class link to convert to a struct link.</param> |
| | 727 | | public static implicit operator LinkStruct<T1, T2, T3>(Link<T1, T2, T3> link) => |
| | 728 | | new(link.Value1, link.Value2, link.Value3); |
| | 729 | |
|
| | 730 | | #endregion |
| | 731 | |
|
| | 732 | | #region Methods |
| | 733 | |
|
| | 734 | | System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); |
| | 735 | |
|
| | 736 | | /// <inheritdoc/> |
| | 737 | | public System.Collections.Generic.IEnumerator<object> GetEnumerator() |
| | 738 | | { |
| | 739 | | yield return Value1; |
| | 740 | | yield return Value2; |
| | 741 | | yield return Value3; |
| | 742 | | } |
| | 743 | |
|
| | 744 | | /// <summary>Gets the types of the values of this link.</summary> |
| | 745 | | /// <returns>The types of the values of this link.</returns> |
| | 746 | | public Type[] Types() => new[] { typeof(T1), typeof(T2), typeof(T3) }; |
| | 747 | |
|
| | 748 | | /// <inheritdoc/> |
| | 749 | | public StepStatus StepperBreak<TStep>(TStep step = default) |
| | 750 | | where TStep : struct, IFunc<object, StepStatus> |
| | 751 | | { |
| | 752 | | if (step.Invoke(Value1) is Break) return Break; |
| | 753 | | if (step.Invoke(Value2) is Break) return Break; |
| | 754 | | if (step.Invoke(Value3) is Break) return Break; |
| | 755 | | return Continue; |
| | 756 | | } |
| | 757 | |
|
| | 758 | | /// <inheritdoc/> |
| | 759 | | public LinkStruct<T1, T2, T3> Clone() => new(Value1, Value2, Value3); |
| | 760 | |
|
| | 761 | | /// <inheritdoc/> |
| | 762 | | public object[] ToArray() => new object[] { Value1, Value2, Value3 }; |
| | 763 | |
|
| | 764 | | /// <inheritdoc/> |
| | 765 | | public override int GetHashCode() => HashCode.Combine(Value1, Value2, Value3); |
| | 766 | |
|
| | 767 | | /// <inheritdoc/> |
| | 768 | | public override bool Equals(object obj) => |
| | 769 | | obj is LinkStruct<T1, T2, T3> linkStruct && Equals(linkStruct) || |
| | 770 | | obj is Link<T1, T2, T3> link && Equals(link) || |
| | 771 | | obj is ValueTuple<T1, T2, T3> valueTuple && Equals(valueTuple) || |
| | 772 | | obj is Tuple<T1, T2, T3> tuple && Equals(tuple); |
| | 773 | |
|
| | 774 | | /// <summary>Check for equality with another link.</summary> |
| | 775 | | /// <param name="b">The other link to check for equality with.</param> |
| | 776 | | /// <returns>True if equal; false if not.</returns> |
| | 777 | | public bool Equals(LinkStruct<T1, T2, T3> b) => |
| | 778 | | Equate(Value1, b.Value1) && |
| | 779 | | Equate(Value2, b.Value2) && |
| | 780 | | Equate(Value3, b.Value3); |
| | 781 | |
|
| | 782 | | /// <summary>Deconstructs the link.</summary> |
| | 783 | | /// <param name="value1">The #1 value of the link.</param> |
| | 784 | | /// <param name="value2">The #2 value of the link.</param> |
| | 785 | | /// <param name="value3">The #3 value of the link.</param> |
| | 786 | | public void Deconstruct(out T1 value1, out T2 value2, out T3 value3) |
| | 787 | | { |
| | 788 | | value1 = Value1; |
| | 789 | | value2 = Value2; |
| | 790 | | value3 = Value3; |
| | 791 | | } |
| | 792 | |
|
| | 793 | | #endregion |
| | 794 | | } |
| | 795 | |
|
| | 796 | | /// <summary>Represents a link between objects.</summary> |
| | 797 | | /// <typeparam name="T1">The type of #1 value in the link.</typeparam> |
| | 798 | | /// <typeparam name="T2">The type of #2 value in the link.</typeparam> |
| | 799 | | /// <typeparam name="T3">The type of #3 value in the link.</typeparam> |
| | 800 | | /// <typeparam name="T4">The type of #4 value in the link.</typeparam> |
| | 801 | | public class Link<T1, T2, T3, T4> : Link, ICloneable<Link<T1, T2, T3, T4>> |
| | 802 | | { |
| | 803 | | /// <summary>The #1 value of the link.</summary> |
| | 804 | | public T1 Value1 { get; set; } |
| | 805 | | /// <summary>The #2 value of the link.</summary> |
| | 806 | | public T2 Value2 { get; set; } |
| | 807 | | /// <summary>The #3 value of the link.</summary> |
| | 808 | | public T3 Value3 { get; set; } |
| | 809 | | /// <summary>The #4 value of the link.</summary> |
| | 810 | | public T4 Value4 { get; set; } |
| | 811 | |
|
| | 812 | | #region Constructors |
| | 813 | |
|
| | 814 | | /// <summary>Constructs a link of values.</summary> |
| | 815 | | /// <param name="value1">The #1 value to be linked.</param> |
| | 816 | | /// <param name="value2">The #2 value to be linked.</param> |
| | 817 | | /// <param name="value3">The #3 value to be linked.</param> |
| | 818 | | /// <param name="value4">The #4 value to be linked.</param> |
| | 819 | | public Link(T1 value1, T2 value2, T3 value3, T4 value4) |
| | 820 | | { |
| | 821 | | Value1 = value1; |
| | 822 | | Value2 = value2; |
| | 823 | | Value3 = value3; |
| | 824 | | Value4 = value4; |
| | 825 | | } |
| | 826 | |
|
| | 827 | | #endregion |
| | 828 | |
|
| | 829 | | #region Properties |
| | 830 | |
|
| | 831 | | /// <inheritdoc/> |
| | 832 | | public int Size => 4; |
| | 833 | |
|
| | 834 | | /// <inheritdoc/> |
| | 835 | | public object this[int index] |
| | 836 | | { |
| | 837 | | get => index switch |
| | 838 | | { |
| | 839 | | 1 => Value1, |
| | 840 | | 2 => Value2, |
| | 841 | | 3 => Value3, |
| | 842 | | 4 => Value4, |
| | 843 | | _ => throw new IndexOutOfRangeException($"{nameof(index)} < 1 || 4 < {nameof(index)}"), |
| | 844 | | }; |
| | 845 | | } |
| | 846 | |
|
| | 847 | | #endregion |
| | 848 | |
|
| | 849 | | #region Operators |
| | 850 | |
|
| | 851 | | /// <summary>Converts a tuple to a link.</summary> |
| | 852 | | /// <param name="tuple">The tuple to convert to a link.</param> |
| | 853 | | public static implicit operator Link<T1, T2, T3, T4>((T1, T2, T3, T4) tuple) => |
| | 854 | | new(tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4); |
| | 855 | |
|
| | 856 | | /// <summary>Converts a link to a tuple.</summary> |
| | 857 | | /// <param name="link">The link to convert to a tuple.</param> |
| | 858 | | public static implicit operator (T1, T2, T3, T4)(Link<T1, T2, T3, T4> link) => |
| | 859 | | (link.Value1, link.Value2, link.Value3, link.Value4); |
| | 860 | |
|
| | 861 | | /// <summary>Converts a tuple to a link.</summary> |
| | 862 | | /// <param name="tuple">The tuple to convert to a link.</param> |
| | 863 | | public static implicit operator Link<T1, T2, T3, T4>(Tuple<T1, T2, T3, T4> tuple) => |
| | 864 | | new(tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4); |
| | 865 | |
|
| | 866 | | /// <summary>Converts a link to a tuple.</summary> |
| | 867 | | /// <param name="link">The link to convert to a tuple.</param> |
| | 868 | | public static implicit operator Tuple<T1, T2, T3, T4>(Link<T1, T2, T3, T4> link) => |
| | 869 | | new(link.Value1, link.Value2, link.Value3, link.Value4); |
| | 870 | |
|
| | 871 | | /// <summary>Converts a class link to a struct link.</summary> |
| | 872 | | /// <param name="link">The class link to convert to a struct link.</param> |
| | 873 | | public static implicit operator Link<T1, T2, T3, T4>(LinkStruct<T1, T2, T3, T4> link) => |
| | 874 | | new(link.Value1, link.Value2, link.Value3, link.Value4); |
| | 875 | |
|
| | 876 | | #endregion |
| | 877 | |
|
| | 878 | | #region Methods |
| | 879 | |
|
| | 880 | | System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); |
| | 881 | |
|
| | 882 | | /// <inheritdoc/> |
| | 883 | | public System.Collections.Generic.IEnumerator<object> GetEnumerator() |
| | 884 | | { |
| | 885 | | yield return Value1; |
| | 886 | | yield return Value2; |
| | 887 | | yield return Value3; |
| | 888 | | yield return Value4; |
| | 889 | | } |
| | 890 | |
|
| | 891 | | /// <summary>Gets the types of the values of this link.</summary> |
| | 892 | | /// <returns>The types of the values of this link.</returns> |
| | 893 | | public Type[] Types() => new[] { typeof(T1), typeof(T2), typeof(T3), typeof(T4) }; |
| | 894 | |
|
| | 895 | | /// <inheritdoc/> |
| | 896 | | public StepStatus StepperBreak<TStep>(TStep step = default) |
| | 897 | | where TStep : struct, IFunc<object, StepStatus> |
| | 898 | | { |
| | 899 | | if (step.Invoke(Value1) is Break) return Break; |
| | 900 | | if (step.Invoke(Value2) is Break) return Break; |
| | 901 | | if (step.Invoke(Value3) is Break) return Break; |
| | 902 | | if (step.Invoke(Value4) is Break) return Break; |
| | 903 | | return Continue; |
| | 904 | | } |
| | 905 | |
|
| | 906 | | /// <inheritdoc/> |
| | 907 | | public Link<T1, T2, T3, T4> Clone() => new(Value1, Value2, Value3, Value4); |
| | 908 | |
|
| | 909 | | /// <inheritdoc/> |
| | 910 | | public object[] ToArray() => new object[] { Value1, Value2, Value3, Value4 }; |
| | 911 | |
|
| | 912 | | /// <inheritdoc/> |
| | 913 | | public override int GetHashCode() => HashCode.Combine(Value1, Value2, Value3, Value4); |
| | 914 | |
|
| | 915 | | /// <inheritdoc/> |
| | 916 | | public override bool Equals(object obj) => |
| | 917 | | obj is LinkStruct<T1, T2, T3, T4> linkStruct && Equals(linkStruct) || |
| | 918 | | obj is Link<T1, T2, T3, T4> link && Equals(link) || |
| | 919 | | obj is ValueTuple<T1, T2, T3, T4> valueTuple && Equals(valueTuple) || |
| | 920 | | obj is Tuple<T1, T2, T3, T4> tuple && Equals(tuple); |
| | 921 | |
|
| | 922 | | /// <summary>Check for equality with another link.</summary> |
| | 923 | | /// <param name="b">The other link to check for equality with.</param> |
| | 924 | | /// <returns>True if equal; false if not.</returns> |
| | 925 | | public bool Equals(Link<T1, T2, T3, T4> b) => |
| | 926 | | Equate(Value1, b.Value1) && |
| | 927 | | Equate(Value2, b.Value2) && |
| | 928 | | Equate(Value3, b.Value3) && |
| | 929 | | Equate(Value4, b.Value4); |
| | 930 | |
|
| | 931 | | /// <summary>Deconstructs the link.</summary> |
| | 932 | | /// <param name="value1">The #1 value of the link.</param> |
| | 933 | | /// <param name="value2">The #2 value of the link.</param> |
| | 934 | | /// <param name="value3">The #3 value of the link.</param> |
| | 935 | | /// <param name="value4">The #4 value of the link.</param> |
| | 936 | | public void Deconstruct(out T1 value1, out T2 value2, out T3 value3, out T4 value4) |
| | 937 | | { |
| | 938 | | value1 = Value1; |
| | 939 | | value2 = Value2; |
| | 940 | | value3 = Value3; |
| | 941 | | value4 = Value4; |
| | 942 | | } |
| | 943 | |
|
| | 944 | | #endregion |
| | 945 | | } |
| | 946 | |
|
| | 947 | | /// <summary>Represents a link between objects.</summary> |
| | 948 | | /// <typeparam name="T1">The type of #1 value in the link.</typeparam> |
| | 949 | | /// <typeparam name="T2">The type of #2 value in the link.</typeparam> |
| | 950 | | /// <typeparam name="T3">The type of #3 value in the link.</typeparam> |
| | 951 | | /// <typeparam name="T4">The type of #4 value in the link.</typeparam> |
| | 952 | | public struct LinkStruct<T1, T2, T3, T4> : Link, ICloneable<LinkStruct<T1, T2, T3, T4>> |
| | 953 | | { |
| | 954 | | /// <summary>The #1 value of the link.</summary> |
| | 955 | | public T1 Value1 { get; set; } |
| | 956 | | /// <summary>The #2 value of the link.</summary> |
| | 957 | | public T2 Value2 { get; set; } |
| | 958 | | /// <summary>The #3 value of the link.</summary> |
| | 959 | | public T3 Value3 { get; set; } |
| | 960 | | /// <summary>The #4 value of the link.</summary> |
| | 961 | | public T4 Value4 { get; set; } |
| | 962 | |
|
| | 963 | | #region Constructors |
| | 964 | |
|
| | 965 | | /// <summary>Creates a link between objects.</summary> |
| | 966 | | /// <param name="value1">The #1 value to be linked.</param> |
| | 967 | | /// <param name="value2">The #2 value to be linked.</param> |
| | 968 | | /// <param name="value3">The #3 value to be linked.</param> |
| | 969 | | /// <param name="value4">The #4 value to be linked.</param> |
| | 970 | | public LinkStruct(T1 value1, T2 value2, T3 value3, T4 value4) |
| | 971 | | { |
| | 972 | | Value1 = value1; |
| | 973 | | Value2 = value2; |
| | 974 | | Value3 = value3; |
| | 975 | | Value4 = value4; |
| | 976 | | } |
| | 977 | |
|
| | 978 | | #endregion |
| | 979 | |
|
| | 980 | | #region Properties |
| | 981 | |
|
| | 982 | | /// <inheritdoc/> |
| | 983 | | public int Size => 4; |
| | 984 | |
|
| | 985 | | /// <inheritdoc/> |
| | 986 | | public object this[int index] |
| | 987 | | { |
| | 988 | | get => index switch |
| | 989 | | { |
| | 990 | | 1 => Value1, |
| | 991 | | 2 => Value2, |
| | 992 | | 3 => Value3, |
| | 993 | | 4 => Value4, |
| | 994 | | _ => throw new IndexOutOfRangeException($"{nameof(index)} < 1 || 4 < {nameof(index)}"), |
| | 995 | | }; |
| | 996 | | } |
| | 997 | |
|
| | 998 | | #endregion |
| | 999 | |
|
| | 1000 | | #region Operators |
| | 1001 | |
|
| | 1002 | | /// <summary>Converts a tuple to a link.</summary> |
| | 1003 | | /// <param name="tuple">The tuple to convert to a link.</param> |
| | 1004 | | public static implicit operator LinkStruct<T1, T2, T3, T4>((T1, T2, T3, T4) tuple) => |
| | 1005 | | new(tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4); |
| | 1006 | |
|
| | 1007 | | /// <summary>Converts a link to a tuple.</summary> |
| | 1008 | | /// <param name="link">The link to convert to a tuple.</param> |
| | 1009 | | public static implicit operator (T1, T2, T3, T4)(LinkStruct<T1, T2, T3, T4> link) => |
| | 1010 | | (link.Value1, link.Value2, link.Value3, link.Value4); |
| | 1011 | |
|
| | 1012 | | /// <summary>Converts a tuple to a link.</summary> |
| | 1013 | | /// <param name="tuple">The tuple to convert to a link.</param> |
| | 1014 | | public static implicit operator LinkStruct<T1, T2, T3, T4>(Tuple<T1, T2, T3, T4> tuple) => |
| | 1015 | | new(tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4); |
| | 1016 | |
|
| | 1017 | | /// <summary>Converts a link to a tuple.</summary> |
| | 1018 | | /// <param name="link">The link to convert to a tuple.</param> |
| | 1019 | | public static implicit operator Tuple<T1, T2, T3, T4>(LinkStruct<T1, T2, T3, T4> link) => |
| | 1020 | | new(link.Value1, link.Value2, link.Value3, link.Value4); |
| | 1021 | |
|
| | 1022 | | /// <summary>Converts a class link to a struct link.</summary> |
| | 1023 | | /// <param name="link">The class link to convert to a struct link.</param> |
| | 1024 | | public static implicit operator LinkStruct<T1, T2, T3, T4>(Link<T1, T2, T3, T4> link) => |
| | 1025 | | new(link.Value1, link.Value2, link.Value3, link.Value4); |
| | 1026 | |
|
| | 1027 | | #endregion |
| | 1028 | |
|
| | 1029 | | #region Methods |
| | 1030 | |
|
| | 1031 | | System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); |
| | 1032 | |
|
| | 1033 | | /// <inheritdoc/> |
| | 1034 | | public System.Collections.Generic.IEnumerator<object> GetEnumerator() |
| | 1035 | | { |
| | 1036 | | yield return Value1; |
| | 1037 | | yield return Value2; |
| | 1038 | | yield return Value3; |
| | 1039 | | yield return Value4; |
| | 1040 | | } |
| | 1041 | |
|
| | 1042 | | /// <summary>Gets the types of the values of this link.</summary> |
| | 1043 | | /// <returns>The types of the values of this link.</returns> |
| | 1044 | | public Type[] Types() => new[] { typeof(T1), typeof(T2), typeof(T3), typeof(T4) }; |
| | 1045 | |
|
| | 1046 | | /// <inheritdoc/> |
| | 1047 | | public StepStatus StepperBreak<TStep>(TStep step = default) |
| | 1048 | | where TStep : struct, IFunc<object, StepStatus> |
| | 1049 | | { |
| | 1050 | | if (step.Invoke(Value1) is Break) return Break; |
| | 1051 | | if (step.Invoke(Value2) is Break) return Break; |
| | 1052 | | if (step.Invoke(Value3) is Break) return Break; |
| | 1053 | | if (step.Invoke(Value4) is Break) return Break; |
| | 1054 | | return Continue; |
| | 1055 | | } |
| | 1056 | |
|
| | 1057 | | /// <inheritdoc/> |
| | 1058 | | public LinkStruct<T1, T2, T3, T4> Clone() => new(Value1, Value2, Value3, Value4); |
| | 1059 | |
|
| | 1060 | | /// <inheritdoc/> |
| | 1061 | | public object[] ToArray() => new object[] { Value1, Value2, Value3, Value4 }; |
| | 1062 | |
|
| | 1063 | | /// <inheritdoc/> |
| | 1064 | | public override int GetHashCode() => HashCode.Combine(Value1, Value2, Value3, Value4); |
| | 1065 | |
|
| | 1066 | | /// <inheritdoc/> |
| | 1067 | | public override bool Equals(object obj) => |
| | 1068 | | obj is LinkStruct<T1, T2, T3, T4> linkStruct && Equals(linkStruct) || |
| | 1069 | | obj is Link<T1, T2, T3, T4> link && Equals(link) || |
| | 1070 | | obj is ValueTuple<T1, T2, T3, T4> valueTuple && Equals(valueTuple) || |
| | 1071 | | obj is Tuple<T1, T2, T3, T4> tuple && Equals(tuple); |
| | 1072 | |
|
| | 1073 | | /// <summary>Check for equality with another link.</summary> |
| | 1074 | | /// <param name="b">The other link to check for equality with.</param> |
| | 1075 | | /// <returns>True if equal; false if not.</returns> |
| | 1076 | | public bool Equals(LinkStruct<T1, T2, T3, T4> b) => |
| | 1077 | | Equate(Value1, b.Value1) && |
| | 1078 | | Equate(Value2, b.Value2) && |
| | 1079 | | Equate(Value3, b.Value3) && |
| | 1080 | | Equate(Value4, b.Value4); |
| | 1081 | |
|
| | 1082 | | /// <summary>Deconstructs the link.</summary> |
| | 1083 | | /// <param name="value1">The #1 value of the link.</param> |
| | 1084 | | /// <param name="value2">The #2 value of the link.</param> |
| | 1085 | | /// <param name="value3">The #3 value of the link.</param> |
| | 1086 | | /// <param name="value4">The #4 value of the link.</param> |
| | 1087 | | public void Deconstruct(out T1 value1, out T2 value2, out T3 value3, out T4 value4) |
| | 1088 | | { |
| | 1089 | | value1 = Value1; |
| | 1090 | | value2 = Value2; |
| | 1091 | | value3 = Value3; |
| | 1092 | | value4 = Value4; |
| | 1093 | | } |
| | 1094 | |
|
| | 1095 | | #endregion |
| | 1096 | | } |
| | 1097 | |
|
| | 1098 | | /// <summary>Represents a link between objects.</summary> |
| | 1099 | | /// <typeparam name="T1">The type of #1 value in the link.</typeparam> |
| | 1100 | | /// <typeparam name="T2">The type of #2 value in the link.</typeparam> |
| | 1101 | | /// <typeparam name="T3">The type of #3 value in the link.</typeparam> |
| | 1102 | | /// <typeparam name="T4">The type of #4 value in the link.</typeparam> |
| | 1103 | | /// <typeparam name="T5">The type of #5 value in the link.</typeparam> |
| | 1104 | | public class Link<T1, T2, T3, T4, T5> : Link, ICloneable<Link<T1, T2, T3, T4, T5>> |
| | 1105 | | { |
| | 1106 | | /// <summary>The #1 value of the link.</summary> |
| | 1107 | | public T1 Value1 { get; set; } |
| | 1108 | | /// <summary>The #2 value of the link.</summary> |
| | 1109 | | public T2 Value2 { get; set; } |
| | 1110 | | /// <summary>The #3 value of the link.</summary> |
| | 1111 | | public T3 Value3 { get; set; } |
| | 1112 | | /// <summary>The #4 value of the link.</summary> |
| | 1113 | | public T4 Value4 { get; set; } |
| | 1114 | | /// <summary>The #5 value of the link.</summary> |
| | 1115 | | public T5 Value5 { get; set; } |
| | 1116 | |
|
| | 1117 | | #region Constructors |
| | 1118 | |
|
| | 1119 | | /// <summary>Constructs a link of values.</summary> |
| | 1120 | | /// <param name="value1">The #1 value to be linked.</param> |
| | 1121 | | /// <param name="value2">The #2 value to be linked.</param> |
| | 1122 | | /// <param name="value3">The #3 value to be linked.</param> |
| | 1123 | | /// <param name="value4">The #4 value to be linked.</param> |
| | 1124 | | /// <param name="value5">The #5 value to be linked.</param> |
| | 1125 | | public Link(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5) |
| | 1126 | | { |
| | 1127 | | Value1 = value1; |
| | 1128 | | Value2 = value2; |
| | 1129 | | Value3 = value3; |
| | 1130 | | Value4 = value4; |
| | 1131 | | Value5 = value5; |
| | 1132 | | } |
| | 1133 | |
|
| | 1134 | | #endregion |
| | 1135 | |
|
| | 1136 | | #region Properties |
| | 1137 | |
|
| | 1138 | | /// <inheritdoc/> |
| | 1139 | | public int Size => 5; |
| | 1140 | |
|
| | 1141 | | /// <inheritdoc/> |
| | 1142 | | public object this[int index] |
| | 1143 | | { |
| | 1144 | | get => index switch |
| | 1145 | | { |
| | 1146 | | 1 => Value1, |
| | 1147 | | 2 => Value2, |
| | 1148 | | 3 => Value3, |
| | 1149 | | 4 => Value4, |
| | 1150 | | 5 => Value5, |
| | 1151 | | _ => throw new IndexOutOfRangeException($"{nameof(index)} < 1 || 5 < {nameof(index)}"), |
| | 1152 | | }; |
| | 1153 | | } |
| | 1154 | |
|
| | 1155 | | #endregion |
| | 1156 | |
|
| | 1157 | | #region Operators |
| | 1158 | |
|
| | 1159 | | /// <summary>Converts a tuple to a link.</summary> |
| | 1160 | | /// <param name="tuple">The tuple to convert to a link.</param> |
| | 1161 | | public static implicit operator Link<T1, T2, T3, T4, T5>((T1, T2, T3, T4, T5) tuple) => |
| | 1162 | | new(tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4, tuple.Item5); |
| | 1163 | |
|
| | 1164 | | /// <summary>Converts a link to a tuple.</summary> |
| | 1165 | | /// <param name="link">The link to convert to a tuple.</param> |
| | 1166 | | public static implicit operator (T1, T2, T3, T4, T5)(Link<T1, T2, T3, T4, T5> link) => |
| | 1167 | | (link.Value1, link.Value2, link.Value3, link.Value4, link.Value5); |
| | 1168 | |
|
| | 1169 | | /// <summary>Converts a tuple to a link.</summary> |
| | 1170 | | /// <param name="tuple">The tuple to convert to a link.</param> |
| | 1171 | | public static implicit operator Link<T1, T2, T3, T4, T5>(Tuple<T1, T2, T3, T4, T5> tuple) => |
| | 1172 | | new(tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4, tuple.Item5); |
| | 1173 | |
|
| | 1174 | | /// <summary>Converts a link to a tuple.</summary> |
| | 1175 | | /// <param name="link">The link to convert to a tuple.</param> |
| | 1176 | | public static implicit operator Tuple<T1, T2, T3, T4, T5>(Link<T1, T2, T3, T4, T5> link) => |
| | 1177 | | new(link.Value1, link.Value2, link.Value3, link.Value4, link.Value5); |
| | 1178 | |
|
| | 1179 | | /// <summary>Converts a class link to a struct link.</summary> |
| | 1180 | | /// <param name="link">The class link to convert to a struct link.</param> |
| | 1181 | | public static implicit operator Link<T1, T2, T3, T4, T5>(LinkStruct<T1, T2, T3, T4, T5> link) => |
| | 1182 | | new(link.Value1, link.Value2, link.Value3, link.Value4, link.Value5); |
| | 1183 | |
|
| | 1184 | | #endregion |
| | 1185 | |
|
| | 1186 | | #region Methods |
| | 1187 | |
|
| | 1188 | | System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); |
| | 1189 | |
|
| | 1190 | | /// <inheritdoc/> |
| | 1191 | | public System.Collections.Generic.IEnumerator<object> GetEnumerator() |
| | 1192 | | { |
| | 1193 | | yield return Value1; |
| | 1194 | | yield return Value2; |
| | 1195 | | yield return Value3; |
| | 1196 | | yield return Value4; |
| | 1197 | | yield return Value5; |
| | 1198 | | } |
| | 1199 | |
|
| | 1200 | | /// <summary>Gets the types of the values of this link.</summary> |
| | 1201 | | /// <returns>The types of the values of this link.</returns> |
| | 1202 | | public Type[] Types() => new[] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5) }; |
| | 1203 | |
|
| | 1204 | | /// <inheritdoc/> |
| | 1205 | | public StepStatus StepperBreak<TStep>(TStep step = default) |
| | 1206 | | where TStep : struct, IFunc<object, StepStatus> |
| | 1207 | | { |
| | 1208 | | if (step.Invoke(Value1) is Break) return Break; |
| | 1209 | | if (step.Invoke(Value2) is Break) return Break; |
| | 1210 | | if (step.Invoke(Value3) is Break) return Break; |
| | 1211 | | if (step.Invoke(Value4) is Break) return Break; |
| | 1212 | | if (step.Invoke(Value5) is Break) return Break; |
| | 1213 | | return Continue; |
| | 1214 | | } |
| | 1215 | |
|
| | 1216 | | /// <inheritdoc/> |
| | 1217 | | public Link<T1, T2, T3, T4, T5> Clone() => new(Value1, Value2, Value3, Value4, Value5); |
| | 1218 | |
|
| | 1219 | | /// <inheritdoc/> |
| | 1220 | | public object[] ToArray() => new object[] { Value1, Value2, Value3, Value4, Value5 }; |
| | 1221 | |
|
| | 1222 | | /// <inheritdoc/> |
| | 1223 | | public override int GetHashCode() => HashCode.Combine(Value1, Value2, Value3, Value4, Value5); |
| | 1224 | |
|
| | 1225 | | /// <inheritdoc/> |
| | 1226 | | public override bool Equals(object obj) => |
| | 1227 | | obj is LinkStruct<T1, T2, T3, T4, T5> linkStruct && Equals(linkStruct) || |
| | 1228 | | obj is Link<T1, T2, T3, T4, T5> link && Equals(link) || |
| | 1229 | | obj is ValueTuple<T1, T2, T3, T4, T5> valueTuple && Equals(valueTuple) || |
| | 1230 | | obj is Tuple<T1, T2, T3, T4, T5> tuple && Equals(tuple); |
| | 1231 | |
|
| | 1232 | | /// <summary>Check for equality with another link.</summary> |
| | 1233 | | /// <param name="b">The other link to check for equality with.</param> |
| | 1234 | | /// <returns>True if equal; false if not.</returns> |
| | 1235 | | public bool Equals(Link<T1, T2, T3, T4, T5> b) => |
| | 1236 | | Equate(Value1, b.Value1) && |
| | 1237 | | Equate(Value2, b.Value2) && |
| | 1238 | | Equate(Value3, b.Value3) && |
| | 1239 | | Equate(Value4, b.Value4) && |
| | 1240 | | Equate(Value5, b.Value5); |
| | 1241 | |
|
| | 1242 | | /// <summary>Deconstructs the link.</summary> |
| | 1243 | | /// <param name="value1">The #1 value of the link.</param> |
| | 1244 | | /// <param name="value2">The #2 value of the link.</param> |
| | 1245 | | /// <param name="value3">The #3 value of the link.</param> |
| | 1246 | | /// <param name="value4">The #4 value of the link.</param> |
| | 1247 | | /// <param name="value5">The #5 value of the link.</param> |
| | 1248 | | public void Deconstruct(out T1 value1, out T2 value2, out T3 value3, out T4 value4, out T5 value5) |
| | 1249 | | { |
| | 1250 | | value1 = Value1; |
| | 1251 | | value2 = Value2; |
| | 1252 | | value3 = Value3; |
| | 1253 | | value4 = Value4; |
| | 1254 | | value5 = Value5; |
| | 1255 | | } |
| | 1256 | |
|
| | 1257 | | #endregion |
| | 1258 | | } |
| | 1259 | |
|
| | 1260 | | /// <summary>Represents a link between objects.</summary> |
| | 1261 | | /// <typeparam name="T1">The type of #1 value in the link.</typeparam> |
| | 1262 | | /// <typeparam name="T2">The type of #2 value in the link.</typeparam> |
| | 1263 | | /// <typeparam name="T3">The type of #3 value in the link.</typeparam> |
| | 1264 | | /// <typeparam name="T4">The type of #4 value in the link.</typeparam> |
| | 1265 | | /// <typeparam name="T5">The type of #5 value in the link.</typeparam> |
| | 1266 | | public struct LinkStruct<T1, T2, T3, T4, T5> : Link, ICloneable<LinkStruct<T1, T2, T3, T4, T5>> |
| | 1267 | | { |
| | 1268 | | /// <summary>The #1 value of the link.</summary> |
| | 1269 | | public T1 Value1 { get; set; } |
| | 1270 | | /// <summary>The #2 value of the link.</summary> |
| | 1271 | | public T2 Value2 { get; set; } |
| | 1272 | | /// <summary>The #3 value of the link.</summary> |
| | 1273 | | public T3 Value3 { get; set; } |
| | 1274 | | /// <summary>The #4 value of the link.</summary> |
| | 1275 | | public T4 Value4 { get; set; } |
| | 1276 | | /// <summary>The #5 value of the link.</summary> |
| | 1277 | | public T5 Value5 { get; set; } |
| | 1278 | |
|
| | 1279 | | #region Constructors |
| | 1280 | |
|
| | 1281 | | /// <summary>Creates a link between objects.</summary> |
| | 1282 | | /// <param name="value1">The #1 value to be linked.</param> |
| | 1283 | | /// <param name="value2">The #2 value to be linked.</param> |
| | 1284 | | /// <param name="value3">The #3 value to be linked.</param> |
| | 1285 | | /// <param name="value4">The #4 value to be linked.</param> |
| | 1286 | | /// <param name="value5">The #5 value to be linked.</param> |
| | 1287 | | public LinkStruct(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5) |
| | 1288 | | { |
| | 1289 | | Value1 = value1; |
| | 1290 | | Value2 = value2; |
| | 1291 | | Value3 = value3; |
| | 1292 | | Value4 = value4; |
| | 1293 | | Value5 = value5; |
| | 1294 | | } |
| | 1295 | |
|
| | 1296 | | #endregion |
| | 1297 | |
|
| | 1298 | | #region Properties |
| | 1299 | |
|
| | 1300 | | /// <inheritdoc/> |
| | 1301 | | public int Size => 5; |
| | 1302 | |
|
| | 1303 | | /// <inheritdoc/> |
| | 1304 | | public object this[int index] |
| | 1305 | | { |
| | 1306 | | get => index switch |
| | 1307 | | { |
| | 1308 | | 1 => Value1, |
| | 1309 | | 2 => Value2, |
| | 1310 | | 3 => Value3, |
| | 1311 | | 4 => Value4, |
| | 1312 | | 5 => Value5, |
| | 1313 | | _ => throw new IndexOutOfRangeException($"{nameof(index)} < 1 || 5 < {nameof(index)}"), |
| | 1314 | | }; |
| | 1315 | | } |
| | 1316 | |
|
| | 1317 | | #endregion |
| | 1318 | |
|
| | 1319 | | #region Operators |
| | 1320 | |
|
| | 1321 | | /// <summary>Converts a tuple to a link.</summary> |
| | 1322 | | /// <param name="tuple">The tuple to convert to a link.</param> |
| | 1323 | | public static implicit operator LinkStruct<T1, T2, T3, T4, T5>((T1, T2, T3, T4, T5) tuple) => |
| | 1324 | | new(tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4, tuple.Item5); |
| | 1325 | |
|
| | 1326 | | /// <summary>Converts a link to a tuple.</summary> |
| | 1327 | | /// <param name="link">The link to convert to a tuple.</param> |
| | 1328 | | public static implicit operator (T1, T2, T3, T4, T5)(LinkStruct<T1, T2, T3, T4, T5> link) => |
| | 1329 | | (link.Value1, link.Value2, link.Value3, link.Value4, link.Value5); |
| | 1330 | |
|
| | 1331 | | /// <summary>Converts a tuple to a link.</summary> |
| | 1332 | | /// <param name="tuple">The tuple to convert to a link.</param> |
| | 1333 | | public static implicit operator LinkStruct<T1, T2, T3, T4, T5>(Tuple<T1, T2, T3, T4, T5> tuple) => |
| | 1334 | | new(tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4, tuple.Item5); |
| | 1335 | |
|
| | 1336 | | /// <summary>Converts a link to a tuple.</summary> |
| | 1337 | | /// <param name="link">The link to convert to a tuple.</param> |
| | 1338 | | public static implicit operator Tuple<T1, T2, T3, T4, T5>(LinkStruct<T1, T2, T3, T4, T5> link) => |
| | 1339 | | new(link.Value1, link.Value2, link.Value3, link.Value4, link.Value5); |
| | 1340 | |
|
| | 1341 | | /// <summary>Converts a class link to a struct link.</summary> |
| | 1342 | | /// <param name="link">The class link to convert to a struct link.</param> |
| | 1343 | | public static implicit operator LinkStruct<T1, T2, T3, T4, T5>(Link<T1, T2, T3, T4, T5> link) => |
| | 1344 | | new(link.Value1, link.Value2, link.Value3, link.Value4, link.Value5); |
| | 1345 | |
|
| | 1346 | | #endregion |
| | 1347 | |
|
| | 1348 | | #region Methods |
| | 1349 | |
|
| | 1350 | | System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); |
| | 1351 | |
|
| | 1352 | | /// <inheritdoc/> |
| | 1353 | | public System.Collections.Generic.IEnumerator<object> GetEnumerator() |
| | 1354 | | { |
| | 1355 | | yield return Value1; |
| | 1356 | | yield return Value2; |
| | 1357 | | yield return Value3; |
| | 1358 | | yield return Value4; |
| | 1359 | | yield return Value5; |
| | 1360 | | } |
| | 1361 | |
|
| | 1362 | | /// <summary>Gets the types of the values of this link.</summary> |
| | 1363 | | /// <returns>The types of the values of this link.</returns> |
| | 1364 | | public Type[] Types() => new[] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5) }; |
| | 1365 | |
|
| | 1366 | | /// <inheritdoc/> |
| | 1367 | | public StepStatus StepperBreak<TStep>(TStep step = default) |
| | 1368 | | where TStep : struct, IFunc<object, StepStatus> |
| | 1369 | | { |
| | 1370 | | if (step.Invoke(Value1) is Break) return Break; |
| | 1371 | | if (step.Invoke(Value2) is Break) return Break; |
| | 1372 | | if (step.Invoke(Value3) is Break) return Break; |
| | 1373 | | if (step.Invoke(Value4) is Break) return Break; |
| | 1374 | | if (step.Invoke(Value5) is Break) return Break; |
| | 1375 | | return Continue; |
| | 1376 | | } |
| | 1377 | |
|
| | 1378 | | /// <inheritdoc/> |
| | 1379 | | public LinkStruct<T1, T2, T3, T4, T5> Clone() => new(Value1, Value2, Value3, Value4, Value5); |
| | 1380 | |
|
| | 1381 | | /// <inheritdoc/> |
| | 1382 | | public object[] ToArray() => new object[] { Value1, Value2, Value3, Value4, Value5 }; |
| | 1383 | |
|
| | 1384 | | /// <inheritdoc/> |
| | 1385 | | public override int GetHashCode() => HashCode.Combine(Value1, Value2, Value3, Value4, Value5); |
| | 1386 | |
|
| | 1387 | | /// <inheritdoc/> |
| | 1388 | | public override bool Equals(object obj) => |
| | 1389 | | obj is LinkStruct<T1, T2, T3, T4, T5> linkStruct && Equals(linkStruct) || |
| | 1390 | | obj is Link<T1, T2, T3, T4, T5> link && Equals(link) || |
| | 1391 | | obj is ValueTuple<T1, T2, T3, T4, T5> valueTuple && Equals(valueTuple) || |
| | 1392 | | obj is Tuple<T1, T2, T3, T4, T5> tuple && Equals(tuple); |
| | 1393 | |
|
| | 1394 | | /// <summary>Check for equality with another link.</summary> |
| | 1395 | | /// <param name="b">The other link to check for equality with.</param> |
| | 1396 | | /// <returns>True if equal; false if not.</returns> |
| | 1397 | | public bool Equals(LinkStruct<T1, T2, T3, T4, T5> b) => |
| | 1398 | | Equate(Value1, b.Value1) && |
| | 1399 | | Equate(Value2, b.Value2) && |
| | 1400 | | Equate(Value3, b.Value3) && |
| | 1401 | | Equate(Value4, b.Value4) && |
| | 1402 | | Equate(Value5, b.Value5); |
| | 1403 | |
|
| | 1404 | | /// <summary>Deconstructs the link.</summary> |
| | 1405 | | /// <param name="value1">The #1 value of the link.</param> |
| | 1406 | | /// <param name="value2">The #2 value of the link.</param> |
| | 1407 | | /// <param name="value3">The #3 value of the link.</param> |
| | 1408 | | /// <param name="value4">The #4 value of the link.</param> |
| | 1409 | | /// <param name="value5">The #5 value of the link.</param> |
| | 1410 | | public void Deconstruct(out T1 value1, out T2 value2, out T3 value3, out T4 value4, out T5 value5) |
| | 1411 | | { |
| | 1412 | | value1 = Value1; |
| | 1413 | | value2 = Value2; |
| | 1414 | | value3 = Value3; |
| | 1415 | | value4 = Value4; |
| | 1416 | | value5 = Value5; |
| | 1417 | | } |
| | 1418 | |
|
| | 1419 | | #endregion |
| | 1420 | | } |
| | 1421 | |
|
| | 1422 | | /// <summary>Represents a link between objects.</summary> |
| | 1423 | | /// <typeparam name="T1">The type of #1 value in the link.</typeparam> |
| | 1424 | | /// <typeparam name="T2">The type of #2 value in the link.</typeparam> |
| | 1425 | | /// <typeparam name="T3">The type of #3 value in the link.</typeparam> |
| | 1426 | | /// <typeparam name="T4">The type of #4 value in the link.</typeparam> |
| | 1427 | | /// <typeparam name="T5">The type of #5 value in the link.</typeparam> |
| | 1428 | | /// <typeparam name="T6">The type of #6 value in the link.</typeparam> |
| | 1429 | | public class Link<T1, T2, T3, T4, T5, T6> : Link, ICloneable<Link<T1, T2, T3, T4, T5, T6>> |
| | 1430 | | { |
| | 1431 | | /// <summary>The #1 value of the link.</summary> |
| | 1432 | | public T1 Value1 { get; set; } |
| | 1433 | | /// <summary>The #2 value of the link.</summary> |
| | 1434 | | public T2 Value2 { get; set; } |
| | 1435 | | /// <summary>The #3 value of the link.</summary> |
| | 1436 | | public T3 Value3 { get; set; } |
| | 1437 | | /// <summary>The #4 value of the link.</summary> |
| | 1438 | | public T4 Value4 { get; set; } |
| | 1439 | | /// <summary>The #5 value of the link.</summary> |
| | 1440 | | public T5 Value5 { get; set; } |
| | 1441 | | /// <summary>The #6 value of the link.</summary> |
| | 1442 | | public T6 Value6 { get; set; } |
| | 1443 | |
|
| | 1444 | | #region Constructors |
| | 1445 | |
|
| | 1446 | | /// <summary>Constructs a link of values.</summary> |
| | 1447 | | /// <param name="value1">The #1 value to be linked.</param> |
| | 1448 | | /// <param name="value2">The #2 value to be linked.</param> |
| | 1449 | | /// <param name="value3">The #3 value to be linked.</param> |
| | 1450 | | /// <param name="value4">The #4 value to be linked.</param> |
| | 1451 | | /// <param name="value5">The #5 value to be linked.</param> |
| | 1452 | | /// <param name="value6">The #6 value to be linked.</param> |
| | 1453 | | public Link(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6) |
| | 1454 | | { |
| | 1455 | | Value1 = value1; |
| | 1456 | | Value2 = value2; |
| | 1457 | | Value3 = value3; |
| | 1458 | | Value4 = value4; |
| | 1459 | | Value5 = value5; |
| | 1460 | | Value6 = value6; |
| | 1461 | | } |
| | 1462 | |
|
| | 1463 | | #endregion |
| | 1464 | |
|
| | 1465 | | #region Properties |
| | 1466 | |
|
| | 1467 | | /// <inheritdoc/> |
| | 1468 | | public int Size => 6; |
| | 1469 | |
|
| | 1470 | | /// <inheritdoc/> |
| | 1471 | | public object this[int index] |
| | 1472 | | { |
| | 1473 | | get => index switch |
| | 1474 | | { |
| | 1475 | | 1 => Value1, |
| | 1476 | | 2 => Value2, |
| | 1477 | | 3 => Value3, |
| | 1478 | | 4 => Value4, |
| | 1479 | | 5 => Value5, |
| | 1480 | | 6 => Value6, |
| | 1481 | | _ => throw new IndexOutOfRangeException($"{nameof(index)} < 1 || 6 < {nameof(index)}"), |
| | 1482 | | }; |
| | 1483 | | } |
| | 1484 | |
|
| | 1485 | | #endregion |
| | 1486 | |
|
| | 1487 | | #region Operators |
| | 1488 | |
|
| | 1489 | | /// <summary>Converts a tuple to a link.</summary> |
| | 1490 | | /// <param name="tuple">The tuple to convert to a link.</param> |
| | 1491 | | public static implicit operator Link<T1, T2, T3, T4, T5, T6>((T1, T2, T3, T4, T5, T6) tuple) => |
| | 1492 | | new(tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4, tuple.Item5, tuple.Item6); |
| | 1493 | |
|
| | 1494 | | /// <summary>Converts a link to a tuple.</summary> |
| | 1495 | | /// <param name="link">The link to convert to a tuple.</param> |
| | 1496 | | public static implicit operator (T1, T2, T3, T4, T5, T6)(Link<T1, T2, T3, T4, T5, T6> link) => |
| | 1497 | | (link.Value1, link.Value2, link.Value3, link.Value4, link.Value5, link.Value6); |
| | 1498 | |
|
| | 1499 | | /// <summary>Converts a tuple to a link.</summary> |
| | 1500 | | /// <param name="tuple">The tuple to convert to a link.</param> |
| | 1501 | | public static implicit operator Link<T1, T2, T3, T4, T5, T6>(Tuple<T1, T2, T3, T4, T5, T6> tuple) => |
| | 1502 | | new(tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4, tuple.Item5, tuple.Item6); |
| | 1503 | |
|
| | 1504 | | /// <summary>Converts a link to a tuple.</summary> |
| | 1505 | | /// <param name="link">The link to convert to a tuple.</param> |
| | 1506 | | public static implicit operator Tuple<T1, T2, T3, T4, T5, T6>(Link<T1, T2, T3, T4, T5, T6> link) => |
| | 1507 | | new(link.Value1, link.Value2, link.Value3, link.Value4, link.Value5, link.Value6); |
| | 1508 | |
|
| | 1509 | | /// <summary>Converts a class link to a struct link.</summary> |
| | 1510 | | /// <param name="link">The class link to convert to a struct link.</param> |
| | 1511 | | public static implicit operator Link<T1, T2, T3, T4, T5, T6>(LinkStruct<T1, T2, T3, T4, T5, T6> link) => |
| | 1512 | | new(link.Value1, link.Value2, link.Value3, link.Value4, link.Value5, link.Value6); |
| | 1513 | |
|
| | 1514 | | #endregion |
| | 1515 | |
|
| | 1516 | | #region Methods |
| | 1517 | |
|
| | 1518 | | System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); |
| | 1519 | |
|
| | 1520 | | /// <inheritdoc/> |
| | 1521 | | public System.Collections.Generic.IEnumerator<object> GetEnumerator() |
| | 1522 | | { |
| | 1523 | | yield return Value1; |
| | 1524 | | yield return Value2; |
| | 1525 | | yield return Value3; |
| | 1526 | | yield return Value4; |
| | 1527 | | yield return Value5; |
| | 1528 | | yield return Value6; |
| | 1529 | | } |
| | 1530 | |
|
| | 1531 | | /// <summary>Gets the types of the values of this link.</summary> |
| | 1532 | | /// <returns>The types of the values of this link.</returns> |
| | 1533 | | public Type[] Types() => new[] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6) }; |
| | 1534 | |
|
| | 1535 | | /// <inheritdoc/> |
| | 1536 | | public StepStatus StepperBreak<TStep>(TStep step = default) |
| | 1537 | | where TStep : struct, IFunc<object, StepStatus> |
| | 1538 | | { |
| | 1539 | | if (step.Invoke(Value1) is Break) return Break; |
| | 1540 | | if (step.Invoke(Value2) is Break) return Break; |
| | 1541 | | if (step.Invoke(Value3) is Break) return Break; |
| | 1542 | | if (step.Invoke(Value4) is Break) return Break; |
| | 1543 | | if (step.Invoke(Value5) is Break) return Break; |
| | 1544 | | if (step.Invoke(Value6) is Break) return Break; |
| | 1545 | | return Continue; |
| | 1546 | | } |
| | 1547 | |
|
| | 1548 | | /// <inheritdoc/> |
| | 1549 | | public Link<T1, T2, T3, T4, T5, T6> Clone() => new(Value1, Value2, Value3, Value4, Value5, Value6); |
| | 1550 | |
|
| | 1551 | | /// <inheritdoc/> |
| | 1552 | | public object[] ToArray() => new object[] { Value1, Value2, Value3, Value4, Value5, Value6 }; |
| | 1553 | |
|
| | 1554 | | /// <inheritdoc/> |
| | 1555 | | public override int GetHashCode() => HashCode.Combine(Value1, Value2, Value3, Value4, Value5, Value6); |
| | 1556 | |
|
| | 1557 | | /// <inheritdoc/> |
| | 1558 | | public override bool Equals(object obj) => |
| | 1559 | | obj is LinkStruct<T1, T2, T3, T4, T5, T6> linkStruct && Equals(linkStruct) || |
| | 1560 | | obj is Link<T1, T2, T3, T4, T5, T6> link && Equals(link) || |
| | 1561 | | obj is ValueTuple<T1, T2, T3, T4, T5, T6> valueTuple && Equals(valueTuple) || |
| | 1562 | | obj is Tuple<T1, T2, T3, T4, T5, T6> tuple && Equals(tuple); |
| | 1563 | |
|
| | 1564 | | /// <summary>Check for equality with another link.</summary> |
| | 1565 | | /// <param name="b">The other link to check for equality with.</param> |
| | 1566 | | /// <returns>True if equal; false if not.</returns> |
| | 1567 | | public bool Equals(Link<T1, T2, T3, T4, T5, T6> b) => |
| | 1568 | | Equate(Value1, b.Value1) && |
| | 1569 | | Equate(Value2, b.Value2) && |
| | 1570 | | Equate(Value3, b.Value3) && |
| | 1571 | | Equate(Value4, b.Value4) && |
| | 1572 | | Equate(Value5, b.Value5) && |
| | 1573 | | Equate(Value6, b.Value6); |
| | 1574 | |
|
| | 1575 | | /// <summary>Deconstructs the link.</summary> |
| | 1576 | | /// <param name="value1">The #1 value of the link.</param> |
| | 1577 | | /// <param name="value2">The #2 value of the link.</param> |
| | 1578 | | /// <param name="value3">The #3 value of the link.</param> |
| | 1579 | | /// <param name="value4">The #4 value of the link.</param> |
| | 1580 | | /// <param name="value5">The #5 value of the link.</param> |
| | 1581 | | /// <param name="value6">The #6 value of the link.</param> |
| | 1582 | | public void Deconstruct(out T1 value1, out T2 value2, out T3 value3, out T4 value4, out T5 value5, out T6 value6) |
| | 1583 | | { |
| | 1584 | | value1 = Value1; |
| | 1585 | | value2 = Value2; |
| | 1586 | | value3 = Value3; |
| | 1587 | | value4 = Value4; |
| | 1588 | | value5 = Value5; |
| | 1589 | | value6 = Value6; |
| | 1590 | | } |
| | 1591 | |
|
| | 1592 | | #endregion |
| | 1593 | | } |
| | 1594 | |
|
| | 1595 | | /// <summary>Represents a link between objects.</summary> |
| | 1596 | | /// <typeparam name="T1">The type of #1 value in the link.</typeparam> |
| | 1597 | | /// <typeparam name="T2">The type of #2 value in the link.</typeparam> |
| | 1598 | | /// <typeparam name="T3">The type of #3 value in the link.</typeparam> |
| | 1599 | | /// <typeparam name="T4">The type of #4 value in the link.</typeparam> |
| | 1600 | | /// <typeparam name="T5">The type of #5 value in the link.</typeparam> |
| | 1601 | | /// <typeparam name="T6">The type of #6 value in the link.</typeparam> |
| | 1602 | | public struct LinkStruct<T1, T2, T3, T4, T5, T6> : Link, ICloneable<LinkStruct<T1, T2, T3, T4, T5, T6>> |
| | 1603 | | { |
| | 1604 | | /// <summary>The #1 value of the link.</summary> |
| | 1605 | | public T1 Value1 { get; set; } |
| | 1606 | | /// <summary>The #2 value of the link.</summary> |
| | 1607 | | public T2 Value2 { get; set; } |
| | 1608 | | /// <summary>The #3 value of the link.</summary> |
| | 1609 | | public T3 Value3 { get; set; } |
| | 1610 | | /// <summary>The #4 value of the link.</summary> |
| | 1611 | | public T4 Value4 { get; set; } |
| | 1612 | | /// <summary>The #5 value of the link.</summary> |
| | 1613 | | public T5 Value5 { get; set; } |
| | 1614 | | /// <summary>The #6 value of the link.</summary> |
| | 1615 | | public T6 Value6 { get; set; } |
| | 1616 | |
|
| | 1617 | | #region Constructors |
| | 1618 | |
|
| | 1619 | | /// <summary>Creates a link between objects.</summary> |
| | 1620 | | /// <param name="value1">The #1 value to be linked.</param> |
| | 1621 | | /// <param name="value2">The #2 value to be linked.</param> |
| | 1622 | | /// <param name="value3">The #3 value to be linked.</param> |
| | 1623 | | /// <param name="value4">The #4 value to be linked.</param> |
| | 1624 | | /// <param name="value5">The #5 value to be linked.</param> |
| | 1625 | | /// <param name="value6">The #6 value to be linked.</param> |
| | 1626 | | public LinkStruct(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6) |
| | 1627 | | { |
| | 1628 | | Value1 = value1; |
| | 1629 | | Value2 = value2; |
| | 1630 | | Value3 = value3; |
| | 1631 | | Value4 = value4; |
| | 1632 | | Value5 = value5; |
| | 1633 | | Value6 = value6; |
| | 1634 | | } |
| | 1635 | |
|
| | 1636 | | #endregion |
| | 1637 | |
|
| | 1638 | | #region Properties |
| | 1639 | |
|
| | 1640 | | /// <inheritdoc/> |
| | 1641 | | public int Size => 6; |
| | 1642 | |
|
| | 1643 | | /// <inheritdoc/> |
| | 1644 | | public object this[int index] |
| | 1645 | | { |
| | 1646 | | get => index switch |
| | 1647 | | { |
| | 1648 | | 1 => Value1, |
| | 1649 | | 2 => Value2, |
| | 1650 | | 3 => Value3, |
| | 1651 | | 4 => Value4, |
| | 1652 | | 5 => Value5, |
| | 1653 | | 6 => Value6, |
| | 1654 | | _ => throw new IndexOutOfRangeException($"{nameof(index)} < 1 || 6 < {nameof(index)}"), |
| | 1655 | | }; |
| | 1656 | | } |
| | 1657 | |
|
| | 1658 | | #endregion |
| | 1659 | |
|
| | 1660 | | #region Operators |
| | 1661 | |
|
| | 1662 | | /// <summary>Converts a tuple to a link.</summary> |
| | 1663 | | /// <param name="tuple">The tuple to convert to a link.</param> |
| | 1664 | | public static implicit operator LinkStruct<T1, T2, T3, T4, T5, T6>((T1, T2, T3, T4, T5, T6) tuple) => |
| | 1665 | | new(tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4, tuple.Item5, tuple.Item6); |
| | 1666 | |
|
| | 1667 | | /// <summary>Converts a link to a tuple.</summary> |
| | 1668 | | /// <param name="link">The link to convert to a tuple.</param> |
| | 1669 | | public static implicit operator (T1, T2, T3, T4, T5, T6)(LinkStruct<T1, T2, T3, T4, T5, T6> link) => |
| | 1670 | | (link.Value1, link.Value2, link.Value3, link.Value4, link.Value5, link.Value6); |
| | 1671 | |
|
| | 1672 | | /// <summary>Converts a tuple to a link.</summary> |
| | 1673 | | /// <param name="tuple">The tuple to convert to a link.</param> |
| | 1674 | | public static implicit operator LinkStruct<T1, T2, T3, T4, T5, T6>(Tuple<T1, T2, T3, T4, T5, T6> tuple) => |
| | 1675 | | new(tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4, tuple.Item5, tuple.Item6); |
| | 1676 | |
|
| | 1677 | | /// <summary>Converts a link to a tuple.</summary> |
| | 1678 | | /// <param name="link">The link to convert to a tuple.</param> |
| | 1679 | | public static implicit operator Tuple<T1, T2, T3, T4, T5, T6>(LinkStruct<T1, T2, T3, T4, T5, T6> link) => |
| | 1680 | | new(link.Value1, link.Value2, link.Value3, link.Value4, link.Value5, link.Value6); |
| | 1681 | |
|
| | 1682 | | /// <summary>Converts a class link to a struct link.</summary> |
| | 1683 | | /// <param name="link">The class link to convert to a struct link.</param> |
| | 1684 | | public static implicit operator LinkStruct<T1, T2, T3, T4, T5, T6>(Link<T1, T2, T3, T4, T5, T6> link) => |
| | 1685 | | new(link.Value1, link.Value2, link.Value3, link.Value4, link.Value5, link.Value6); |
| | 1686 | |
|
| | 1687 | | #endregion |
| | 1688 | |
|
| | 1689 | | #region Methods |
| | 1690 | |
|
| | 1691 | | System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); |
| | 1692 | |
|
| | 1693 | | /// <inheritdoc/> |
| | 1694 | | public System.Collections.Generic.IEnumerator<object> GetEnumerator() |
| | 1695 | | { |
| | 1696 | | yield return Value1; |
| | 1697 | | yield return Value2; |
| | 1698 | | yield return Value3; |
| | 1699 | | yield return Value4; |
| | 1700 | | yield return Value5; |
| | 1701 | | yield return Value6; |
| | 1702 | | } |
| | 1703 | |
|
| | 1704 | | /// <summary>Gets the types of the values of this link.</summary> |
| | 1705 | | /// <returns>The types of the values of this link.</returns> |
| | 1706 | | public Type[] Types() => new[] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6) }; |
| | 1707 | |
|
| | 1708 | | /// <inheritdoc/> |
| | 1709 | | public StepStatus StepperBreak<TStep>(TStep step = default) |
| | 1710 | | where TStep : struct, IFunc<object, StepStatus> |
| | 1711 | | { |
| | 1712 | | if (step.Invoke(Value1) is Break) return Break; |
| | 1713 | | if (step.Invoke(Value2) is Break) return Break; |
| | 1714 | | if (step.Invoke(Value3) is Break) return Break; |
| | 1715 | | if (step.Invoke(Value4) is Break) return Break; |
| | 1716 | | if (step.Invoke(Value5) is Break) return Break; |
| | 1717 | | if (step.Invoke(Value6) is Break) return Break; |
| | 1718 | | return Continue; |
| | 1719 | | } |
| | 1720 | |
|
| | 1721 | | /// <inheritdoc/> |
| | 1722 | | public LinkStruct<T1, T2, T3, T4, T5, T6> Clone() => new(Value1, Value2, Value3, Value4, Value5, Value6); |
| | 1723 | |
|
| | 1724 | | /// <inheritdoc/> |
| | 1725 | | public object[] ToArray() => new object[] { Value1, Value2, Value3, Value4, Value5, Value6 }; |
| | 1726 | |
|
| | 1727 | | /// <inheritdoc/> |
| | 1728 | | public override int GetHashCode() => HashCode.Combine(Value1, Value2, Value3, Value4, Value5, Value6); |
| | 1729 | |
|
| | 1730 | | /// <inheritdoc/> |
| | 1731 | | public override bool Equals(object obj) => |
| | 1732 | | obj is LinkStruct<T1, T2, T3, T4, T5, T6> linkStruct && Equals(linkStruct) || |
| | 1733 | | obj is Link<T1, T2, T3, T4, T5, T6> link && Equals(link) || |
| | 1734 | | obj is ValueTuple<T1, T2, T3, T4, T5, T6> valueTuple && Equals(valueTuple) || |
| | 1735 | | obj is Tuple<T1, T2, T3, T4, T5, T6> tuple && Equals(tuple); |
| | 1736 | |
|
| | 1737 | | /// <summary>Check for equality with another link.</summary> |
| | 1738 | | /// <param name="b">The other link to check for equality with.</param> |
| | 1739 | | /// <returns>True if equal; false if not.</returns> |
| | 1740 | | public bool Equals(LinkStruct<T1, T2, T3, T4, T5, T6> b) => |
| | 1741 | | Equate(Value1, b.Value1) && |
| | 1742 | | Equate(Value2, b.Value2) && |
| | 1743 | | Equate(Value3, b.Value3) && |
| | 1744 | | Equate(Value4, b.Value4) && |
| | 1745 | | Equate(Value5, b.Value5) && |
| | 1746 | | Equate(Value6, b.Value6); |
| | 1747 | |
|
| | 1748 | | /// <summary>Deconstructs the link.</summary> |
| | 1749 | | /// <param name="value1">The #1 value of the link.</param> |
| | 1750 | | /// <param name="value2">The #2 value of the link.</param> |
| | 1751 | | /// <param name="value3">The #3 value of the link.</param> |
| | 1752 | | /// <param name="value4">The #4 value of the link.</param> |
| | 1753 | | /// <param name="value5">The #5 value of the link.</param> |
| | 1754 | | /// <param name="value6">The #6 value of the link.</param> |
| | 1755 | | public void Deconstruct(out T1 value1, out T2 value2, out T3 value3, out T4 value4, out T5 value5, out T6 value6) |
| | 1756 | | { |
| | 1757 | | value1 = Value1; |
| | 1758 | | value2 = Value2; |
| | 1759 | | value3 = Value3; |
| | 1760 | | value4 = Value4; |
| | 1761 | | value5 = Value5; |
| | 1762 | | value6 = Value6; |
| | 1763 | | } |
| | 1764 | |
|
| | 1765 | | #endregion |
| | 1766 | | } |
| | 1767 | |
|
| | 1768 | | /// <summary>Represents a link between objects.</summary> |
| | 1769 | | /// <typeparam name="T1">The type of #1 value in the link.</typeparam> |
| | 1770 | | /// <typeparam name="T2">The type of #2 value in the link.</typeparam> |
| | 1771 | | /// <typeparam name="T3">The type of #3 value in the link.</typeparam> |
| | 1772 | | /// <typeparam name="T4">The type of #4 value in the link.</typeparam> |
| | 1773 | | /// <typeparam name="T5">The type of #5 value in the link.</typeparam> |
| | 1774 | | /// <typeparam name="T6">The type of #6 value in the link.</typeparam> |
| | 1775 | | /// <typeparam name="T7">The type of #7 value in the link.</typeparam> |
| | 1776 | | public class Link<T1, T2, T3, T4, T5, T6, T7> : Link, ICloneable<Link<T1, T2, T3, T4, T5, T6, T7>> |
| | 1777 | | { |
| | 1778 | | /// <summary>The #1 value of the link.</summary> |
| 0 | 1779 | | public T1 Value1 { get; set; } |
| | 1780 | | /// <summary>The #2 value of the link.</summary> |
| 0 | 1781 | | public T2 Value2 { get; set; } |
| | 1782 | | /// <summary>The #3 value of the link.</summary> |
| 0 | 1783 | | public T3 Value3 { get; set; } |
| | 1784 | | /// <summary>The #4 value of the link.</summary> |
| 0 | 1785 | | public T4 Value4 { get; set; } |
| | 1786 | | /// <summary>The #5 value of the link.</summary> |
| 0 | 1787 | | public T5 Value5 { get; set; } |
| | 1788 | | /// <summary>The #6 value of the link.</summary> |
| 0 | 1789 | | public T6 Value6 { get; set; } |
| | 1790 | | /// <summary>The #7 value of the link.</summary> |
| 0 | 1791 | | public T7 Value7 { get; set; } |
| | 1792 | |
|
| | 1793 | | #region Constructors |
| | 1794 | |
|
| | 1795 | | /// <summary>Constructs a link of values.</summary> |
| | 1796 | | /// <param name="value1">The #1 value to be linked.</param> |
| | 1797 | | /// <param name="value2">The #2 value to be linked.</param> |
| | 1798 | | /// <param name="value3">The #3 value to be linked.</param> |
| | 1799 | | /// <param name="value4">The #4 value to be linked.</param> |
| | 1800 | | /// <param name="value5">The #5 value to be linked.</param> |
| | 1801 | | /// <param name="value6">The #6 value to be linked.</param> |
| | 1802 | | /// <param name="value7">The #7 value to be linked.</param> |
| 0 | 1803 | | public Link(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7) |
| 0 | 1804 | | { |
| 0 | 1805 | | Value1 = value1; |
| 0 | 1806 | | Value2 = value2; |
| 0 | 1807 | | Value3 = value3; |
| 0 | 1808 | | Value4 = value4; |
| 0 | 1809 | | Value5 = value5; |
| 0 | 1810 | | Value6 = value6; |
| 0 | 1811 | | Value7 = value7; |
| 0 | 1812 | | } |
| | 1813 | |
|
| | 1814 | | #endregion |
| | 1815 | |
|
| | 1816 | | #region Properties |
| | 1817 | |
|
| | 1818 | | /// <inheritdoc/> |
| 0 | 1819 | | public int Size => 7; |
| | 1820 | |
|
| | 1821 | | /// <inheritdoc/> |
| | 1822 | | public object this[int index] |
| | 1823 | | { |
| 0 | 1824 | | get => index switch |
| 0 | 1825 | | { |
| 0 | 1826 | | 1 => Value1, |
| 0 | 1827 | | 2 => Value2, |
| 0 | 1828 | | 3 => Value3, |
| 0 | 1829 | | 4 => Value4, |
| 0 | 1830 | | 5 => Value5, |
| 0 | 1831 | | 6 => Value6, |
| 0 | 1832 | | 7 => Value7, |
| 0 | 1833 | | _ => throw new IndexOutOfRangeException($"{nameof(index)} < 1 || 7 < {nameof(index)}"), |
| 0 | 1834 | | }; |
| | 1835 | | } |
| | 1836 | |
|
| | 1837 | | #endregion |
| | 1838 | |
|
| | 1839 | | #region Operators |
| | 1840 | |
|
| | 1841 | | /// <summary>Converts a tuple to a link.</summary> |
| | 1842 | | /// <param name="tuple">The tuple to convert to a link.</param> |
| | 1843 | | public static implicit operator Link<T1, T2, T3, T4, T5, T6, T7>((T1, T2, T3, T4, T5, T6, T7) tuple) => |
| 0 | 1844 | | new(tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4, tuple.Item5, tuple.Item6, tuple.Item7); |
| | 1845 | |
|
| | 1846 | | /// <summary>Converts a link to a tuple.</summary> |
| | 1847 | | /// <param name="link">The link to convert to a tuple.</param> |
| | 1848 | | public static implicit operator (T1, T2, T3, T4, T5, T6, T7)(Link<T1, T2, T3, T4, T5, T6, T7> link) => |
| 0 | 1849 | | (link.Value1, link.Value2, link.Value3, link.Value4, link.Value5, link.Value6, link.Value7); |
| | 1850 | |
|
| | 1851 | | /// <summary>Converts a tuple to a link.</summary> |
| | 1852 | | /// <param name="tuple">The tuple to convert to a link.</param> |
| | 1853 | | public static implicit operator Link<T1, T2, T3, T4, T5, T6, T7>(Tuple<T1, T2, T3, T4, T5, T6, T7> tuple) => |
| 0 | 1854 | | new(tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4, tuple.Item5, tuple.Item6, tuple.Item7); |
| | 1855 | |
|
| | 1856 | | /// <summary>Converts a link to a tuple.</summary> |
| | 1857 | | /// <param name="link">The link to convert to a tuple.</param> |
| | 1858 | | public static implicit operator Tuple<T1, T2, T3, T4, T5, T6, T7>(Link<T1, T2, T3, T4, T5, T6, T7> link) => |
| 0 | 1859 | | new(link.Value1, link.Value2, link.Value3, link.Value4, link.Value5, link.Value6, link.Value7); |
| | 1860 | |
|
| | 1861 | | /// <summary>Converts a class link to a struct link.</summary> |
| | 1862 | | /// <param name="link">The class link to convert to a struct link.</param> |
| | 1863 | | public static implicit operator Link<T1, T2, T3, T4, T5, T6, T7>(LinkStruct<T1, T2, T3, T4, T5, T6, T7> link) => |
| 0 | 1864 | | new(link.Value1, link.Value2, link.Value3, link.Value4, link.Value5, link.Value6, link.Value7); |
| | 1865 | |
|
| | 1866 | | #endregion |
| | 1867 | |
|
| | 1868 | | #region Methods |
| | 1869 | |
|
| 0 | 1870 | | System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); |
| | 1871 | |
|
| | 1872 | | /// <inheritdoc/> |
| | 1873 | | public System.Collections.Generic.IEnumerator<object> GetEnumerator() |
| 0 | 1874 | | { |
| 0 | 1875 | | yield return Value1; |
| 0 | 1876 | | yield return Value2; |
| 0 | 1877 | | yield return Value3; |
| 0 | 1878 | | yield return Value4; |
| 0 | 1879 | | yield return Value5; |
| 0 | 1880 | | yield return Value6; |
| 0 | 1881 | | yield return Value7; |
| 0 | 1882 | | } |
| | 1883 | |
|
| | 1884 | | /// <summary>Gets the types of the values of this link.</summary> |
| | 1885 | | /// <returns>The types of the values of this link.</returns> |
| 0 | 1886 | | public Type[] Types() => new[] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7) }; |
| | 1887 | |
|
| | 1888 | | /// <inheritdoc/> |
| | 1889 | | public StepStatus StepperBreak<TStep>(TStep step = default) |
| | 1890 | | where TStep : struct, IFunc<object, StepStatus> |
| 0 | 1891 | | { |
| 0 | 1892 | | if (step.Invoke(Value1) is Break) return Break; |
| 0 | 1893 | | if (step.Invoke(Value2) is Break) return Break; |
| 0 | 1894 | | if (step.Invoke(Value3) is Break) return Break; |
| 0 | 1895 | | if (step.Invoke(Value4) is Break) return Break; |
| 0 | 1896 | | if (step.Invoke(Value5) is Break) return Break; |
| 0 | 1897 | | if (step.Invoke(Value6) is Break) return Break; |
| 0 | 1898 | | if (step.Invoke(Value7) is Break) return Break; |
| 0 | 1899 | | return Continue; |
| 0 | 1900 | | } |
| | 1901 | |
|
| | 1902 | | /// <inheritdoc/> |
| 0 | 1903 | | public Link<T1, T2, T3, T4, T5, T6, T7> Clone() => new(Value1, Value2, Value3, Value4, Value5, Value6, Value7); |
| | 1904 | |
|
| | 1905 | | /// <inheritdoc/> |
| 0 | 1906 | | public object[] ToArray() => new object[] { Value1, Value2, Value3, Value4, Value5, Value6, Value7 }; |
| | 1907 | |
|
| | 1908 | | /// <inheritdoc/> |
| 0 | 1909 | | public override int GetHashCode() => HashCode.Combine(Value1, Value2, Value3, Value4, Value5, Value6, Value7); |
| | 1910 | |
|
| | 1911 | | /// <inheritdoc/> |
| | 1912 | | public override bool Equals(object obj) => |
| 0 | 1913 | | obj is LinkStruct<T1, T2, T3, T4, T5, T6, T7> linkStruct && Equals(linkStruct) || |
| 0 | 1914 | | obj is Link<T1, T2, T3, T4, T5, T6, T7> link && Equals(link) || |
| 0 | 1915 | | obj is ValueTuple<T1, T2, T3, T4, T5, T6, T7> valueTuple && Equals(valueTuple) || |
| 0 | 1916 | | obj is Tuple<T1, T2, T3, T4, T5, T6, T7> tuple && Equals(tuple); |
| | 1917 | |
|
| | 1918 | | /// <summary>Check for equality with another link.</summary> |
| | 1919 | | /// <param name="b">The other link to check for equality with.</param> |
| | 1920 | | /// <returns>True if equal; false if not.</returns> |
| | 1921 | | public bool Equals(Link<T1, T2, T3, T4, T5, T6, T7> b) => |
| 0 | 1922 | | Equate(Value1, b.Value1) && |
| 0 | 1923 | | Equate(Value2, b.Value2) && |
| 0 | 1924 | | Equate(Value3, b.Value3) && |
| 0 | 1925 | | Equate(Value4, b.Value4) && |
| 0 | 1926 | | Equate(Value5, b.Value5) && |
| 0 | 1927 | | Equate(Value6, b.Value6) && |
| 0 | 1928 | | Equate(Value7, b.Value7); |
| | 1929 | |
|
| | 1930 | | /// <summary>Deconstructs the link.</summary> |
| | 1931 | | /// <param name="value1">The #1 value of the link.</param> |
| | 1932 | | /// <param name="value2">The #2 value of the link.</param> |
| | 1933 | | /// <param name="value3">The #3 value of the link.</param> |
| | 1934 | | /// <param name="value4">The #4 value of the link.</param> |
| | 1935 | | /// <param name="value5">The #5 value of the link.</param> |
| | 1936 | | /// <param name="value6">The #6 value of the link.</param> |
| | 1937 | | /// <param name="value7">The #7 value of the link.</param> |
| | 1938 | | public void Deconstruct(out T1 value1, out T2 value2, out T3 value3, out T4 value4, out T5 value5, out T6 value6, out |
| 0 | 1939 | | { |
| 0 | 1940 | | value1 = Value1; |
| 0 | 1941 | | value2 = Value2; |
| 0 | 1942 | | value3 = Value3; |
| 0 | 1943 | | value4 = Value4; |
| 0 | 1944 | | value5 = Value5; |
| 0 | 1945 | | value6 = Value6; |
| 0 | 1946 | | value7 = Value7; |
| 0 | 1947 | | } |
| | 1948 | |
|
| | 1949 | | #endregion |
| | 1950 | | } |
| | 1951 | |
|
| | 1952 | | /// <summary>Represents a link between objects.</summary> |
| | 1953 | | /// <typeparam name="T1">The type of #1 value in the link.</typeparam> |
| | 1954 | | /// <typeparam name="T2">The type of #2 value in the link.</typeparam> |
| | 1955 | | /// <typeparam name="T3">The type of #3 value in the link.</typeparam> |
| | 1956 | | /// <typeparam name="T4">The type of #4 value in the link.</typeparam> |
| | 1957 | | /// <typeparam name="T5">The type of #5 value in the link.</typeparam> |
| | 1958 | | /// <typeparam name="T6">The type of #6 value in the link.</typeparam> |
| | 1959 | | /// <typeparam name="T7">The type of #7 value in the link.</typeparam> |
| | 1960 | | public struct LinkStruct<T1, T2, T3, T4, T5, T6, T7> : Link, ICloneable<LinkStruct<T1, T2, T3, T4, T5, T6, T7>> |
| | 1961 | | { |
| | 1962 | | /// <summary>The #1 value of the link.</summary> |
| | 1963 | | public T1 Value1 { get; set; } |
| | 1964 | | /// <summary>The #2 value of the link.</summary> |
| | 1965 | | public T2 Value2 { get; set; } |
| | 1966 | | /// <summary>The #3 value of the link.</summary> |
| | 1967 | | public T3 Value3 { get; set; } |
| | 1968 | | /// <summary>The #4 value of the link.</summary> |
| | 1969 | | public T4 Value4 { get; set; } |
| | 1970 | | /// <summary>The #5 value of the link.</summary> |
| | 1971 | | public T5 Value5 { get; set; } |
| | 1972 | | /// <summary>The #6 value of the link.</summary> |
| | 1973 | | public T6 Value6 { get; set; } |
| | 1974 | | /// <summary>The #7 value of the link.</summary> |
| | 1975 | | public T7 Value7 { get; set; } |
| | 1976 | |
|
| | 1977 | | #region Constructors |
| | 1978 | |
|
| | 1979 | | /// <summary>Creates a link between objects.</summary> |
| | 1980 | | /// <param name="value1">The #1 value to be linked.</param> |
| | 1981 | | /// <param name="value2">The #2 value to be linked.</param> |
| | 1982 | | /// <param name="value3">The #3 value to be linked.</param> |
| | 1983 | | /// <param name="value4">The #4 value to be linked.</param> |
| | 1984 | | /// <param name="value5">The #5 value to be linked.</param> |
| | 1985 | | /// <param name="value6">The #6 value to be linked.</param> |
| | 1986 | | /// <param name="value7">The #7 value to be linked.</param> |
| | 1987 | | public LinkStruct(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7) |
| | 1988 | | { |
| | 1989 | | Value1 = value1; |
| | 1990 | | Value2 = value2; |
| | 1991 | | Value3 = value3; |
| | 1992 | | Value4 = value4; |
| | 1993 | | Value5 = value5; |
| | 1994 | | Value6 = value6; |
| | 1995 | | Value7 = value7; |
| | 1996 | | } |
| | 1997 | |
|
| | 1998 | | #endregion |
| | 1999 | |
|
| | 2000 | | #region Properties |
| | 2001 | |
|
| | 2002 | | /// <inheritdoc/> |
| | 2003 | | public int Size => 7; |
| | 2004 | |
|
| | 2005 | | /// <inheritdoc/> |
| | 2006 | | public object this[int index] |
| | 2007 | | { |
| | 2008 | | get => index switch |
| | 2009 | | { |
| | 2010 | | 1 => Value1, |
| | 2011 | | 2 => Value2, |
| | 2012 | | 3 => Value3, |
| | 2013 | | 4 => Value4, |
| | 2014 | | 5 => Value5, |
| | 2015 | | 6 => Value6, |
| | 2016 | | 7 => Value7, |
| | 2017 | | _ => throw new IndexOutOfRangeException($"{nameof(index)} < 1 || 7 < {nameof(index)}"), |
| | 2018 | | }; |
| | 2019 | | } |
| | 2020 | |
|
| | 2021 | | #endregion |
| | 2022 | |
|
| | 2023 | | #region Operators |
| | 2024 | |
|
| | 2025 | | /// <summary>Converts a tuple to a link.</summary> |
| | 2026 | | /// <param name="tuple">The tuple to convert to a link.</param> |
| | 2027 | | public static implicit operator LinkStruct<T1, T2, T3, T4, T5, T6, T7>((T1, T2, T3, T4, T5, T6, T7) tuple) => |
| | 2028 | | new(tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4, tuple.Item5, tuple.Item6, tuple.Item7); |
| | 2029 | |
|
| | 2030 | | /// <summary>Converts a link to a tuple.</summary> |
| | 2031 | | /// <param name="link">The link to convert to a tuple.</param> |
| | 2032 | | public static implicit operator (T1, T2, T3, T4, T5, T6, T7)(LinkStruct<T1, T2, T3, T4, T5, T6, T7> link) => |
| | 2033 | | (link.Value1, link.Value2, link.Value3, link.Value4, link.Value5, link.Value6, link.Value7); |
| | 2034 | |
|
| | 2035 | | /// <summary>Converts a tuple to a link.</summary> |
| | 2036 | | /// <param name="tuple">The tuple to convert to a link.</param> |
| | 2037 | | public static implicit operator LinkStruct<T1, T2, T3, T4, T5, T6, T7>(Tuple<T1, T2, T3, T4, T5, T6, T7> tuple) => |
| | 2038 | | new(tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4, tuple.Item5, tuple.Item6, tuple.Item7); |
| | 2039 | |
|
| | 2040 | | /// <summary>Converts a link to a tuple.</summary> |
| | 2041 | | /// <param name="link">The link to convert to a tuple.</param> |
| | 2042 | | public static implicit operator Tuple<T1, T2, T3, T4, T5, T6, T7>(LinkStruct<T1, T2, T3, T4, T5, T6, T7> link) => |
| | 2043 | | new(link.Value1, link.Value2, link.Value3, link.Value4, link.Value5, link.Value6, link.Value7); |
| | 2044 | |
|
| | 2045 | | /// <summary>Converts a class link to a struct link.</summary> |
| | 2046 | | /// <param name="link">The class link to convert to a struct link.</param> |
| | 2047 | | public static implicit operator LinkStruct<T1, T2, T3, T4, T5, T6, T7>(Link<T1, T2, T3, T4, T5, T6, T7> link) => |
| | 2048 | | new(link.Value1, link.Value2, link.Value3, link.Value4, link.Value5, link.Value6, link.Value7); |
| | 2049 | |
|
| | 2050 | | #endregion |
| | 2051 | |
|
| | 2052 | | #region Methods |
| | 2053 | |
|
| | 2054 | | System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); |
| | 2055 | |
|
| | 2056 | | /// <inheritdoc/> |
| | 2057 | | public System.Collections.Generic.IEnumerator<object> GetEnumerator() |
| | 2058 | | { |
| | 2059 | | yield return Value1; |
| | 2060 | | yield return Value2; |
| | 2061 | | yield return Value3; |
| | 2062 | | yield return Value4; |
| | 2063 | | yield return Value5; |
| | 2064 | | yield return Value6; |
| | 2065 | | yield return Value7; |
| | 2066 | | } |
| | 2067 | |
|
| | 2068 | | /// <summary>Gets the types of the values of this link.</summary> |
| | 2069 | | /// <returns>The types of the values of this link.</returns> |
| | 2070 | | public Type[] Types() => new[] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7) }; |
| | 2071 | |
|
| | 2072 | | /// <inheritdoc/> |
| | 2073 | | public StepStatus StepperBreak<TStep>(TStep step = default) |
| | 2074 | | where TStep : struct, IFunc<object, StepStatus> |
| | 2075 | | { |
| | 2076 | | if (step.Invoke(Value1) is Break) return Break; |
| | 2077 | | if (step.Invoke(Value2) is Break) return Break; |
| | 2078 | | if (step.Invoke(Value3) is Break) return Break; |
| | 2079 | | if (step.Invoke(Value4) is Break) return Break; |
| | 2080 | | if (step.Invoke(Value5) is Break) return Break; |
| | 2081 | | if (step.Invoke(Value6) is Break) return Break; |
| | 2082 | | if (step.Invoke(Value7) is Break) return Break; |
| | 2083 | | return Continue; |
| | 2084 | | } |
| | 2085 | |
|
| | 2086 | | /// <inheritdoc/> |
| | 2087 | | public LinkStruct<T1, T2, T3, T4, T5, T6, T7> Clone() => new(Value1, Value2, Value3, Value4, Value5, Value6, Value7); |
| | 2088 | |
|
| | 2089 | | /// <inheritdoc/> |
| | 2090 | | public object[] ToArray() => new object[] { Value1, Value2, Value3, Value4, Value5, Value6, Value7 }; |
| | 2091 | |
|
| | 2092 | | /// <inheritdoc/> |
| | 2093 | | public override int GetHashCode() => HashCode.Combine(Value1, Value2, Value3, Value4, Value5, Value6, Value7); |
| | 2094 | |
|
| | 2095 | | /// <inheritdoc/> |
| | 2096 | | public override bool Equals(object obj) => |
| | 2097 | | obj is LinkStruct<T1, T2, T3, T4, T5, T6, T7> linkStruct && Equals(linkStruct) || |
| | 2098 | | obj is Link<T1, T2, T3, T4, T5, T6, T7> link && Equals(link) || |
| | 2099 | | obj is ValueTuple<T1, T2, T3, T4, T5, T6, T7> valueTuple && Equals(valueTuple) || |
| | 2100 | | obj is Tuple<T1, T2, T3, T4, T5, T6, T7> tuple && Equals(tuple); |
| | 2101 | |
|
| | 2102 | | /// <summary>Check for equality with another link.</summary> |
| | 2103 | | /// <param name="b">The other link to check for equality with.</param> |
| | 2104 | | /// <returns>True if equal; false if not.</returns> |
| | 2105 | | public bool Equals(LinkStruct<T1, T2, T3, T4, T5, T6, T7> b) => |
| | 2106 | | Equate(Value1, b.Value1) && |
| | 2107 | | Equate(Value2, b.Value2) && |
| | 2108 | | Equate(Value3, b.Value3) && |
| | 2109 | | Equate(Value4, b.Value4) && |
| | 2110 | | Equate(Value5, b.Value5) && |
| | 2111 | | Equate(Value6, b.Value6) && |
| | 2112 | | Equate(Value7, b.Value7); |
| | 2113 | |
|
| | 2114 | | /// <summary>Deconstructs the link.</summary> |
| | 2115 | | /// <param name="value1">The #1 value of the link.</param> |
| | 2116 | | /// <param name="value2">The #2 value of the link.</param> |
| | 2117 | | /// <param name="value3">The #3 value of the link.</param> |
| | 2118 | | /// <param name="value4">The #4 value of the link.</param> |
| | 2119 | | /// <param name="value5">The #5 value of the link.</param> |
| | 2120 | | /// <param name="value6">The #6 value of the link.</param> |
| | 2121 | | /// <param name="value7">The #7 value of the link.</param> |
| | 2122 | | public void Deconstruct(out T1 value1, out T2 value2, out T3 value3, out T4 value4, out T5 value5, out T6 value6, out |
| | 2123 | | { |
| | 2124 | | value1 = Value1; |
| | 2125 | | value2 = Value2; |
| | 2126 | | value3 = Value3; |
| | 2127 | | value4 = Value4; |
| | 2128 | | value5 = Value5; |
| | 2129 | | value6 = Value6; |
| | 2130 | | value7 = Value7; |
| | 2131 | | } |
| | 2132 | |
|
| | 2133 | | #endregion |
| | 2134 | | } |