Wiring init() for Rotors
This commit is contained in:
parent
e586c7e03d
commit
a01af97ffc
1 changed files with 8 additions and 0 deletions
|
@ -100,6 +100,10 @@ class Rotor: FixedRotor {
|
|||
case EnigmaETW = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
}
|
||||
|
||||
convenience init(_ wiring: Wiring) throws {
|
||||
try self.init(series: wiring.rawValue)
|
||||
}
|
||||
|
||||
/** The position of first letter in `series` in the `alphabet`. */
|
||||
var position: Int = 0 {
|
||||
willSet {
|
||||
|
@ -142,6 +146,10 @@ class Reflector: FixedRotor {
|
|||
case InvalidReflection
|
||||
}
|
||||
|
||||
convenience init(_ wiring: Wiring) throws {
|
||||
try self.init(series: wiring.rawValue)
|
||||
}
|
||||
|
||||
override init(series: [Character]) throws {
|
||||
try super.init(series: series)
|
||||
try validateReflector(series)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue