try to fix

This commit is contained in:
Azael
2017-03-28 14:36:41 +02:00
parent 74fc4cf821
commit 50558136b0

View File

@@ -72,15 +72,14 @@ public class Tree {
Node rightChild = father.getRigthChild(); Node rightChild = father.getRigthChild();
switch (father.getNode()) { switch (father.getNode()) {
case '!' : case '!' :
Node child = leftChild.getLeftChild();
switch (leftChild.getNode()){ switch (leftChild.getNode()){
case '!': case '!':
Node child = leftChild.getLeftChild();
appliedGreatFather(father, child); appliedGreatFather(father, child);
break; break;
case '|' : case '|' :
Node lc = child.getLeftChild(); Node lc = leftChild.getLeftChild();
Node rc = child.getRigthChild(); Node rc = leftChild.getRigthChild();
Node notlc = new Node(null,lc,null,'!', lc.getLvl() +1); Node notlc = new Node(null,lc,null,'!', lc.getLvl() +1);
Node notrc = new Node(null,rc,null,'!', rc.getLvl() +1); Node notrc = new Node(null,rc,null,'!', rc.getLvl() +1);
@@ -93,8 +92,8 @@ public class Tree {
appliedGreatFather(father, greatfather); appliedGreatFather(father, greatfather);
break; break;
case '&' : case '&' :
Node lc_2 = child.getLeftChild(); Node lc_2 = leftChild.getLeftChild();
Node rc_2 = child.getRigthChild(); Node rc_2 = leftChild.getRigthChild();
Node notlc_2 = new Node(null,lc_2,null,'!', lc_2.getLvl() +1); Node notlc_2 = new Node(null,lc_2,null,'!', lc_2.getLvl() +1);
Node notrc_2 = new Node(null,rc_2,null,'!', rc_2.getLvl() +1); Node notrc_2 = new Node(null,rc_2,null,'!', rc_2.getLvl() +1);
@@ -107,8 +106,8 @@ public class Tree {
appliedGreatFather(father, greatfather_2); appliedGreatFather(father, greatfather_2);
break; break;
case '>' : case '>' :
Node lc_3 = child.getLeftChild(); Node lc_3 = leftChild.getLeftChild();
Node rc_3 = child.getRigthChild(); Node rc_3 = leftChild.getRigthChild();
Node notrc_3 = new Node(null,rc_3,null,'!', rc_3.getLvl() +1); Node notrc_3 = new Node(null,rc_3,null,'!', rc_3.getLvl() +1);
rc_3.setFather(notrc_3); rc_3.setFather(notrc_3);
@@ -145,7 +144,9 @@ public class Tree {
} else if (father.getPos() == 2) { } else if (father.getPos() == 2) {
father.getFather().setRigthChild(greatFather); father.getFather().setRigthChild(greatFather);
greatFather.setFather(father); greatFather.setFather(father);
} else } else {
root = greatFather; root = greatFather;
greatFather.setFather(null);
}
} }
} }