33 lines
1.1 KiB
Java
33 lines
1.1 KiB
Java
/**
|
|
* Interface EnigmaComponent unifies rotors, patchboard and reflector
|
|
* of an enigma.
|
|
*/
|
|
interface EnigmaComponent {
|
|
|
|
/**
|
|
* Applies the substitution chiffre of this enigma component in the current
|
|
* state to symbol.
|
|
*
|
|
* @param symbol The symbol to encode with the substitution chiffre of this
|
|
* enigma component in its current state.
|
|
* @return The symbol which is the encoded symbol of the parameter symbol.
|
|
*/
|
|
int encode(int symbol);
|
|
|
|
/**
|
|
* Applies the inverse substitution chiffre of this enigma component in the
|
|
* current state to letter.
|
|
*
|
|
* @param symbol The symbol to decode with the (inverse) substitution
|
|
* chiffre of this enigma component in its current state.
|
|
* @return The symbol which is the decoded symbol of the parameter symbol.
|
|
*/
|
|
int decode(int symbol);
|
|
|
|
/**
|
|
* In case this component can do ticks, this component performs its next
|
|
* tick. In case this triggers ticks of subsequent components, their ticks
|
|
* are also triggered.
|
|
*/
|
|
void tick();
|
|
} |