mirror of
https://github.com/vanitasvitae/EnigmAndroid.git
synced 2024-12-22 19:08:01 +01:00
Reformated code and moved Plugboard, EntryWheel, Reflector, Rotor to new package parts
This commit is contained in:
parent
dbfb1d5d79
commit
c938b745bc
20 changed files with 118 additions and 109 deletions
|
@ -10,21 +10,22 @@ import android.util.Log;
|
||||||
* Class that represents the settings activity.
|
* Class that represents the settings activity.
|
||||||
* Use the singleton to get an instance of this class to get preferences
|
* Use the singleton to get an instance of this class to get preferences
|
||||||
* Copyright (C) 2015 Paul Schaub
|
* Copyright (C) 2015 Paul Schaub
|
||||||
|
* <p>
|
||||||
This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
* <p>
|
||||||
This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
|
* <p>
|
||||||
You should have received a copy of the GNU General Public License along
|
* You should have received a copy of the GNU General Public License along
|
||||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*@author vanitasvitae
|
*
|
||||||
|
* @author vanitasvitae
|
||||||
*/
|
*/
|
||||||
public class SettingsActivity extends PreferenceActivity
|
public class SettingsActivity extends PreferenceActivity
|
||||||
{
|
{
|
||||||
|
@ -64,12 +65,13 @@ public class SettingsActivity extends PreferenceActivity
|
||||||
|
|
||||||
private boolean isFullyInitilaized()
|
private boolean isFullyInitilaized()
|
||||||
{
|
{
|
||||||
if(prefs == null)
|
if (prefs == null)
|
||||||
{
|
{
|
||||||
Log.e(MainActivity.APP_ID, "SharedPreferences not initialized via setSharedPreferences!");
|
Log.e(MainActivity.APP_ID,
|
||||||
|
"SharedPreferences not initialized via setSharedPreferences!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(res == null)
|
if (res == null)
|
||||||
{
|
{
|
||||||
Log.e(MainActivity.APP_ID, "Resources not initialized via setResources!");
|
Log.e(MainActivity.APP_ID, "Resources not initialized via setResources!");
|
||||||
return false;
|
return false;
|
||||||
|
@ -79,7 +81,7 @@ public class SettingsActivity extends PreferenceActivity
|
||||||
|
|
||||||
public String getPrefNumericLanguage()
|
public String getPrefNumericLanguage()
|
||||||
{
|
{
|
||||||
if(isFullyInitilaized())
|
if (isFullyInitilaized())
|
||||||
return prefs.getString(
|
return prefs.getString(
|
||||||
PREF_NUMERIC_LANGUAGE,
|
PREF_NUMERIC_LANGUAGE,
|
||||||
res.getStringArray(R.array.pref_alias_message_formatting)[0]);
|
res.getStringArray(R.array.pref_alias_message_formatting)[0]);
|
||||||
|
@ -88,16 +90,17 @@ public class SettingsActivity extends PreferenceActivity
|
||||||
|
|
||||||
public void setPrefNumericLanguage(String lang)
|
public void setPrefNumericLanguage(String lang)
|
||||||
{
|
{
|
||||||
if(isFullyInitilaized())
|
if (isFullyInitilaized())
|
||||||
prefs.edit().putString(PREF_NUMERIC_LANGUAGE, lang).apply();
|
prefs.edit().putString(PREF_NUMERIC_LANGUAGE, lang).apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean prefNumericLanguageChanged()
|
public boolean prefNumericLanguageChanged()
|
||||||
{
|
{
|
||||||
if(this.previousPrefNumericLanguage == null || !this.previousPrefNumericLanguage.equals(getPrefNumericLanguage()))
|
if (this.previousPrefNumericLanguage == null || !this.previousPrefNumericLanguage.equals(
|
||||||
|
getPrefNumericLanguage()))
|
||||||
{
|
{
|
||||||
this.previousPrefNumericLanguage = this.getPrefNumericLanguage();
|
this.previousPrefNumericLanguage = this.getPrefNumericLanguage();
|
||||||
Log.d(MainActivity.APP_ID, PREF_NUMERIC_LANGUAGE +" changed!");
|
Log.d(MainActivity.APP_ID, PREF_NUMERIC_LANGUAGE+" changed!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -105,24 +108,24 @@ public class SettingsActivity extends PreferenceActivity
|
||||||
|
|
||||||
public boolean getPrefReplaceSpecialCharacters()
|
public boolean getPrefReplaceSpecialCharacters()
|
||||||
{
|
{
|
||||||
if(isFullyInitilaized())
|
if (isFullyInitilaized())
|
||||||
return prefs.getBoolean(PREF_REPLACE_SPECIAL_CHARACTERS, true);
|
return prefs.getBoolean(PREF_REPLACE_SPECIAL_CHARACTERS, true);
|
||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPrefReplaceSpecialCharacters(boolean replace)
|
public void setPrefReplaceSpecialCharacters(boolean replace)
|
||||||
{
|
{
|
||||||
if(isFullyInitilaized())
|
if (isFullyInitilaized())
|
||||||
prefs.edit().putBoolean(PREF_REPLACE_SPECIAL_CHARACTERS, replace).apply();
|
prefs.edit().putBoolean(PREF_REPLACE_SPECIAL_CHARACTERS, replace).apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean prefReplaceSpecialCharactersChanged()
|
public boolean prefReplaceSpecialCharactersChanged()
|
||||||
{
|
{
|
||||||
boolean changed = previousPrefReplaceSpecialCharacters != getPrefReplaceSpecialCharacters();
|
boolean changed = previousPrefReplaceSpecialCharacters != getPrefReplaceSpecialCharacters();
|
||||||
if(changed)
|
if (changed)
|
||||||
{
|
{
|
||||||
previousPrefReplaceSpecialCharacters = getPrefReplaceSpecialCharacters();
|
previousPrefReplaceSpecialCharacters = getPrefReplaceSpecialCharacters();
|
||||||
Log.d(MainActivity.APP_ID, PREF_REPLACE_SPECIAL_CHARACTERS +" changed!");
|
Log.d(MainActivity.APP_ID, PREF_REPLACE_SPECIAL_CHARACTERS+" changed!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -130,7 +133,7 @@ public class SettingsActivity extends PreferenceActivity
|
||||||
|
|
||||||
public String getPrefMachineType()
|
public String getPrefMachineType()
|
||||||
{
|
{
|
||||||
if(isFullyInitilaized())
|
if (isFullyInitilaized())
|
||||||
return prefs.getString(PREF_MACHINE_TYPE,
|
return prefs.getString(PREF_MACHINE_TYPE,
|
||||||
res.getStringArray(R.array.pref_alias_machine_type)[0]);
|
res.getStringArray(R.array.pref_alias_machine_type)[0]);
|
||||||
else return null;
|
else return null;
|
||||||
|
@ -138,16 +141,17 @@ public class SettingsActivity extends PreferenceActivity
|
||||||
|
|
||||||
public void setPrefMachineType(String pref)
|
public void setPrefMachineType(String pref)
|
||||||
{
|
{
|
||||||
if(isFullyInitilaized())
|
if (isFullyInitilaized())
|
||||||
prefs.edit().putString(PREF_MACHINE_TYPE, pref).apply();
|
prefs.edit().putString(PREF_MACHINE_TYPE, pref).apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean prefMachineTypeChanged()
|
public boolean prefMachineTypeChanged()
|
||||||
{
|
{
|
||||||
if(this.previousPrefMachineType == null || !this.previousPrefMachineType.equals(getPrefMachineType()))
|
if (this.previousPrefMachineType == null || !this.previousPrefMachineType.equals(
|
||||||
|
getPrefMachineType()))
|
||||||
{
|
{
|
||||||
this.previousPrefMachineType = this.getPrefMachineType();
|
this.previousPrefMachineType = this.getPrefMachineType();
|
||||||
Log.d(MainActivity.APP_ID, PREF_MACHINE_TYPE +" changed!");
|
Log.d(MainActivity.APP_ID, PREF_MACHINE_TYPE+" changed!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -155,7 +159,7 @@ public class SettingsActivity extends PreferenceActivity
|
||||||
|
|
||||||
public String getPrefSavedEnigmaState()
|
public String getPrefSavedEnigmaState()
|
||||||
{
|
{
|
||||||
if(isFullyInitilaized())
|
if (isFullyInitilaized())
|
||||||
return prefs.getString(PREF_SAVED_ENIGMA_STATE, "-1");
|
return prefs.getString(PREF_SAVED_ENIGMA_STATE, "-1");
|
||||||
else return null;
|
else return null;
|
||||||
}
|
}
|
||||||
|
@ -165,17 +169,17 @@ public class SettingsActivity extends PreferenceActivity
|
||||||
*/
|
*/
|
||||||
public void setPrefSavedEnigmaState(String state)
|
public void setPrefSavedEnigmaState(String state)
|
||||||
{
|
{
|
||||||
if(isFullyInitilaized())
|
if (isFullyInitilaized())
|
||||||
prefs.edit().putString(PREF_SAVED_ENIGMA_STATE, state).apply();
|
prefs.edit().putString(PREF_SAVED_ENIGMA_STATE, state).apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean prefSavedEnigmaStateChanged()
|
public boolean prefSavedEnigmaStateChanged()
|
||||||
{
|
{
|
||||||
if(this.previousPrefSavedEnigmaState == null || !this.previousPrefSavedEnigmaState
|
if (this.previousPrefSavedEnigmaState == null || !this.previousPrefSavedEnigmaState
|
||||||
.equals(getPrefSavedEnigmaState()))
|
.equals(getPrefSavedEnigmaState()))
|
||||||
{
|
{
|
||||||
this.previousPrefSavedEnigmaState = this.getPrefSavedEnigmaState();
|
this.previousPrefSavedEnigmaState = this.getPrefSavedEnigmaState();
|
||||||
Log.d(MainActivity.APP_ID, PREF_SAVED_ENIGMA_STATE +" changed!");
|
Log.d(MainActivity.APP_ID, PREF_SAVED_ENIGMA_STATE+" changed!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -183,7 +187,7 @@ public class SettingsActivity extends PreferenceActivity
|
||||||
|
|
||||||
public String getPrefMessageFormatting()
|
public String getPrefMessageFormatting()
|
||||||
{
|
{
|
||||||
if(isFullyInitilaized())
|
if (isFullyInitilaized())
|
||||||
return prefs.getString(SettingsActivity.PREF_MESSAGE_FORMATTING,
|
return prefs.getString(SettingsActivity.PREF_MESSAGE_FORMATTING,
|
||||||
res.getStringArray(R.array.pref_alias_message_formatting)[0]);
|
res.getStringArray(R.array.pref_alias_message_formatting)[0]);
|
||||||
else return null;
|
else return null;
|
||||||
|
@ -191,17 +195,17 @@ public class SettingsActivity extends PreferenceActivity
|
||||||
|
|
||||||
public void setPrefMessageFormatting(String format)
|
public void setPrefMessageFormatting(String format)
|
||||||
{
|
{
|
||||||
if(isFullyInitilaized())
|
if (isFullyInitilaized())
|
||||||
prefs.edit().putString(PREF_MESSAGE_FORMATTING, format).apply();
|
prefs.edit().putString(PREF_MESSAGE_FORMATTING, format).apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean prefMessageFormattingChanged()
|
public boolean prefMessageFormattingChanged()
|
||||||
{
|
{
|
||||||
if(this.previousPrefMessageFormatting == null || !this.previousPrefMessageFormatting
|
if (this.previousPrefMessageFormatting == null || !this.previousPrefMessageFormatting
|
||||||
.equals(getPrefMessageFormatting()))
|
.equals(getPrefMessageFormatting()))
|
||||||
{
|
{
|
||||||
this.previousPrefMessageFormatting = this.getPrefMessageFormatting();
|
this.previousPrefMessageFormatting = this.getPrefMessageFormatting();
|
||||||
Log.d(MainActivity.APP_ID, PREF_MESSAGE_FORMATTING +" changed!");
|
Log.d(MainActivity.APP_ID, PREF_MESSAGE_FORMATTING+" changed!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -209,20 +213,21 @@ public class SettingsActivity extends PreferenceActivity
|
||||||
|
|
||||||
public int getVersionNumber()
|
public int getVersionNumber()
|
||||||
{
|
{
|
||||||
if(isFullyInitilaized())
|
if (isFullyInitilaized())
|
||||||
return prefs.getInt(PREF_VERSION_NUMBER, -1);
|
return prefs.getInt(PREF_VERSION_NUMBER, -1);
|
||||||
else return -1;
|
else return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVersionNumber(int v)
|
public void setVersionNumber(int v)
|
||||||
{
|
{
|
||||||
if(isFullyInitilaized())
|
if (isFullyInitilaized())
|
||||||
prefs.edit().putInt(PREF_VERSION_NUMBER, v).apply();
|
prefs.edit().putInt(PREF_VERSION_NUMBER, v).apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class SettingsSingleton extends SettingsActivity
|
public static class SettingsSingleton extends SettingsActivity
|
||||||
{
|
{
|
||||||
private static SettingsActivity instance;
|
private static SettingsActivity instance;
|
||||||
|
|
||||||
private SettingsSingleton()
|
private SettingsSingleton()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
|
@ -238,7 +243,7 @@ public class SettingsActivity extends PreferenceActivity
|
||||||
|
|
||||||
public static SettingsActivity getInstance()
|
public static SettingsActivity getInstance()
|
||||||
{
|
{
|
||||||
if(instance == null)
|
if (instance == null)
|
||||||
{
|
{
|
||||||
instance = new SettingsActivity();
|
instance = new SettingsActivity();
|
||||||
Log.d(MainActivity.APP_ID, "Created new SettingsActivity!");
|
Log.d(MainActivity.APP_ID, "Created new SettingsActivity!");
|
||||||
|
|
|
@ -5,9 +5,9 @@ import java.util.ArrayList;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import de.vanitasvitae.enigmandroid.MainActivity;
|
import de.vanitasvitae.enigmandroid.MainActivity;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.EntryWheel;
|
import de.vanitasvitae.enigmandroid.enigma.parts.EntryWheel;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.Reflector;
|
import de.vanitasvitae.enigmandroid.enigma.parts.Reflector;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.Rotor;
|
import de.vanitasvitae.enigmandroid.enigma.parts.Rotor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main component of the Enigma machine
|
* Main component of the Enigma machine
|
||||||
|
|
|
@ -5,9 +5,10 @@ import android.util.Log;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import de.vanitasvitae.enigmandroid.MainActivity;
|
import de.vanitasvitae.enigmandroid.MainActivity;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.EntryWheel;
|
import de.vanitasvitae.enigmandroid.enigma.parts.EntryWheel;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.Reflector;
|
import de.vanitasvitae.enigmandroid.enigma.parts.Plugboard;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.Rotor;
|
import de.vanitasvitae.enigmandroid.enigma.parts.Reflector;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.parts.Rotor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Concrete implementation of an enigma machine of name D
|
* Concrete implementation of an enigma machine of name D
|
||||||
|
|
|
@ -5,9 +5,9 @@ import android.util.Log;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import de.vanitasvitae.enigmandroid.MainActivity;
|
import de.vanitasvitae.enigmandroid.MainActivity;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.EntryWheel;
|
import de.vanitasvitae.enigmandroid.enigma.parts.EntryWheel;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.Reflector;
|
import de.vanitasvitae.enigmandroid.enigma.parts.Reflector;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.Rotor;
|
import de.vanitasvitae.enigmandroid.enigma.parts.Rotor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of the Enigma machine of name G31 (Abwehr)
|
* Implementation of the Enigma machine of name G31 (Abwehr)
|
||||||
|
|
|
@ -5,9 +5,9 @@ import android.util.Log;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import de.vanitasvitae.enigmandroid.MainActivity;
|
import de.vanitasvitae.enigmandroid.MainActivity;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.EntryWheel;
|
import de.vanitasvitae.enigmandroid.enigma.parts.EntryWheel;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.Reflector;
|
import de.vanitasvitae.enigmandroid.enigma.parts.Reflector;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.Rotor;
|
import de.vanitasvitae.enigmandroid.enigma.parts.Rotor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of the Enigma machine of name G31 (Abwehr)
|
* Implementation of the Enigma machine of name G31 (Abwehr)
|
||||||
|
|
|
@ -5,9 +5,9 @@ import android.util.Log;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import de.vanitasvitae.enigmandroid.MainActivity;
|
import de.vanitasvitae.enigmandroid.MainActivity;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.EntryWheel;
|
import de.vanitasvitae.enigmandroid.enigma.parts.EntryWheel;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.Reflector;
|
import de.vanitasvitae.enigmandroid.enigma.parts.Reflector;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.Rotor;
|
import de.vanitasvitae.enigmandroid.enigma.parts.Rotor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of the Enigma machine of name G31 (Abwehr)
|
* Implementation of the Enigma machine of name G31 (Abwehr)
|
||||||
|
|
|
@ -5,9 +5,10 @@ import android.util.Log;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import de.vanitasvitae.enigmandroid.MainActivity;
|
import de.vanitasvitae.enigmandroid.MainActivity;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.EntryWheel;
|
import de.vanitasvitae.enigmandroid.enigma.parts.EntryWheel;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.Reflector;
|
import de.vanitasvitae.enigmandroid.enigma.parts.Plugboard;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.Rotor;
|
import de.vanitasvitae.enigmandroid.enigma.parts.Reflector;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.parts.Rotor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Concrete implementation of an enigma machine of name I
|
* Concrete implementation of an enigma machine of name I
|
||||||
|
|
|
@ -5,9 +5,9 @@ import android.util.Log;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import de.vanitasvitae.enigmandroid.MainActivity;
|
import de.vanitasvitae.enigmandroid.MainActivity;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.EntryWheel;
|
import de.vanitasvitae.enigmandroid.enigma.parts.EntryWheel;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.Reflector;
|
import de.vanitasvitae.enigmandroid.enigma.parts.Reflector;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.Rotor;
|
import de.vanitasvitae.enigmandroid.enigma.parts.Rotor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of the Enigma machine of name K
|
* Implementation of the Enigma machine of name K
|
||||||
|
|
|
@ -5,9 +5,10 @@ import android.util.Log;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import de.vanitasvitae.enigmandroid.MainActivity;
|
import de.vanitasvitae.enigmandroid.MainActivity;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.EntryWheel;
|
import de.vanitasvitae.enigmandroid.enigma.parts.EntryWheel;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.Reflector;
|
import de.vanitasvitae.enigmandroid.enigma.parts.Plugboard;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.Rotor;
|
import de.vanitasvitae.enigmandroid.enigma.parts.Reflector;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.parts.Rotor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Concrete implementation of an enigma machine of name D
|
* Concrete implementation of an enigma machine of name D
|
||||||
|
@ -47,7 +48,7 @@ public class Enigma_KD extends Enigma {
|
||||||
@Override
|
@Override
|
||||||
protected void establishAvailableParts()
|
protected void establishAvailableParts()
|
||||||
{
|
{
|
||||||
addAvailableEntryWheel(new EntryWheel.EntryWheel_QWERTZ()); //TODO: Really?
|
addAvailableEntryWheel(new EntryWheel.EntryWheel_QWERTZ());
|
||||||
|
|
||||||
addAvailableRotor(new Rotor.Rotor_KD_I(0, 0));
|
addAvailableRotor(new Rotor.Rotor_KD_I(0, 0));
|
||||||
addAvailableRotor(new Rotor.Rotor_KD_II(0, 0));
|
addAvailableRotor(new Rotor.Rotor_KD_II(0, 0));
|
||||||
|
@ -232,7 +233,7 @@ public class Enigma_KD extends Enigma {
|
||||||
s = addDigit(s, rotor2.getIndex(), availableRotors.size());
|
s = addDigit(s, rotor2.getIndex(), availableRotors.size());
|
||||||
s = addDigit(s, rotor1.getIndex(), availableRotors.size());
|
s = addDigit(s, rotor1.getIndex(), availableRotors.size());
|
||||||
|
|
||||||
s = addDigit(s, 12, 20); //Machine #12 TODO: Reorder?
|
s = addDigit(s, 12, 20); //Machine #12
|
||||||
s = addDigit(s, protocol_version, MainActivity.max_protocol_version);
|
s = addDigit(s, protocol_version, MainActivity.max_protocol_version);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
|
|
|
@ -5,9 +5,9 @@ import android.util.Log;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import de.vanitasvitae.enigmandroid.MainActivity;
|
import de.vanitasvitae.enigmandroid.MainActivity;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.EntryWheel;
|
import de.vanitasvitae.enigmandroid.enigma.parts.EntryWheel;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.Reflector;
|
import de.vanitasvitae.enigmandroid.enigma.parts.Reflector;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.Rotor;
|
import de.vanitasvitae.enigmandroid.enigma.parts.Rotor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of the Enigma machine of name K (Switzerland, Airforce)
|
* Implementation of the Enigma machine of name K (Switzerland, Airforce)
|
||||||
|
|
|
@ -5,9 +5,9 @@ import android.util.Log;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import de.vanitasvitae.enigmandroid.MainActivity;
|
import de.vanitasvitae.enigmandroid.MainActivity;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.EntryWheel;
|
import de.vanitasvitae.enigmandroid.enigma.parts.EntryWheel;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.Reflector;
|
import de.vanitasvitae.enigmandroid.enigma.parts.Reflector;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.Rotor;
|
import de.vanitasvitae.enigmandroid.enigma.parts.Rotor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of the Enigma machine of name K (Switzerland)
|
* Implementation of the Enigma machine of name K (Switzerland)
|
||||||
|
|
|
@ -5,9 +5,10 @@ import android.util.Log;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import de.vanitasvitae.enigmandroid.MainActivity;
|
import de.vanitasvitae.enigmandroid.MainActivity;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.EntryWheel;
|
import de.vanitasvitae.enigmandroid.enigma.parts.EntryWheel;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.Reflector;
|
import de.vanitasvitae.enigmandroid.enigma.parts.Plugboard;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.Rotor;
|
import de.vanitasvitae.enigmandroid.enigma.parts.Reflector;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.parts.Rotor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Concrete implementation of an enigma machine model M3
|
* Concrete implementation of an enigma machine model M3
|
||||||
|
|
|
@ -6,9 +6,10 @@ import java.math.BigInteger;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import de.vanitasvitae.enigmandroid.MainActivity;
|
import de.vanitasvitae.enigmandroid.MainActivity;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.EntryWheel;
|
import de.vanitasvitae.enigmandroid.enigma.parts.EntryWheel;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.Reflector;
|
import de.vanitasvitae.enigmandroid.enigma.parts.Plugboard;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.Rotor;
|
import de.vanitasvitae.enigmandroid.enigma.parts.Reflector;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.parts.Rotor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Concrete Implementation of the Enigma Machine name M4 of the german Kriegsmarine
|
* Concrete Implementation of the Enigma Machine name M4 of the german Kriegsmarine
|
||||||
|
|
|
@ -5,9 +5,9 @@ import android.util.Log;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import de.vanitasvitae.enigmandroid.MainActivity;
|
import de.vanitasvitae.enigmandroid.MainActivity;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.EntryWheel;
|
import de.vanitasvitae.enigmandroid.enigma.parts.EntryWheel;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.Reflector;
|
import de.vanitasvitae.enigmandroid.enigma.parts.Reflector;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.Rotor;
|
import de.vanitasvitae.enigmandroid.enigma.parts.Rotor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of the Enigma machine of name R ("Rocket", Reichsbahn)
|
* Implementation of the Enigma machine of name R ("Rocket", Reichsbahn)
|
||||||
|
|
|
@ -5,9 +5,9 @@ import android.util.Log;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import de.vanitasvitae.enigmandroid.MainActivity;
|
import de.vanitasvitae.enigmandroid.MainActivity;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.EntryWheel;
|
import de.vanitasvitae.enigmandroid.enigma.parts.EntryWheel;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.Reflector;
|
import de.vanitasvitae.enigmandroid.enigma.parts.Reflector;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.Rotor;
|
import de.vanitasvitae.enigmandroid.enigma.parts.Rotor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of the Enigma machine of name T Tirpitz
|
* Implementation of the Enigma machine of name T Tirpitz
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package de.vanitasvitae.enigmandroid.enigma.rotors;
|
package de.vanitasvitae.enigmandroid.enigma.parts;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of several EntryWheels
|
* Implementation of several EntryWheels
|
|
@ -1,4 +1,4 @@
|
||||||
package de.vanitasvitae.enigmandroid.enigma;
|
package de.vanitasvitae.enigmandroid.enigma.parts;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import java.util.Arrays;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import de.vanitasvitae.enigmandroid.MainActivity;
|
import de.vanitasvitae.enigmandroid.MainActivity;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.Enigma;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.inputPreparer.InputPreparer;
|
import de.vanitasvitae.enigmandroid.enigma.inputPreparer.InputPreparer;
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -1,4 +1,4 @@
|
||||||
package de.vanitasvitae.enigmandroid.enigma.rotors;
|
package de.vanitasvitae.enigmandroid.enigma.parts;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ import java.util.Arrays;
|
||||||
|
|
||||||
import de.vanitasvitae.enigmandroid.MainActivity;
|
import de.vanitasvitae.enigmandroid.MainActivity;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.Enigma;
|
import de.vanitasvitae.enigmandroid.enigma.Enigma;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.Plugboard;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reflector of the enigma machine.
|
* Reflector of the enigma machine.
|
|
@ -1,4 +1,4 @@
|
||||||
package de.vanitasvitae.enigmandroid.enigma.rotors;
|
package de.vanitasvitae.enigmandroid.enigma.parts;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
|
@ -189,4 +189,3 @@ public abstract class LayoutContainer
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue