21 lines
559 B
Java
21 lines
559 B
Java
public class NoeudOperation extends Noeud{
|
|
|
|
public NoeudOperation(String ope){
|
|
this.val = ope;
|
|
for(int i=0;i<2;i++){
|
|
String prochainNoeud = Main.pile.pop();
|
|
if (prochainNoeud.equals("+")||prochainNoeud.equals("-")||prochainNoeud.equals("x")||prochainNoeud.equals("/")){
|
|
this.noeudGauche = new NoeudOperation(prochainNoeud);
|
|
}
|
|
else{
|
|
this.noeudGauche = new NoeudChiffre(prochainNoeud);
|
|
}
|
|
}
|
|
}
|
|
|
|
protected void afficherNoeud(){
|
|
System.out.print(val+" ");
|
|
this.noeudGauche.afficherNoeud();
|
|
this.noeudDroit.afficherNoeud();
|
|
}
|
|
} |