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
// Si la suma de las dos pilas es 3, hay dos elementos en la 1eraprila y uno en la 2da pila | |
if (cantOperandos > 1 && cantOperandos < 4 && validaEntrada(operacion,cantOperandos)) { | |
Permutacion auxiliar1,auxiliar2; | |
if(cantOperandos == 3){ // si (R0 * R1) | |
auxiliar1 = miTriangulo.buscaPermutacion(PrimeraOperacion.pop()); //Este es R1 | |
auxiliar2 = miTriangulo.buscaPermutacion(PrimeraOperacion.pop()); //Este es R0 | |
resultado = miTriangulo.operarPermutaciones(auxiliar2,auxiliar1); | |
muestraExplicacion(auxiliar2,auxiliar1,false); | |
auxiliar2 = miTriangulo.buscaPermutacion(SegundaOperacion.pop()); | |
//Si operador=true. Es de esta forma. Ej: (R0*R1) * Pi0 |
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
//Separando elementos de la expresión | |
for (int n = 0; n < operacion.length(); n++) { | |
c = operacion.charAt(n); | |
if ( c != '(' && c != '*' && c != ' ' && c != ')' ){ //Mientras no sea un caracter especial | |
aux+=c; //Acumulamos | |
}else{ | |
if (bandera) | |
PrimeraOperacion.push(aux); | |
else{ | |
if (c == '(') |
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
//Método de la clase TrianguloE. Realiza la composición de las permutaciones recibidas y la retorna | |
public Permutacion operarPermutaciones(Permutacion p1, Permutacion p2){ | |
int pos1,pos2,pos3; | |
pos1 = p2.devuelveVert(p1.devuelveVert(1)); | |
pos2 = p2.devuelveVert(p1.devuelveVert(2)); | |
pos3 = p2.devuelveVert(p1.devuelveVert(3)); | |
Permutacion aux; | |
aux = new Permutacion (pos1,pos2,pos3); | |
asignaNombre(aux); | |
return aux; |
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
//Método de clase TianguloE.Realiza la composición de las permutaciones recibidas y la retorna | |
public Permutacion operarPermutaciones(Permutacion p1, Permutacion p2){ | |
int pos1,pos2,pos3; | |
pos1 = p2.getVertice(p1.getVertice(1)); | |
pos2 = p2.getVertice(p1.getVertice(2)); | |
pos3 = p2.getVertice(p1.getVertice(3)); | |
Permutacion aux; | |
aux = new Permutacion (pos1,pos2,pos3); | |
asignaNombre(aux); |
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
//Método que realiza la composición de las permutaciones recibidas y la retorna | |
public Permutacion operarPermutaciones(Permutacion p1, Permutacion p2){ | |
int pos1,pos2,pos3; | |
pos1 = p2.devuelveVert(p1.devuelveVert(1)); | |
pos2 = p2.devuelveVert(p1.devuelveVert(2)); | |
pos3 = p2.devuelveVert(p1.devuelveVert(3)); | |
Permutacion aux; | |
aux = new Permutacion (pos1,pos2,pos3); | |
asignaNombre(aux); |
NewerOlder