Skip to content

Commit f2185eb

Browse files
author
Raven G. Duran
committed
Added capabilities for future operations
1 parent 0a296cf commit f2185eb

File tree

9 files changed

+503
-26
lines changed

9 files changed

+503
-26
lines changed
2.46 KB
Binary file not shown.

build/preprocessed/hello/HelloMIDlet.java

Lines changed: 191 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ public class HelloMIDlet extends MIDlet implements CommandListener {
3030
private Command okCommand9;
3131
private Command okCommand7;
3232
private Command helpCommand1;
33+
private Command okCommand10;
34+
private Command okCommand11;
3335
private Form Modulo;
3436
private TextField textField;
3537
private Spacer spacer;
@@ -58,6 +60,11 @@ public class HelloMIDlet extends MIDlet implements CommandListener {
5860
private TextField textField11;
5961
private Form HexaToDeci;
6062
private TextField textField12;
63+
private Form caesarEncryption;
64+
private StringItem stringItem;
65+
private TextField textField14;
66+
private TextField textField13;
67+
private Form customEncryption;
6168
private Image image1;
6269
//</editor-fold>//GEN-END:|fields|0|
6370

@@ -351,6 +358,10 @@ public void commandAction(Command command, Displayable displayable) {//GEN-END:|
351358
switchDisplayable(null,getOctaToDeci());
352359
} else if (choiceGroup.getSelectedIndex() == 9){
353360
switchDisplayable(null,getHexaToDeci());
361+
} else if (choiceGroup.getSelectedIndex() == 10){
362+
switchDisplayable(null,getCaesarEncryption());
363+
} else if (choiceGroup.getSelectedIndex() == 11){
364+
switchDisplayable(null,getCustomEncryption());
354365
}
355366
//GEN-LINE:|7-commandAction|46|57-postAction
356367
// write post-a ction user code here
@@ -428,17 +439,70 @@ public void commandAction(Command command, Displayable displayable) {//GEN-END:|
428439
getResultBox().setString(pFactors);
429440
switchDisplayable(getResultBox(), getPrimeFactor());//GEN-LINE:|7-commandAction|64|43-postAction
430441
// write post-action user code here
431-
}//GEN-BEGIN:|7-commandAction|65|119-preAction
442+
}//GEN-BEGIN:|7-commandAction|65|217-preAction
443+
} else if (displayable == caesarEncryption) {
444+
if (command == exitCommand) {//GEN-END:|7-commandAction|65|217-preAction
445+
// write pre-action user code here
446+
exitMIDlet();//GEN-LINE:|7-commandAction|66|217-postAction
447+
// write post-action user code here
448+
} else if (command == helpCommand1) {//GEN-LINE:|7-commandAction|67|218-preAction
449+
// write pre-action user code here
450+
switchDisplayable(null, getMenu());//GEN-LINE:|7-commandAction|68|218-postAction
451+
// write post-action user code here
452+
} else if (command == okCommand10) {//GEN-LINE:|7-commandAction|69|220-preAction
453+
// write pre-action user code here
454+
String encrypted = this.textField13.getString().trim().toLowerCase();
455+
String real = this.textField14.getString().trim().toLowerCase();
456+
String temp = "";
457+
458+
//This section establishes the alphabet in an ArrayList.
459+
char[] reference = new char[100];
460+
for(char i = 'a',j = 0; i <= 'a' + 25; i++, j++) reference[j] = i;
461+
462+
//This section handles the encryption
463+
if (encrypted != null && !"".equals(encrypted)){
464+
for(int i = 0; i < encrypted.length(); i++){
465+
//Checks to see if the character is a letter
466+
temp += reference[ ( (encrypted.charAt(i)) - 3) %26];
467+
}
468+
textField14.setString(temp);
469+
} else if (real != null && !"".equals(real)){
470+
for(int i = 0; i < real.length(); i++){
471+
//Checks to see if the character is a letter
472+
temp += reference[ ( reference.toString().indexOf(real.charAt(i)) + 1 + 3) %26];
473+
}
474+
textField13.setString(temp);
475+
}
476+
477+
478+
479+
switchDisplayable(null, getCaesarEncryption());//GEN-LINE:|7-commandAction|70|220-postAction
480+
// write post-action user code here
481+
}//GEN-BEGIN:|7-commandAction|71|227-preAction
482+
} else if (displayable == customEncryption) {
483+
if (command == exitCommand) {//GEN-END:|7-commandAction|71|227-preAction
484+
// write pre-action user code here
485+
exitMIDlet();//GEN-LINE:|7-commandAction|72|227-postAction
486+
// write post-action user code here
487+
} else if (command == helpCommand1) {//GEN-LINE:|7-commandAction|73|228-preAction
488+
// write pre-action user code here
489+
switchDisplayable(null, getMenu());//GEN-LINE:|7-commandAction|74|228-postAction
490+
// write post-action user code here
491+
} else if (command == okCommand11) {//GEN-LINE:|7-commandAction|75|226-preAction
492+
// write pre-action user code here
493+
switchDisplayable(getResultBox(), getCustomEncryption());//GEN-LINE:|7-commandAction|76|226-postAction
494+
// write post-action user code here
495+
}//GEN-BEGIN:|7-commandAction|77|119-preAction
432496
} else if (displayable == splashScreen) {
433-
if (command == SplashScreen.DISMISS_COMMAND) {//GEN-END:|7-commandAction|65|119-preAction
497+
if (command == SplashScreen.DISMISS_COMMAND) {//GEN-END:|7-commandAction|77|119-preAction
434498
// write pre-action user code here
435-
switchDisplayable(null, getMenu());//GEN-LINE:|7-commandAction|66|119-postAction
499+
switchDisplayable(null, getMenu());//GEN-LINE:|7-commandAction|78|119-postAction
436500
// write post-action user code here
437-
}//GEN-BEGIN:|7-commandAction|67|7-postCommandAction
438-
}//GEN-END:|7-commandAction|67|7-postCommandAction
501+
}//GEN-BEGIN:|7-commandAction|79|7-postCommandAction
502+
}//GEN-END:|7-commandAction|79|7-postCommandAction
439503
// write post-action user code here
440-
}//GEN-BEGIN:|7-commandAction|68|
441-
//</editor-fold>//GEN-END:|7-commandAction|68|
504+
}//GEN-BEGIN:|7-commandAction|80|
505+
//</editor-fold>//GEN-END:|7-commandAction|80|
442506

