This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JNIEXPORT jstring JNICALL Java_ca_weblite_mactools_Sandbox_saveDialog | |
(JNIEnv *env, jobject jthis, jstring title, jstring extension){ | |
JNF_COCOA_ENTER(env); | |
jstring path; | |
//@autoreleasepool { | |
NSString *cocoaExtension = JNFJavaToNSString(env, extension); | |
NSSavePanel *panel = [NSSavePanel savePanel]; | |
NSArray *types = [NSArray arrayWithObjects: cocoaExtension,nil]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mycompany.myapp; | |
public class TowersOfHanoi { | |
public static void move(int n, int startPole, int endPole) { | |
if (n == 0) { | |
return; | |
} | |
int intermediatePole = 6 - startPole - endPole; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void onMain_BtnTowerOfHanoiAction(Component c, ActionEvent event) { | |
final Label towerOfHanoiLabel = this.findLblTowerOfHanoi(); | |
towerOfHanoiLabel.setText("Calculating.... Please wait"); | |
if ( isCalculatingHanoi ){ | |
return; | |
} | |
isCalculatingHanoi = true; | |
Thread t = new Thread(new Runnable(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "com_mycompany_myapp_NativeTowersOfHanoiImpl.h" | |
void com_mycompany_myapp_NativeTowersOfHanoiImpl_move(int n, int startPole, int endPole) { | |
if (n == 0) { | |
return; | |
} | |
int intermediatePole = 6 - startPole - endPole; | |
com_mycompany_myapp_NativeTowersOfHanoiImpl_move(n - 1, startPole, intermediatePole); | |
com_mycompany_myapp_NativeTowersOfHanoiImpl_move(n - 1, intermediatePole, endPole); | |
} | |
@implementation com_mycompany_myapp_NativeTowersOfHanoiImpl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void onMain_BtnNativeTowerOfHanoiAction(Component c, ActionEvent event) { | |
final Label towerOfHanoiLabel = this.findLblTowerOfHanoi(); | |
towerOfHanoiLabel.setText("Calculating.... Please wait"); | |
if ( isCalculatingHanoi ){ | |
return; | |
} | |
isCalculatingHanoi = true; | |
Thread t = new Thread(new Runnable(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "com_mycompany_myapp_NativeTowersOfHanoiImpl.h" | |
static counter = 0; | |
void com_mycompany_myapp_NativeTowersOfHanoiImpl_move(int n, int startPole, int endPole) { | |
if (n == 0) { | |
return; | |
} | |
int intermediatePole = 6 - startPole - endPole; | |
com_mycompany_myapp_NativeTowersOfHanoiImpl_move(n - 1, startPole, intermediatePole); | |
//NSLog(@"Move %i from %i to %i", n, startPole, endPole); | |
com_mycompany_myapp_NativeTowersOfHanoiImpl_move(n - 1, intermediatePole, endPole); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mycompany.myapp; | |
public class TowersOfHanoi { | |
public static int counter = 0; | |
public static void move(int n, int startPole, int endPole) { | |
if (n == 0) { | |
return; | |
} | |
int intermediatePole = 6 - startPole - endPole; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* To change this template, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package com.mycompany.myapp; | |
/** | |
* | |
* @author shannah | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void onMain_BtnTowerOfHanoiAction(Component c, ActionEvent event) { | |
final Label towerOfHanoiLabel = this.findLblTowerOfHanoi(); | |
towerOfHanoiLabel.setText("Calculating.... Please wait"); | |
if ( isCalculatingHanoi ){ | |
return; | |
} | |
isCalculatingHanoi = true; | |
Thread t = new Thread(new Runnable(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "com_mycompany_myapp_NativeTowersOfHanoiImpl.h" | |
@implementation com_mycompany_myapp_NativeTowersOfHanoiImpl | |
-(void)move:(int)n startPole:(int)startPole endPole:(int)endPole | |
{ | |
if (n == 0) { | |
return; | |
} | |
int intermediatePole = 6 - startPole - endPole; |
OlderNewer