Class Reflector

java.lang.Object
  extended by Reflector

public class Reflector
extends java.lang.Object

A Reflector is a device of an enigma machine that is used to swap the values between pairs of letters according to the way its wires are setup. This implementation provides 2 types of reflectors B and C representing the possible reflectors used in the enigma M3 machine. It is called reflector because letters are permuted in pairs (for example, in reflector type B you noticed that an entering letter 'A' gets changed to letter 'Y' and an entering letter 'Y' gets changed to letter 'A')

Author:
Lucia Moura

Constructor Summary
Reflector(int typeReflector)
          A constructor of arity 1 that specifies the reflector type.
 
Method Summary
 char getType()
          Method getType returns the type of this reflector.
 java.lang.String getWiring()
          Method getWiring returns a string representing the wiring of this reflector.
 char outLetter(char inputLetter)
          Method outLetter produces the output letter obtained after the given letter enters the reflector.
 java.lang.String toString()
          This method overrides java.lang.Object.toString() and returns a string representation of this Reflector.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Reflector

public Reflector(int typeReflector)
A constructor of arity 1 that specifies the reflector type.

Parameters:
rotorType - is an integer 1 or 2 specifying types B and C, respectively.
Method Detail

outLetter

public char outLetter(char inputLetter)
Method outLetter produces the output letter obtained after the given letter enters the reflector.

Parameters:
inputLetter - is the letter entering the reflector
Returns:
the letter that comes out of the reflector

getType

public char getType()
Method getType returns the type of this reflector.

Returns:
the type of this reflector (B or C)

getWiring

public java.lang.String getWiring()
Method getWiring returns a string representing the wiring of this reflector.

Returns:
a string of 26 letters representing the wiring of this reflector.

toString

public java.lang.String toString()
This method overrides java.lang.Object.toString() and returns a string representation of this Reflector.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this Reflector