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); |
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 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
//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
// 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
//SUMA ENTRE PILAS | |
cantOperandos = primeraOperacion.size() + segundaOperacion.size(); | |
// 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 es de la forma (R0 * R1) | |
auxiliar1 = miTriangulo.buscaPermutacion(primeraOperacion.pop()); //Este es R1 | |
auxiliar2 = miTriangulo.buscaPermutacion(primeraOperacion.pop()); //Este es R0 | |
resultado = miTriangulo.operarPermutaciones(auxiliar2,auxiliar1); |
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
else if(cantOperandos==2){ | |
//Si 1era pila es 2. La operación fue ingresada como (Pi0*R0) | |
if ( primeraOperacion.size() == 2){ | |
auxiliar1=miTriangulo.buscaPermutacion(primeraOperacion.pop()); | |
auxiliar2=miTriangulo.buscaPermutacion(primeraOperacion.pop()); | |
resultado=miTriangulo.operarPermutaciones(auxiliar2, auxiliar1); | |
} | |
else{ //Sino Pi0*R0 | |
auxiliar1=miTriangulo.buscaPermutacion(segundaOperacion.pop()); | |
auxiliar2=miTriangulo.buscaPermutacion(segundaOperacion.pop()); |
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
//Para buscar los subgrupos cíclicos | |
public void generadorCiclico (Permutacion perm){ | |
int i=0; | |
boolean bandera = true; | |
if(perm != null){ | |
ArrayList<Permutacion> aux = new ArrayList<Permutacion>(); | |
Permutacion auxPerm =perm; | |
do{ | |
auxPerm = powT(perm,i); //Usamos la potencia. i: Cantidad de veces a componer |
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 empleado para los generadores cíclicos | |
public Permutacion powT(Permutacion perm, int x){ | |
Permutacion result = new Permutacion(); | |
TrianguloEquilatero aux = new TrianguloEquilatero(); | |
if(x==0) //Si la potencia es 0 | |
result =aux.getPi0(); //El resultado es el elemento neutro (PI0) | |
else if(x==1){ // Si la potencia es 1 | |
result = perm;} // El resultado sera el mismo elemento | |
else if (x>1){ // Si es mayor a 1, alli multiplicaremos | |
result = perm; // primero le asignamos el valor del elemento |
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
//SUMA ENTRE PILAS | |
cantOperandos = PrimeraOperacion.size() + SegundaOperacion.size(); | |
// 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); |
OlderNewer