Skip to content

Instantly share code, notes, and snippets.

View oppahero's full-sized avatar
🎯
Focusing

María López oppahero

🎯
Focusing
View GitHub Profile
// 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
//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 == '(')
@oppahero
oppahero / .java
Last active April 1, 2018 17:40
Algoritmo principal
//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;
//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);
//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);