Example #1
0
        /// <summary>
        /// Create a module for a <see cref="Machine.Rotor"/> and a <see cref="Machine.PlugBoard"/>
        /// </summary>
        /// <param name="plugBoard"></param>
        /// <param name="rotor"></param>
        public Module(PlugBoard plugBoard, Rotor rotor)
        {
            if (plugBoard == null && rotor == null)
            {
                throw new ArgumentNullException(null, "The " + nameof(rotor) + " and the " + nameof(plugBoard) + " may not be null.");
            }

            PlugBoard = plugBoard;
            Rotor     = rotor;
        }
Example #2
0
        /// <summary>
        /// Creates a duplicate of this rotor and reset then.
        /// </summary>
        /// <returns></returns>
        public Rotor CloneRotor(bool andReset)
        {
            Rotor rslt = new Rotor(Id, source_alphabet, InitialPosition, RotateAt);

            if (!andReset)
            {
                rslt.RotateToPosition(OffsetPosition);
            }
            return(rslt);
        }
Example #3
0
 /// <summary>
 /// Create a module for a <see cref="Machine.Rotor"/>
 /// </summary>
 /// <param name="rotor"></param>
 public Module(Rotor rotor) : this(null, rotor)
 {
 }