443507

444508

@@ -1223,6 +1287,126 @@ public Command getHelpCommand1() {
12231287
}
12241288
//</editor-fold>//GEN-END:|193-getter|2|
12251289

1290+
//<editor-fold defaultstate="collapsed" desc=" Generated Getter: okCommand10 ">//GEN-BEGIN:|219-getter|0|219-preInit
1291+
/**
1292+
* Returns an initialized instance of okCommand10 component.
1293+
*
1294+
* @return the initialized component instance
1295+
*/
1296+
public Command getOkCommand10() {
1297+
if (okCommand10 == null) {//GEN-END:|219-getter|0|219-preInit
1298+
// write pre-init user code here
1299+
okCommand10 = new Command("Ok", Command.OK, 0);//GEN-LINE:|219-getter|1|219-postInit
1300+
// write post-init user code here
1301+
}//GEN-BEGIN:|219-getter|2|
1302+
return okCommand10;
1303+
}
1304+
//</editor-fold>//GEN-END:|219-getter|2|
1305+
1306+
//<editor-fold defaultstate="collapsed" desc=" Generated Getter: caesarEncryption ">//GEN-BEGIN:|216-getter|0|216-preInit
1307+
/**
1308+
* Returns an initialized instance of caesarEncryption component.
1309+
*
1310+
* @return the initialized component instance
1311+
*/
1312+
public Form getCaesarEncryption() {
1313+
if (caesarEncryption == null) {//GEN-END:|216-getter|0|216-preInit
1314+
// write pre-init user code here
1315+
caesarEncryption = new Form("Caesar\'s Encryption", new Item[]{getStringItem(), getTextField13(), getTextField14()});//GEN-BEGIN:|216-getter|1|216-postInit
1316+
caesarEncryption.addCommand(getExitCommand());
1317+
caesarEncryption.addCommand(getHelpCommand1());
1318+
caesarEncryption.addCommand(getOkCommand10());
1319+
caesarEncryption.setCommandListener(this);//GEN-END:|216-getter|1|216-postInit
1320+
// write post-init user code here
1321+
}//GEN-BEGIN:|216-getter|2|
1322+
return caesarEncryption;
1323+
}
1324+
//</editor-fold>//GEN-END:|216-getter|2|
1325+
1326+
//<editor-fold defaultstate="collapsed" desc=" Generated Getter: okCommand11 ">//GEN-BEGIN:|225-getter|0|225-preInit
1327+
/**
1328+
* Returns an initialized instance of okCommand11 component.
1329+
*
1330+
* @return the initialized component instance
1331+
*/
1332+
public Command getOkCommand11() {
1333+
if (okCommand11 == null) {//GEN-END:|225-getter|0|225-preInit
1334+
// write pre-init user code here
1335+
okCommand11 = new Command("Ok", Command.OK, 0);//GEN-LINE:|225-getter|1|225-postInit
1336+
// write post-init user code here
1337+
}//GEN-BEGIN:|225-getter|2|
1338+
return okCommand11;
1339+
}
1340+
//</editor-fold>//GEN-END:|225-getter|2|
1341+
1342+
//<editor-fold defaultstate="collapsed" desc=" Generated Getter: customEncryption ">//GEN-BEGIN:|224-getter|0|224-preInit
1343+
/**
1344+
* Returns an initialized instance of customEncryption component.
1345+
*
1346+
* @return the initialized component instance
1347+
*/
1348+
public Form getCustomEncryption() {
1349+
if (customEncryption == null) {//GEN-END:|224-getter|0|224-preInit
1350+
// write pre-init user code here
1351+
customEncryption = new Form("form");//GEN-BEGIN:|224-getter|1|224-postInit
1352+
customEncryption.addCommand(getOkCommand11());
1353+
customEncryption.addCommand(getExitCommand());
1354+
customEncryption.addCommand(getHelpCommand1());
1355+
customEncryption.setCommandListener(this);//GEN-END:|224-getter|1|224-postInit
1356+
// write post-init user code here
1357+
}//GEN-BEGIN:|224-getter|2|
1358+
return customEncryption;
1359+
}
1360+
//</editor-fold>//GEN-END:|224-getter|2|
1361+
1362+
//<editor-fold defaultstate="collapsed" desc=" Generated Getter: textField13 ">//GEN-BEGIN:|232-getter|0|232-preInit
1363+
/**
1364+
* Returns an initialized instance of textField13 component.
1365+
*
1366+
* @return the initialized component instance
1367+
*/
1368+
public TextField getTextField13() {
1369+
if (textField13 == null) {//GEN-END:|232-getter|0|232-preInit
1370+
// write pre-init user code here
1371+
textField13 = new TextField("Encrypted Message:", "", 32, TextField.ANY);//GEN-LINE:|232-getter|1|232-postInit
1372+
// write post-init user code here
1373+
}//GEN-BEGIN:|232-getter|2|
1374+
return textField13;
1375+
}
1376+
//</editor-fold>//GEN-END:|232-getter|2|
1377+
1378+
//<editor-fold defaultstate="collapsed" desc=" Generated Getter: textField14 ">//GEN-BEGIN:|233-getter|0|233-preInit
1379+
/**
1380+
* Returns an initialized instance of textField14 component.
1381+
*
1382+
* @return the initialized component instance
1383+
*/
1384+
public TextField getTextField14() {
1385+
if (textField14 == null) {//GEN-END:|233-getter|0|233-preInit
1386+
// write pre-init user code here
1387+
textField14 = new TextField("Real Message", "", 32, TextField.ANY);//GEN-LINE:|233-getter|1|233-postInit
1388+
// write post-init user code here
1389+
}//GEN-BEGIN:|233-getter|2|
1390+
return textField14;
1391+
}
1392+
//</editor-fold>//GEN-END:|233-getter|2|
1393+
1394+
//<editor-fold defaultstate="collapsed" desc=" Generated Getter: stringItem ">//GEN-BEGIN:|235-getter|0|235-preInit
1395+
/**
1396+
* Returns an initialized instance of stringItem component.
1397+
*
1398+
* @return the initialized component instance
1399+
*/
1400+
public StringItem getStringItem() {
1401+
if (stringItem == null) {//GEN-END:|235-getter|0|235-preInit
1402+
// write pre-init user code here
1403+
stringItem = new StringItem("Instructions", "If you are given the encrypted message, then write it in the Encrypted Message box and the real message will be shown in the Real message box. You can do this vice versa but not both at the same time.");//GEN-LINE:|235-getter|1|235-postInit
1404+
// write post-init user code here
1405+
}//GEN-BEGIN:|235-getter|2|
1406+
return stringItem;
1407+
}
1408+
//</editor-fold>//GEN-END:|235-getter|2|
1409+
12261410

