|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object PlugBoard
public class PlugBoard
The class PlugBoard
implements the plugboard of
an Enigma machine. Pairs of letters in the plugboard may
get connected by a plug, making a letter get its value spapped
by the letter it is plugged to when it passes through the plugboard.
Constructor Summary | |
---|---|
PlugBoard()
the constructor creates an instance of PlugBoard
without any plugs. |
Method Summary | |
---|---|
char |
outLetter(char letter)
Method outLetter returns the letter than comes out the
plugboard after the given letter enters the plugboard (if the letter
has been previously plugged to another its value will be changed to
the value of that other letter; otherwise it will be left unchanged) |
void |
plug(char c1,
char c2)
Method plug connects two letters via a plug if they
have not been plugged to any other letter. |
java.lang.String |
toString()
This method overrides java.lang.Object.toString() and returns a string representation of this PlugBoard . |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PlugBoard()
PlugBoard
without any plugs.
Method Detail |
---|
public void plug(char c1, char c2)
plug
connects two letters via a plug if they
have not been plugged to any other letter. If any of the two letter
has already been plugged it does nothing.
c1
- is one of the letters to be plugged to the other.c2
- is one of the letters to be plugged to the other.public char outLetter(char letter)
outLetter
returns the letter than comes out the
plugboard after the given letter enters the plugboard (if the letter
has been previously plugged to another its value will be changed to
the value of that other letter; otherwise it will be left unchanged)
letter
- is the letter that enters the plugboard
public java.lang.String toString()
PlugBoard
.
toString
in class java.lang.Object
PlugBoard
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |