/// <summary> /// Constructs a <see cref="SetupArgs"/> with the specified letterset. /// </summary> /// <param name="letterSet">The letterset to use.</param> public SetupArgs(LetterSet letterSet) { LetterSet = letterSet ?? throw new ArgumentNullException(nameof(letterSet)); int[] steckering = new int[LetterSet.Count]; for (int i = 0; i < LetterSet.Count; i++) { steckering[i] = i; } Steckering = new Steckering(steckering); }
//private readonly Steckering reverseSteckering; #endregion #region Constructors /// <summary> /// Constructs the <see cref="Plugboard"/>. /// </summary> /// <param name="letterSet">The letterset to compare to the steckering.</param> /// <param name="steckering">The steckering to use.</param> public Plugboard(LetterSet letterSet, Steckering steckering) { if (letterSet == null) { throw new ArgumentNullException(nameof(letterSet)); } this.steckering = steckering ?? throw new ArgumentNullException(nameof(steckering)); if (steckering.Count != letterSet.Count) { throw new ArgumentException(nameof(steckering)); } //reverseSteckering = steckering.Reverse(); }
/// <summary> /// Constructs the <see cref="Plugboard"/>. /// </summary> /// <param name="letterSet">The letterset to compare to the steckering.</param> /// <param name="steckering">The steckering to use.</param> public Plugboard(LetterSet letterSet, Steckering steckering) { if (letterSet == null) { throw new ArgumentNullException(nameof(letterSet)); } this.steckering = steckering ?? throw new ArgumentNullException(nameof(steckering)); if (steckering.Count != letterSet.Count) { throw new ArgumentException($"Letterset and Steckering count do not match!\n" + $"Letterset: {letterSet.Count}, Steckering: {steckering.Count}", nameof(steckering)); } }
public Plugboard(LetterSet letterSet, Steckering steckering) { this.letterSet = letterSet ?? throw new ArgumentNullException(nameof(letterSet)); this.steckering = steckering ?? throw new ArgumentNullException(nameof(steckering)); if (steckering.Count != letterSet.Count) { throw new ArgumentException(nameof(steckering)); } reverseSteckering = steckering.Reverse(); /*reverseSteckering = new int[steckering.Length]; * for (int i = 0; i < steckering.Length; i++) { * reverseSteckering[i] = Array.IndexOf(steckering, i); * }*/ }