12271411

12281412

2.92 KB
Binary file not shown.
2.46 KB
Binary file not shown.

dist/Discrete_Math.jad

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIDlet-1: HelloMIDlet,,hello.HelloMIDlet
22
MIDlet-Description: Discrete Math Helper and Calculator
3-
MIDlet-Jar-Size: 101230
3+
MIDlet-Jar-Size: 102477
44
MIDlet-Jar-URL: Discrete_Math.jar
55
MIDlet-Name: Discrete Math Operations
66
MIDlet-Vendor: Raven G. Duran

dist/Discrete_Math.jar

1.22 KB
Binary file not shown.

nbproject/private/private.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#Thu, 27 Sep 2012 14:49:43 +0800
1+
#Thu, 27 Sep 2012 16:16:43 +0800
22
app-version.autoincrement=true
33
config.active=
4-
deployment.counter=22
5-
deployment.number=0.0.21
4+
deployment.counter=30
5+
deployment.number=0.0.29
66
file.reference.Discrete_Math-resources=C\:\\Users\\MDF\\Documents\\NetBeansProjects\\Discrete Math\\Discrete_Math-resources
77
javadoc.preview=true
88
netbeans.user=C\:\\Users\\MDF\\.netbeans\\7.1.2

0 commit comments

Comments
 (0)