-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimplex.pde
97 lines (88 loc) · 2.29 KB
/
simplex.pde
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/**
* Based on EditTextControls
*/
import g4p_controls.*;
matriz simplex;
int valorCondiciones,valorVariables;
int numeroPaso=0;
GButton btnMdialogNext,btnMdialogPrev,btnMdialogCancela;
float[][] matrizOriginal;
float[][] pasoActual;
GLabel lblReply;
ArrayList<matriz> matrices;
GWindow paso;
public void setup() {
size(1024, 768, JAVA2D);
createGUI();
matrices = new ArrayList();
numeroPaso=0;
}
public void draw() {
background(240, 240, 200);
// Draw tab order
stroke(0);
strokeWeight(2);
switch(numeroPaso) {
case 1:
if(simplex==null){
text("X1", 10, 30);
text("X2", 30, 30);
simplex=new matriz(valorCondiciones, valorVariables,this);
pasoActual=new float[simplex.cantFilasSimplex()][simplex.cantColumnasSimplex()];//Agrego las 'S'
simplex.recorreMatrixY("dibujaInputMatrix", pasoActual, this);
}
break;
case 2:
if(simplex!=null){
pasoActual=simplex.devuelveMatrizIngresada();
simplex.recorreMatrixY("dibujaOutputMatrix",pasoActual,paso.papplet);
matrices.add(simplex);
label1 = new GLabel(paso.papplet, 472, 374, 80, 20);
}
break;
default:
break;
}
}
public void handleTextEvents(GEditableTextControl tc, GEvent event) {
System.out.print("\n" + tc.tag + " Event type: ");
switch(event) {
case CHANGED:
System.out.println("CHANGED");
break;
case SELECTION_CHANGED:
System.out.println("SELECTION_CHANGED");
System.out.println(tc.getSelectedText() + "\n");
break;
case ENTERED:
System.out.println("ENTER KEY TYPED");
System.out.println(tc.getSelectedText() + "\n");
break;
default:
System.out.println("UNKNOWN");
}
}
public void handleButtonEvents(GButton button, GEvent event) {
if(button == botonNext) {
numeroPaso=2;
ventanaPaso();
}
if(button == botonPrev) {
numeroPaso=3;
}
if(button == botonCancela) {
numeroPaso=0;
//null para todo
simplex.recorreMatrixY("disableInputMatrix",pasoActual,this);
simplex.recorreMatrixY("disableOutputMatrix",pasoActual,paso.papplet);
valorCondiciones=valorVariables=0;
pasoActual=null;
simplex=null;
}
if(button == botonCancelaVentana) {
numeroPaso=0;
//null para todo
simplex.recorreMatrixY("disableOutputMatrix",pasoActual,paso.papplet);
pasoActual=null;
}
}