Rotor.notch
The turnover point for the adjacent rotor
This commit is contained in:
parent
00328dd0c3
commit
ed6d06015d
1 changed files with 9 additions and 0 deletions
|
@ -128,6 +128,15 @@ class Rotor: FixedRotor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** An offset at which the adjacent rotor should be advanced by one position. */
|
||||||
|
var notch: Int? {
|
||||||
|
willSet {
|
||||||
|
if let newInt = newValue {
|
||||||
|
self.notch = newInt % series.count
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func advance(count: Int = 1) {
|
func advance(count: Int = 1) {
|
||||||
position = (position + count) % Rotor.alphabet.count
|
position = (position + count) % Rotor.alphabet.count
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue