40 lines
663 B
Java
40 lines
663 B
Java
/**
|
|
* Reflector for the Enigma.
|
|
*
|
|
*/
|
|
public class Reflector implements EnigmaComponent {
|
|
|
|
/**
|
|
* Permutation of the reflector.
|
|
*/
|
|
private int[] permu;
|
|
/**
|
|
* Permutation of reflector.
|
|
* @param permu Permutation
|
|
*/
|
|
Reflector(final int[] permu) {
|
|
this.permu = permu;
|
|
}
|
|
|
|
/**
|
|
* {@inheritDoc}
|
|
*/
|
|
public final int encode(final int i) {
|
|
return permu[i];
|
|
}
|
|
|
|
/**
|
|
* Method is not required in the reflector.<br />
|
|
* {@inheritDoc}
|
|
*/
|
|
public final int decode(final int i) {
|
|
return 0;
|
|
}
|
|
|
|
/**
|
|
* {@inheritDoc}
|
|
*/
|
|
public void tick() {
|
|
|
|
}
|
|
} |