1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| public class CalculusThread extends Thread {
// Propriety
Fenetre fenetre;
// Constructor
public CalculusThread(Fenetre fenetre) {
// TODO Auto-generated constructor stub
this.fenetre = fenetre;
}
// Run
public void run() {
try {
MonteCarloSimulationNtimes simulation = new MonteCarloSimulationNtimes(
fenetre.getCallPutFlag(), Double.parseDouble(fenetre
.getJtf2().getText()), Double.parseDouble(fenetre
.getJtf3().getText()), Double.parseDouble(fenetre
.getJtf4().getText()), Double.parseDouble(fenetre
.getJtf5().getText()), Double.parseDouble(fenetre
.getJtf6().getText()), Double.parseDouble(fenetre
.getJtf7().getText()), Double.parseDouble(fenetre
.getJtf8().getText()), Double.parseDouble(fenetre
.getJtf9().getText()));
if (fenetre.getCallPutFlag() == null) {
fenetre.getMessage().setText(
"Please choose either call or put option!");
} else {
double dResultat = simulation.calcul();
System.out.println(String.valueOf(dResultat));
fenetre.getResultat().setText(
"Please choose either call or put option!");
}
} catch (NumberFormatException e) {
fenetre.getMessage().setText(
"Please give me all the characteristics of the option!");
}
}
} |
Partager