fin de séance
This commit is contained in:
commit
2aeb02623d
22
AccesVariable.java
Executable file
22
AccesVariable.java
Executable file
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
* AccesVariable représente l'accès à une variable.
|
||||
*
|
||||
* @author Xavier Crégut
|
||||
* @version $Revision$
|
||||
*/
|
||||
public class AccesVariable implements Expression {
|
||||
private String nom;
|
||||
|
||||
public AccesVariable(String nom) {
|
||||
this.nom = nom;
|
||||
}
|
||||
|
||||
public String getNom() {
|
||||
return this.nom;
|
||||
}
|
||||
|
||||
public <R> R accepter(VisiteurExpression<R> visiteur) {
|
||||
return visiteur.visiterAccesVariable(this);
|
||||
}
|
||||
|
||||
}
|
13
Addition.java
Executable file
13
Addition.java
Executable file
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
* Opérateur binaire d'addition.
|
||||
*
|
||||
* @author Xavier Crégut
|
||||
* @version $Revision$
|
||||
*/
|
||||
public class Addition implements OperateurBinaire {
|
||||
|
||||
public <R> R accepter(VisiteurExpression<R> visiteur) {
|
||||
return visiteur.visiterAddition(this);
|
||||
}
|
||||
|
||||
}
|
58
AfficheurInfixe.java
Executable file
58
AfficheurInfixe.java
Executable file
|
@ -0,0 +1,58 @@
|
|||
/** Afficheur infixe, complètement parenthésé, d'une expression arithmétique.
|
||||
*
|
||||
* @author Xavier Crégut
|
||||
* @version $Revision$
|
||||
*/
|
||||
public class AfficheurInfixe implements VisiteurExpression<String> {
|
||||
|
||||
public String visiterAccesVariable(AccesVariable v) {
|
||||
return "(" + v.getNom() + ")";
|
||||
}
|
||||
|
||||
public String visiterConstante(Constante c) {
|
||||
return "(" + String.valueOf(c.getValeur()) + ")";
|
||||
}
|
||||
|
||||
public String visiterExpressionTernaire(ExpressionTernaire e) {
|
||||
return "("
|
||||
+ "let" + e.getOperateur().accepter(this)
|
||||
+ " " + e.getOperande1().accepter(this)
|
||||
+ "=" + e.getOperande2().accepter(this)
|
||||
+ " in " + e.getOperande3().accepter(this)
|
||||
+ ")" ;
|
||||
}
|
||||
|
||||
public String visiterLet(Let l) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
public String visiterExpressionBinaire(ExpressionBinaire e) {
|
||||
return "(" + e.getOperandeGauche().accepter(this)
|
||||
+ " " + e.getOperateur().accepter(this)
|
||||
+ " " + e.getOperandeDroite().accepter(this)
|
||||
+ ")" ;
|
||||
}
|
||||
|
||||
public String visiterAddition(Addition a) {
|
||||
return "+";
|
||||
}
|
||||
|
||||
public String visiterSoustraction(Soustraction a) {
|
||||
return "-";
|
||||
}
|
||||
|
||||
public String visiterMultiplication(Multiplication m) {
|
||||
return "*";
|
||||
}
|
||||
|
||||
public String visiterExpressionUnaire(ExpressionUnaire e) {
|
||||
return "(" + e.getOperateur().accepter(this)
|
||||
+ " " + e.getOperande().accepter(this) + ")";
|
||||
}
|
||||
|
||||
public String visiterNegation(Negation n) {
|
||||
return "~";
|
||||
}
|
||||
|
||||
}
|
53
AfficheurInfixeMinimalTest.java
Executable file
53
AfficheurInfixeMinimalTest.java
Executable file
|
@ -0,0 +1,53 @@
|
|||
/**
|
||||
* AfficheurInfixeMinimalTest :
|
||||
*
|
||||
* @author Xavier Crégut
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
public class AfficheurInfixeMinimalTest extends ExpressionTestSetup {
|
||||
|
||||
private void verifier(String valeurAttendue, Expression e) {
|
||||
AfficheurInfixe affInfixe = new AfficheurInfixeMinimal();
|
||||
String resultat = e.accepter(affInfixe);
|
||||
assertEquals(valeurAttendue, resultat.replaceAll("\\s+", " "));
|
||||
}
|
||||
|
||||
public void testerConstante() {
|
||||
verifier("10", cte);
|
||||
}
|
||||
|
||||
public void testerAccesVariable1() {
|
||||
verifier("x", av);
|
||||
}
|
||||
|
||||
public void testerE1() {
|
||||
verifier("2 + x", e1);
|
||||
}
|
||||
|
||||
public void testerE2() {
|
||||
verifier("(2 + x) * 3", e2);
|
||||
}
|
||||
|
||||
public void testerE3() {
|
||||
verifier("7 * (2 + x)", e3);
|
||||
}
|
||||
|
||||
public void testerE4() {
|
||||
verifier("x + y + z", e4);
|
||||
}
|
||||
|
||||
public void testerE5() {
|
||||
verifier("x + (y + z)", e5);
|
||||
}
|
||||
|
||||
public void testerE6() {
|
||||
verifier("- - (2 + x)", e6);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
junit.textui.TestRunner.run(
|
||||
new junit.framework.TestSuite(AfficheurInfixeMinimalTest.class));
|
||||
}
|
||||
|
||||
}
|
58
AfficheurInfixeTest.java
Executable file
58
AfficheurInfixeTest.java
Executable file
|
@ -0,0 +1,58 @@
|
|||
/**
|
||||
* AfficheurInfixeTest :
|
||||
*
|
||||
* @author Xavier Crégut
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
public class AfficheurInfixeTest extends ExpressionTestSetup {
|
||||
|
||||
|
||||
private void verifier(String valeurAttendue, Expression e) {
|
||||
AfficheurInfixe affInfixe = new AfficheurInfixe();
|
||||
String resultat = e.accepter(affInfixe);
|
||||
assertEquals(valeurAttendue, resultat.replaceAll("\\s+", " "));
|
||||
}
|
||||
|
||||
public void testerConstante() {
|
||||
verifier("(10)", cte);
|
||||
}
|
||||
|
||||
public void testerAccesVariable1() {
|
||||
verifier("(x)", av);
|
||||
}
|
||||
|
||||
public void testerE1() {
|
||||
verifier("((2) + (x))", e1);
|
||||
}
|
||||
|
||||
public void testerE2() {
|
||||
verifier("(((2) + (x)) * (3))", e2);
|
||||
}
|
||||
|
||||
public void testerE3() {
|
||||
verifier("((7) * ((2) + (x)))", e3);
|
||||
}
|
||||
|
||||
public void testerE4() {
|
||||
verifier("(((x) + (y)) + (z))", e4);
|
||||
}
|
||||
|
||||
public void testerE5() {
|
||||
verifier("((x) + ((y) + (z)))", e5);
|
||||
}
|
||||
|
||||
public void testerE6() {
|
||||
verifier("(~ (~ ((2) + (x))))", e6);
|
||||
}
|
||||
|
||||
public void testerE7() {
|
||||
verifier("(let (x)=((2) + (x)) in ((2) + (x)))", e7);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
junit.textui.TestRunner.run(
|
||||
new junit.framework.TestSuite(AfficheurInfixeTest.class));
|
||||
}
|
||||
|
||||
}
|
43
AfficheurPostfixe.java
Executable file
43
AfficheurPostfixe.java
Executable file
|
@ -0,0 +1,43 @@
|
|||
/** Afficheur infixe, complètement parenthésé, d'une expression arithmétique.
|
||||
*
|
||||
* @author Xavier Crégut
|
||||
* @version $Revision$
|
||||
*/
|
||||
public class AfficheurPostfixe implements VisiteurExpression<String> {
|
||||
|
||||
public String visiterAccesVariable(AccesVariable v) {
|
||||
return v.getNom();
|
||||
}
|
||||
|
||||
public String visiterConstante(Constante c) {
|
||||
return String.valueOf(c.getValeur());
|
||||
}
|
||||
|
||||
public String visiterExpressionBinaire(ExpressionBinaire e) {
|
||||
return e.getOperandeGauche().accepter(this)
|
||||
+ " " + e.getOperandeDroite().accepter(this)
|
||||
+ " " + e.getOperateur().accepter(this);
|
||||
}
|
||||
|
||||
public String visiterAddition(Addition a) {
|
||||
return "+";
|
||||
}
|
||||
|
||||
public String visiterSoustraction(Soustraction a) {
|
||||
return "-";
|
||||
}
|
||||
|
||||
public String visiterMultiplication(Multiplication m) {
|
||||
return "*";
|
||||
}
|
||||
|
||||
public String visiterExpressionUnaire(ExpressionUnaire e) {
|
||||
return e.getOperande().accepter(this)
|
||||
+ " " + e.getOperateur().accepter(this);
|
||||
}
|
||||
|
||||
public String visiterNegation(Negation n) {
|
||||
return "~";
|
||||
}
|
||||
|
||||
}
|
53
AfficheurPostfixeTest.java
Executable file
53
AfficheurPostfixeTest.java
Executable file
|
@ -0,0 +1,53 @@
|
|||
/**
|
||||
* AfficheurPostfixeTest :
|
||||
*
|
||||
* @author Xavier Crégut
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
public class AfficheurPostfixeTest extends ExpressionTestSetup {
|
||||
|
||||
|
||||
private void verifier(String valeurAttendue, Expression e) {
|
||||
AfficheurPostfixe affPostfixe = new AfficheurPostfixe();
|
||||
assertEquals(valeurAttendue, e.accepter(affPostfixe));
|
||||
}
|
||||
|
||||
public void testerConstante() {
|
||||
verifier("10", cte);
|
||||
}
|
||||
|
||||
public void testerAccesVariable1() {
|
||||
verifier("x", av);
|
||||
}
|
||||
|
||||
public void testerE1() {
|
||||
verifier("2 x +", e1);
|
||||
}
|
||||
|
||||
public void testerE2() {
|
||||
verifier("2 x + 3 *", e2);
|
||||
}
|
||||
|
||||
public void testerE3() {
|
||||
verifier("7 2 x + *", e3);
|
||||
}
|
||||
|
||||
public void testerE4() {
|
||||
verifier("x y + z +", e4);
|
||||
}
|
||||
|
||||
public void testerE5() {
|
||||
verifier("x y z + +", e5);
|
||||
}
|
||||
|
||||
public void testerE6() {
|
||||
verifier("2 x + ~ ~", e6);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
junit.textui.TestRunner.run(
|
||||
new junit.framework.TestSuite(AfficheurPostfixeTest.class));
|
||||
}
|
||||
|
||||
}
|
47
CalculHauteur.java
Executable file
47
CalculHauteur.java
Executable file
|
@ -0,0 +1,47 @@
|
|||
/** Afficheur infixe, complètement parenthésé, d'une expression arithmétique.
|
||||
*
|
||||
* @author Xavier Crégut
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
import java.lang.*;
|
||||
|
||||
public class CalculHauteur implements VisiteurExpression<Integer> {
|
||||
|
||||
public Integer visiterAccesVariable(AccesVariable v) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public Integer visiterConstante(Constante c) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public Integer visiterExpressionBinaire(ExpressionBinaire e) {
|
||||
return Math.max(
|
||||
e.getOperandeGauche().accepter(this),
|
||||
e.getOperandeDroite().accepter(this)
|
||||
) + e.getOperateur().accepter(this);
|
||||
}
|
||||
|
||||
public Integer visiterAddition(Addition a) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public Integer visiterSoustraction(Soustraction a) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public Integer visiterMultiplication(Multiplication m) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public Integer visiterExpressionUnaire(ExpressionUnaire e) {
|
||||
return e.getOperateur().accepter(this)
|
||||
+ e.getOperande().accepter(this);
|
||||
}
|
||||
|
||||
public Integer visiterNegation(Negation n) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
66
CalculHauteurTest.java
Executable file
66
CalculHauteurTest.java
Executable file
|
@ -0,0 +1,66 @@
|
|||
/** Tester CalculHauteur.
|
||||
* @author Xavier Crégut
|
||||
* @version $Revision$
|
||||
*/
|
||||
public class CalculHauteurTest extends ExpressionTestSetup {
|
||||
|
||||
private void verifierHauteur(int hauteurAttentdue, Expression e) {
|
||||
CalculHauteur v = new CalculHauteur();
|
||||
verifierHauteur(hauteurAttentdue, e, v);
|
||||
}
|
||||
|
||||
private void verifierHauteur(int hauteurAttentdue, Expression e,
|
||||
CalculHauteur v) {
|
||||
int hauteur = e.accepter(v);
|
||||
assertEquals(hauteurAttentdue, hauteur);
|
||||
}
|
||||
|
||||
public void testerConstante() {
|
||||
verifierHauteur(1, cte);
|
||||
}
|
||||
|
||||
public void testerAccesVariable() {
|
||||
verifierHauteur(1, av);
|
||||
}
|
||||
|
||||
public void testerE1() {
|
||||
verifierHauteur(2, e1);
|
||||
}
|
||||
|
||||
public void testerE2() {
|
||||
verifierHauteur(3, e2);
|
||||
}
|
||||
|
||||
public void testerE3() {
|
||||
verifierHauteur(3, e3);
|
||||
}
|
||||
|
||||
public void testerE4() {
|
||||
verifierHauteur(3, e4);
|
||||
}
|
||||
|
||||
public void testerE5() {
|
||||
verifierHauteur(3, e5);
|
||||
}
|
||||
|
||||
public void testerE6() {
|
||||
verifierHauteur(4, e6);
|
||||
}
|
||||
|
||||
public void testerReutilisationVisiteur() {
|
||||
CalculHauteur v = new CalculHauteur();
|
||||
verifierHauteur(1, cte, v);
|
||||
verifierHauteur(3, e3, v);
|
||||
verifierHauteur(3, e4, v);
|
||||
verifierHauteur(3, e4, v);
|
||||
verifierHauteur(3, e5, v);
|
||||
verifierHauteur(4, e6, v);
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
junit.textui.TestRunner.run(
|
||||
new junit.framework.TestSuite(CalculHauteurTest.class));
|
||||
}
|
||||
|
||||
}
|
23
Constante.java
Executable file
23
Constante.java
Executable file
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
* Constante entière.
|
||||
*
|
||||
* @author Xavier Crégut
|
||||
* @version $Revision$
|
||||
*/
|
||||
public class Constante implements Expression {
|
||||
|
||||
private int valeur;
|
||||
|
||||
public Constante(int valeur) {
|
||||
this.valeur = valeur;
|
||||
}
|
||||
|
||||
public int getValeur() {
|
||||
return this.valeur;
|
||||
}
|
||||
|
||||
public <R> R accepter(VisiteurExpression<R> visiteur) {
|
||||
return visiteur.visiterConstante(this);
|
||||
}
|
||||
|
||||
}
|
67
EvaluateurExpression.java
Executable file
67
EvaluateurExpression.java
Executable file
|
@ -0,0 +1,67 @@
|
|||
/** Afficheur infixe, complètement parenthésé, d'une expression arithmétique.
|
||||
*
|
||||
* @author Xavier Crégut
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class EvaluateurExpression implements VisiteurExpression<Integer> {
|
||||
|
||||
private Map<String,Integer> env;
|
||||
|
||||
public EvaluateurExpression(Map<String,Integer> env) {
|
||||
this.env = env;
|
||||
}
|
||||
|
||||
public Integer visiterAccesVariable(AccesVariable v) {
|
||||
return env.get(v.getNom());
|
||||
}
|
||||
|
||||
public Integer visiterConstante(Constante c) {
|
||||
return c.getValeur();
|
||||
}
|
||||
|
||||
public Integer visiterExpressionBinaire(ExpressionBinaire e) {
|
||||
switch (e.getOperateur().accepter(this)) {
|
||||
case 0:
|
||||
return e.getOperandeGauche().accepter(this) + e.getOperandeDroite().accepter(this);
|
||||
|
||||
case 1:
|
||||
return e.getOperandeGauche().accepter(this) - e.getOperandeDroite().accepter(this);
|
||||
|
||||
case 2:
|
||||
return e.getOperandeGauche().accepter(this) * e.getOperandeDroite().accepter(this);
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public Integer visiterAddition(Addition a) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Integer visiterSoustraction(Soustraction a) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public Integer visiterMultiplication(Multiplication m) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
public Integer visiterExpressionUnaire(ExpressionUnaire e) {
|
||||
switch (e.getOperateur().accepter(this)) {
|
||||
case 0:
|
||||
return -e.getOperande().accepter(this);
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public Integer visiterNegation(Negation n) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
74
EvaluateurExpressionTest.java
Executable file
74
EvaluateurExpressionTest.java
Executable file
|
@ -0,0 +1,74 @@
|
|||
import java.util.HashMap;
|
||||
|
||||
/** Tester EvaluateurExpression.
|
||||
* @author Xavier Crégut
|
||||
* @version $Revision$
|
||||
*/
|
||||
public class EvaluateurExpressionTest extends ExpressionTestSetup {
|
||||
|
||||
protected HashMap<String, Integer> environnement;
|
||||
|
||||
protected void setUp() {
|
||||
super.setUp();
|
||||
this.environnement = new HashMap<String, Integer>();
|
||||
this.environnement.put("x", 5);
|
||||
this.environnement.put("y", 7);
|
||||
this.environnement.put("z", 2);
|
||||
}
|
||||
|
||||
private void verifierValeur(int valeurAttendue, Expression e) {
|
||||
EvaluateurExpression v = new EvaluateurExpression(this.environnement);
|
||||
assertEquals(valeurAttendue, e.accepter(v).intValue());
|
||||
}
|
||||
|
||||
public void testerConstante() {
|
||||
verifierValeur(10, cte);
|
||||
}
|
||||
|
||||
public void testerAccesVariable1() {
|
||||
verifierValeur(5, av);
|
||||
}
|
||||
|
||||
public void testerAccesVariable2() {
|
||||
verifierValeur(7, new AccesVariable("y"));
|
||||
}
|
||||
|
||||
public void testerAccesVariableNonDefinie() {
|
||||
try {
|
||||
verifierValeur(5, new AccesVariable("t"));
|
||||
fail();
|
||||
} catch (RuntimeException e) {
|
||||
// OK.
|
||||
}
|
||||
}
|
||||
|
||||
public void testerE1() {
|
||||
verifierValeur(7, e1);
|
||||
}
|
||||
|
||||
public void testerE2() {
|
||||
verifierValeur(21, e2);
|
||||
}
|
||||
|
||||
public void testerE3() {
|
||||
verifierValeur(49, e3);
|
||||
}
|
||||
|
||||
public void testerE4() {
|
||||
verifierValeur(14, e4);
|
||||
}
|
||||
|
||||
public void testerE5() {
|
||||
verifierValeur(14, e5);
|
||||
}
|
||||
|
||||
public void testerE6() {
|
||||
verifierValeur(7, e6);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
junit.textui.TestRunner.run(
|
||||
new junit.framework.TestSuite(EvaluateurExpressionTest.class));
|
||||
}
|
||||
|
||||
}
|
50
ExemplesAffichage.java
Executable file
50
ExemplesAffichage.java
Executable file
|
@ -0,0 +1,50 @@
|
|||
/**
|
||||
* Exemples d'affichage d'expressions arithmétiques
|
||||
*
|
||||
* @author Xavier Crégut
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
public class ExemplesAffichage {
|
||||
|
||||
static final private OperateurBinaire plus = new Addition();
|
||||
static final private OperateurBinaire fois = new Multiplication();
|
||||
static final private OperateurUnaire negation = new Negation();
|
||||
|
||||
static public Expression expression1() {
|
||||
return new ExpressionUnaire(negation,
|
||||
new ExpressionBinaire(fois,
|
||||
new Constante(2),
|
||||
new ExpressionBinaire(plus,
|
||||
new Constante(1),
|
||||
new AccesVariable("x"))));
|
||||
}
|
||||
|
||||
static public Expression expression2() {
|
||||
return new ExpressionBinaire(plus,
|
||||
new Constante(5),
|
||||
new ExpressionBinaire(fois,
|
||||
new AccesVariable("x"),
|
||||
new Constante(4)));
|
||||
}
|
||||
|
||||
static public Expression expression3() {
|
||||
return new ExpressionBinaire(plus,
|
||||
new Constante(5),
|
||||
new ExpressionBinaire(fois,
|
||||
new AccesVariable("x"),
|
||||
new Constante(4)));
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// Afficher expression 1
|
||||
AfficheurInfixe infixe = new AfficheurInfixe();
|
||||
String e1infixe = expression1().accepter(infixe);
|
||||
System.out.println("e1 = " + e1infixe);
|
||||
|
||||
// Afficher expression2
|
||||
String e2infixe = expression2().accepter(infixe);
|
||||
System.out.println("e2 = " + e2infixe);
|
||||
}
|
||||
}
|
||||
|
15
Expression.java
Executable file
15
Expression.java
Executable file
|
@ -0,0 +1,15 @@
|
|||
/**
|
||||
* Expression entière.
|
||||
*
|
||||
* @author Xavier Crégut
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
public interface Expression {
|
||||
|
||||
/** Accepter un visiteur.
|
||||
* @param visiteur le visiteur accepté
|
||||
*/
|
||||
<R> R accepter(VisiteurExpression<R> visiteur);
|
||||
|
||||
}
|
40
ExpressionBinaire.java
Executable file
40
ExpressionBinaire.java
Executable file
|
@ -0,0 +1,40 @@
|
|||
/**
|
||||
* Expression binaire avec donc deux opérandes droit et gauche et un opérateur
|
||||
* binaire.
|
||||
*
|
||||
* @author Xavier Crégut
|
||||
* @version $Revision$
|
||||
* @composed 1 "" "operateur" OperateurBinaire
|
||||
* @has 1 - "gauche" Expression
|
||||
* @has 1 - "droite" Expression
|
||||
*/
|
||||
public class ExpressionBinaire implements Expression {
|
||||
|
||||
private Expression operandegauche;
|
||||
private Expression operandedroite;
|
||||
private OperateurBinaire operateur;
|
||||
|
||||
public ExpressionBinaire(OperateurBinaire op, Expression gauche, Expression droite)
|
||||
{
|
||||
this.operateur = op;
|
||||
this.operandegauche = gauche;
|
||||
this.operandedroite = droite;
|
||||
}
|
||||
|
||||
public Expression getOperandeGauche() {
|
||||
return this.operandegauche;
|
||||
}
|
||||
|
||||
public Expression getOperandeDroite() {
|
||||
return this.operandedroite;
|
||||
}
|
||||
|
||||
public OperateurBinaire getOperateur() {
|
||||
return this.operateur;
|
||||
}
|
||||
|
||||
public <R> R accepter(VisiteurExpression<R> visiteur) {
|
||||
return visiteur.visiterExpressionBinaire(this);
|
||||
}
|
||||
|
||||
}
|
37
ExpressionTernaire.java
Executable file
37
ExpressionTernaire.java
Executable file
|
@ -0,0 +1,37 @@
|
|||
|
||||
public class ExpressionTernaire implements Expression {
|
||||
|
||||
private AccesVariable operande1;
|
||||
private Expression operande2;
|
||||
private Expression operande3;
|
||||
private OperateurTernaire operateur;
|
||||
|
||||
public ExpressionTernaire(OperateurTernaire op, AccesVariable e1, Expression e2, Expression e3)
|
||||
{
|
||||
this.operateur = op;
|
||||
this.operande1 = e1;
|
||||
this.operande2 = e2;
|
||||
this.operande3 = e3;
|
||||
}
|
||||
|
||||
public AccesVariable getOperande1() {
|
||||
return this.operande1;
|
||||
}
|
||||
|
||||
public Expression getOperande2() {
|
||||
return this.operande2;
|
||||
}
|
||||
|
||||
public Expression getOperande3() {
|
||||
return this.operande3;
|
||||
}
|
||||
|
||||
public OperateurTernaire getOperateur() {
|
||||
return this.operateur;
|
||||
}
|
||||
|
||||
public <R> R accepter(VisiteurExpression<R> visiteur) {
|
||||
return visiteur.visiterExpressionTernaire(this);
|
||||
}
|
||||
|
||||
}
|
59
ExpressionTestSetup.java
Executable file
59
ExpressionTestSetup.java
Executable file
|
@ -0,0 +1,59 @@
|
|||
/**
|
||||
* ExpressionTest :
|
||||
*
|
||||
* @author Xavier Crégut
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
public abstract class ExpressionTestSetup extends junit.framework.TestCase {
|
||||
|
||||
protected Constante cte;
|
||||
protected AccesVariable av;
|
||||
protected Expression e1, e2, e3; // Expressions du sujet
|
||||
protected Expression e4, e5, e6;
|
||||
protected Expression e7;
|
||||
|
||||
protected void setUp() {
|
||||
// 10
|
||||
this.cte = new Constante(10);
|
||||
// x
|
||||
this.av = new AccesVariable("x") ;
|
||||
|
||||
// 2 + x
|
||||
this.e1 = new ExpressionBinaire(new Addition(),
|
||||
new Constante(2),
|
||||
av);
|
||||
|
||||
// (2 + x) * 3
|
||||
this.e2 = new ExpressionBinaire(new Multiplication(),
|
||||
this.e1,
|
||||
new Constante(3));
|
||||
|
||||
// 7 * (2 + x)
|
||||
this.e3 = new ExpressionBinaire(new Multiplication(),
|
||||
new Constante(7),
|
||||
this.e1) ;
|
||||
|
||||
// (x + y) + z
|
||||
this.e4 = new ExpressionBinaire(new Addition(),
|
||||
new ExpressionBinaire(new Addition(),
|
||||
new AccesVariable("x"), new AccesVariable("y")),
|
||||
new AccesVariable("z"));
|
||||
|
||||
// x + (y + z)
|
||||
this.e5 = new ExpressionBinaire(new Addition(),
|
||||
new AccesVariable("x"),
|
||||
new ExpressionBinaire(new Addition(),
|
||||
new AccesVariable("y"), new AccesVariable("z")));
|
||||
|
||||
// - - (2 + x)
|
||||
this.e6 = new ExpressionUnaire(new Negation(),
|
||||
new ExpressionUnaire(new Negation(),
|
||||
this.e1));
|
||||
|
||||
// let x=(2+x) in (2+x)
|
||||
this.e7 = new ExpressionTernaire(new Let(), av, e1, e1);
|
||||
}
|
||||
|
||||
}
|
||||
|
32
ExpressionUnaire.java
Executable file
32
ExpressionUnaire.java
Executable file
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
* Expression unaire avec un opérateur unaire appliqué sur un opérande.
|
||||
*
|
||||
* @author Xavier Crégut
|
||||
* @version $Revision$
|
||||
* @composed 1 "" "operateur" OperateurUnaire
|
||||
* @has 1 "" "operande" Expression
|
||||
*/
|
||||
public class ExpressionUnaire implements Expression {
|
||||
|
||||
private Expression operande;
|
||||
private OperateurUnaire operateur;
|
||||
|
||||
public ExpressionUnaire(OperateurUnaire operateur, Expression operande)
|
||||
{
|
||||
this.operande = operande;
|
||||
this.operateur = operateur;
|
||||
}
|
||||
|
||||
public Expression getOperande() {
|
||||
return this.operande;
|
||||
}
|
||||
|
||||
public OperateurUnaire getOperateur() {
|
||||
return this.operateur;
|
||||
}
|
||||
|
||||
public <R> R accepter(VisiteurExpression<R> visiteur) {
|
||||
return visiteur.visiterExpressionUnaire(this);
|
||||
}
|
||||
|
||||
}
|
13
Let.java
Executable file
13
Let.java
Executable file
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
* Opérateur ternaire de let.
|
||||
*
|
||||
* @author Xavier Crégut
|
||||
* @version $Revision$
|
||||
*/
|
||||
public class Let implements OperateurTernaire {
|
||||
|
||||
public <R> R accepter(VisiteurExpression<R> visiteur) {
|
||||
return visiteur.visiterLet(this);
|
||||
}
|
||||
|
||||
}
|
13
Multiplication.java
Executable file
13
Multiplication.java
Executable file
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
* Opérateur binaire de multiplication.
|
||||
*
|
||||
* @author Xavier Crégut
|
||||
* @version $Revision$
|
||||
*/
|
||||
public class Multiplication implements OperateurBinaire {
|
||||
|
||||
public <R> R accepter(VisiteurExpression<R> visiteur) {
|
||||
return visiteur.visiterMultiplication(this);
|
||||
}
|
||||
|
||||
}
|
14
Negation.java
Executable file
14
Negation.java
Executable file
|
@ -0,0 +1,14 @@
|
|||
/**
|
||||
* Opérateur unaire correspondant à la négation.
|
||||
*
|
||||
* @author Xavier Crégut
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
public class Negation implements OperateurUnaire {
|
||||
|
||||
public <R> R accepter(VisiteurExpression<R> visiteur) {
|
||||
return visiteur.visiterNegation(this);
|
||||
}
|
||||
|
||||
}
|
11
OperateurBinaire.java
Executable file
11
OperateurBinaire.java
Executable file
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* Opérateur binaire.
|
||||
*
|
||||
* @author Xavier Crégut
|
||||
* @version $Revision$
|
||||
*/
|
||||
public interface OperateurBinaire {
|
||||
|
||||
<R> R accepter(VisiteurExpression<R> visiteur);
|
||||
|
||||
}
|
11
OperateurTernaire.java
Executable file
11
OperateurTernaire.java
Executable file
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* Opérateur ternaire.
|
||||
*
|
||||
* @author Xavier Crégut
|
||||
* @version $Revision$
|
||||
*/
|
||||
public interface OperateurTernaire {
|
||||
|
||||
<R> R accepter(VisiteurExpression<R> visiteur);
|
||||
|
||||
}
|
11
OperateurUnaire.java
Executable file
11
OperateurUnaire.java
Executable file
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* Opérateur unaire.
|
||||
*
|
||||
* @author Xavier Crégut
|
||||
* @version $Revision$
|
||||
*/
|
||||
public interface OperateurUnaire {
|
||||
|
||||
<R> R accepter(VisiteurExpression<R> visiteur);
|
||||
|
||||
}
|
14
Soustraction.java
Executable file
14
Soustraction.java
Executable file
|
@ -0,0 +1,14 @@
|
|||
/**
|
||||
* Opérateur binaire de soustraction.
|
||||
*
|
||||
* @author Xavier Crégut
|
||||
* @version $Revision$
|
||||
*/
|
||||
public class Soustraction implements OperateurBinaire {
|
||||
|
||||
public <R> R accepter(VisiteurExpression<R> visiteur) {
|
||||
return visiteur.visiterSoustraction(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
59
VisiteurExpression.java
Executable file
59
VisiteurExpression.java
Executable file
|
@ -0,0 +1,59 @@
|
|||
/**
|
||||
* Visiteur sur une expression arithmétique.
|
||||
*
|
||||
* @author Xavier Crégut
|
||||
* @version $Revision$
|
||||
*/
|
||||
public interface VisiteurExpression<R> {
|
||||
|
||||
/** Visiter un accès à une variable.
|
||||
* @param v l'accès à une variable à visiter
|
||||
*/
|
||||
R visiterAccesVariable(AccesVariable v);
|
||||
|
||||
/** Visiter une constante.
|
||||
* @param c la constante à visiter
|
||||
*/
|
||||
R visiterConstante(Constante c);
|
||||
|
||||
/** Visiter une expression binaire.
|
||||
* @param e l'expression binaire à visiter
|
||||
*/
|
||||
R visiterExpressionBinaire(ExpressionBinaire e);
|
||||
|
||||
/** Visiter l'opérateur binaire addition.
|
||||
* @param a l'opérateur à visiter
|
||||
*/
|
||||
R visiterAddition(Addition a);
|
||||
|
||||
/** Visiter l'opérateur binaire soustraction.
|
||||
* @param a l'opérateur à visiter
|
||||
*/
|
||||
R visiterSoustraction(Soustraction a);
|
||||
|
||||
/** Visiter l'opérateur binaire multiplication.
|
||||
* @param m l'opérateur à visiter
|
||||
*/
|
||||
R visiterMultiplication(Multiplication m);
|
||||
|
||||
/** Visiter une expression unaire.
|
||||
* @param v l'expression unaire à visiter
|
||||
*/
|
||||
R visiterExpressionUnaire(ExpressionUnaire e);
|
||||
|
||||
/** Visiter un opérateur unaire négation.
|
||||
* @param n l'opérateur unaire à visiter
|
||||
*/
|
||||
R visiterNegation(Negation n);
|
||||
|
||||
/** Visiter une expression ternaire.
|
||||
* @param e l'expression ternaire à visiter
|
||||
*/
|
||||
R visiterExpressionTernaire(ExpressionTernaire e);
|
||||
|
||||
/** Visiter un opérateur ternaire let.
|
||||
* @param n l'opérateur ternaire à visiter
|
||||
*/
|
||||
R visiterLet(Let n);
|
||||
|
||||
}
|
121
expressions.dot
Executable file
121
expressions.dot
Executable file
|
@ -0,0 +1,121 @@
|
|||
#!/usr/local/bin/dot
|
||||
#
|
||||
# Class diagram
|
||||
# Generated by UMLGraph version R5_7_2-23-gd0ede4 (http://www.spinellis.gr/umlgraph/)
|
||||
#
|
||||
|
||||
digraph G {
|
||||
edge [fontname="Helvetica",fontsize=10,labelfontname="Helvetica",labelfontsize=10];
|
||||
node [fontname="Helvetica",fontsize=10,shape=plaintext];
|
||||
nodesep=0.25;
|
||||
ranksep=0.5;
|
||||
// VisiteurExpression<R>
|
||||
c0 [label=<<table title="VisiteurExpression" border="0" cellborder="1" cellspacing="0" cellpadding="2" port="p">
|
||||
<tr><td><table border="0" cellspacing="0" cellpadding="1">
|
||||
<tr><td align="center" balign="center"> «interface» </td></tr>
|
||||
<tr><td align="center" balign="center"> VisiteurExpression<R> </td></tr>
|
||||
</table></td></tr>
|
||||
</table>>, URL="null", fontname="Helvetica", fontcolor="black", fontsize=10.0];
|
||||
// AccesVariable
|
||||
c1 [label=<<table title="AccesVariable" border="0" cellborder="1" cellspacing="0" cellpadding="2" port="p">
|
||||
<tr><td><table border="0" cellspacing="0" cellpadding="1">
|
||||
<tr><td align="center" balign="center"> AccesVariable </td></tr>
|
||||
</table></td></tr>
|
||||
</table>>, URL="null", fontname="Helvetica", fontcolor="black", fontsize=10.0];
|
||||
// Addition
|
||||
c2 [label=<<table title="Addition" border="0" cellborder="1" cellspacing="0" cellpadding="2" port="p">
|
||||
<tr><td><table border="0" cellspacing="0" cellpadding="1">
|
||||
<tr><td align="center" balign="center"> Addition </td></tr>
|
||||
</table></td></tr>
|
||||
</table>>, URL="null", fontname="Helvetica", fontcolor="black", fontsize=10.0];
|
||||
// AfficheurInfixe
|
||||
c3 [label=<<table title="AfficheurInfixe" border="0" cellborder="1" cellspacing="0" cellpadding="2" port="p">
|
||||
<tr><td><table border="0" cellspacing="0" cellpadding="1">
|
||||
<tr><td align="center" balign="center"> AfficheurInfixe </td></tr>
|
||||
</table></td></tr>
|
||||
</table>>, URL="null", fontname="Helvetica", fontcolor="black", fontsize=10.0];
|
||||
// Constante
|
||||
c4 [label=<<table title="Constante" border="0" cellborder="1" cellspacing="0" cellpadding="2" port="p">
|
||||
<tr><td><table border="0" cellspacing="0" cellpadding="1">
|
||||
<tr><td align="center" balign="center"> Constante </td></tr>
|
||||
</table></td></tr>
|
||||
</table>>, URL="null", fontname="Helvetica", fontcolor="black", fontsize=10.0];
|
||||
// ExemplesAffichage
|
||||
c5 [label=<<table title="ExemplesAffichage" border="0" cellborder="1" cellspacing="0" cellpadding="2" port="p">
|
||||
<tr><td><table border="0" cellspacing="0" cellpadding="1">
|
||||
<tr><td align="center" balign="center"> ExemplesAffichage </td></tr>
|
||||
</table></td></tr>
|
||||
</table>>, URL="null", fontname="Helvetica", fontcolor="black", fontsize=10.0];
|
||||
// ExpressionBinaire
|
||||
c6 [label=<<table title="ExpressionBinaire" border="0" cellborder="1" cellspacing="0" cellpadding="2" port="p">
|
||||
<tr><td><table border="0" cellspacing="0" cellpadding="1">
|
||||
<tr><td align="center" balign="center"> ExpressionBinaire </td></tr>
|
||||
</table></td></tr>
|
||||
</table>>, URL="null", fontname="Helvetica", fontcolor="black", fontsize=10.0];
|
||||
// Expression
|
||||
c7 [label=<<table title="Expression" border="0" cellborder="1" cellspacing="0" cellpadding="2" port="p">
|
||||
<tr><td><table border="0" cellspacing="0" cellpadding="1">
|
||||
<tr><td align="center" balign="center"> «interface» </td></tr>
|
||||
<tr><td align="center" balign="center"> Expression </td></tr>
|
||||
</table></td></tr>
|
||||
</table>>, URL="null", fontname="Helvetica", fontcolor="black", fontsize=10.0];
|
||||
// ExpressionUnaire
|
||||
c8 [label=<<table title="ExpressionUnaire" border="0" cellborder="1" cellspacing="0" cellpadding="2" port="p">
|
||||
<tr><td><table border="0" cellspacing="0" cellpadding="1">
|
||||
<tr><td align="center" balign="center"> ExpressionUnaire </td></tr>
|
||||
</table></td></tr>
|
||||
</table>>, URL="null", fontname="Helvetica", fontcolor="black", fontsize=10.0];
|
||||
// Multiplication
|
||||
c9 [label=<<table title="Multiplication" border="0" cellborder="1" cellspacing="0" cellpadding="2" port="p">
|
||||
<tr><td><table border="0" cellspacing="0" cellpadding="1">
|
||||
<tr><td align="center" balign="center"> Multiplication </td></tr>
|
||||
</table></td></tr>
|
||||
</table>>, URL="null", fontname="Helvetica", fontcolor="black", fontsize=10.0];
|
||||
// Negation
|
||||
c10 [label=<<table title="Negation" border="0" cellborder="1" cellspacing="0" cellpadding="2" port="p">
|
||||
<tr><td><table border="0" cellspacing="0" cellpadding="1">
|
||||
<tr><td align="center" balign="center"> Negation </td></tr>
|
||||
</table></td></tr>
|
||||
</table>>, URL="null", fontname="Helvetica", fontcolor="black", fontsize=10.0];
|
||||
// OperateurBinaire
|
||||
c11 [label=<<table title="OperateurBinaire" border="0" cellborder="1" cellspacing="0" cellpadding="2" port="p">
|
||||
<tr><td><table border="0" cellspacing="0" cellpadding="1">
|
||||
<tr><td align="center" balign="center"> «interface» </td></tr>
|
||||
<tr><td align="center" balign="center"> OperateurBinaire </td></tr>
|
||||
</table></td></tr>
|
||||
</table>>, URL="null", fontname="Helvetica", fontcolor="black", fontsize=10.0];
|
||||
// OperateurUnaire
|
||||
c12 [label=<<table title="OperateurUnaire" border="0" cellborder="1" cellspacing="0" cellpadding="2" port="p">
|
||||
<tr><td><table border="0" cellspacing="0" cellpadding="1">
|
||||
<tr><td align="center" balign="center"> «interface» </td></tr>
|
||||
<tr><td align="center" balign="center"> OperateurUnaire </td></tr>
|
||||
</table></td></tr>
|
||||
</table>>, URL="null", fontname="Helvetica", fontcolor="black", fontsize=10.0];
|
||||
//AccesVariable implements Expression
|
||||
c7:p -> c1:p [dir=back,arrowtail=empty,style=dashed];
|
||||
//Addition implements OperateurBinaire
|
||||
c11:p -> c2:p [dir=back,arrowtail=empty,style=dashed];
|
||||
//AfficheurInfixe implements VisiteurExpression<R>
|
||||
c0:p -> c3:p [dir=back,arrowtail=empty,style=dashed];
|
||||
//Constante implements Expression
|
||||
c7:p -> c4:p [dir=back,arrowtail=empty,style=dashed];
|
||||
//ExpressionBinaire implements Expression
|
||||
c7:p -> c6:p [dir=back,arrowtail=empty,style=dashed];
|
||||
// ExpressionBinaire HAS Expression
|
||||
c6:p -> c7:p [taillabel="1", label="", headlabel="gauche", fontname="Helvetica", fontcolor="black", fontsize=10.0, color="black", arrowhead=none, arrowtail=ediamond, dir=both];
|
||||
// ExpressionBinaire HAS Expression
|
||||
c6:p -> c7:p [taillabel="1", label="", headlabel="droite", fontname="Helvetica", fontcolor="black", fontsize=10.0, color="black", arrowhead=none, arrowtail=ediamond, dir=both];
|
||||
// ExpressionBinaire COMPOSED OperateurBinaire
|
||||
c6:p -> c11:p [taillabel="1", label="", headlabel="operateur", fontname="Helvetica", fontcolor="black", fontsize=10.0, color="black", arrowhead=none, arrowtail=diamond, dir=both];
|
||||
//ExpressionUnaire implements Expression
|
||||
c7:p -> c8:p [dir=back,arrowtail=empty,style=dashed];
|
||||
// ExpressionUnaire HAS Expression
|
||||
c8:p -> c7:p [taillabel="1", label="", headlabel="operande", fontname="Helvetica", fontcolor="black", fontsize=10.0, color="black", arrowhead=none, arrowtail=ediamond, dir=both];
|
||||
// ExpressionUnaire COMPOSED OperateurUnaire
|
||||
c8:p -> c12:p [taillabel="1", label="", headlabel="operateur", fontname="Helvetica", fontcolor="black", fontsize=10.0, color="black", arrowhead=none, arrowtail=diamond, dir=both];
|
||||
//Multiplication implements OperateurBinaire
|
||||
c11:p -> c9:p [dir=back,arrowtail=empty,style=dashed];
|
||||
//Negation implements OperateurUnaire
|
||||
c12:p -> c10:p [dir=back,arrowtail=empty,style=dashed];
|
||||
}
|
||||
|
161
expressions.fig
Executable file
161
expressions.fig
Executable file
|
@ -0,0 +1,161 @@
|
|||
#FIG 3.2
|
||||
# Generated by graphviz version 2.43.0 (0)
|
||||
# Title: G
|
||||
# Pages: 1
|
||||
Portrait
|
||||
Center
|
||||
Inches
|
||||
Letter
|
||||
100.00
|
||||
Single
|
||||
-2
|
||||
1200 2
|
||||
0 32 #d3d3d3
|
||||
0 33 #fffffe
|
||||
2 3 0 1 33 7 2 0 20 0.0 0 0 0 0 0 5
|
||||
0 5360 0 0 12330 0 12330 5360 0 5360
|
||||
# c0
|
||||
2 3 0 1 0 7 1 0 -1 0.0 0 0 0 0 0 5
|
||||
250 800 250 160 2830 160 2830 800 250 800
|
||||
4 0 0 1 0 16 10.0 0.0000 6 10.0 50.0 920 368 \302\253interface\302\273 \001
|
||||
4 0 0 1 0 16 10.0 0.0000 6 10.0 76.7 330 628 VisiteurExpression<R> \001
|
||||
# c3
|
||||
2 3 0 1 0 7 1 0 -1 0.0 0 0 0 0 0 5
|
||||
690 2160 690 1780 2370 1780 2370 2160 690 2160
|
||||
4 0 0 1 0 16 10.0 0.0000 6 10.0 56.7 770 1988 AfficheurInfixe \001
|
||||
# c0->c3
|
||||
3 4 1 1 0 0 0 0 -1 10.0 0 0 0 7
|
||||
1530 1012 1530 1146 1530 1282 1530 1415 1530 1543 1530 1660 1530 1762
|
||||
0 1 1 1 1 1 0
|
||||
2 3 0 1 0 0 0 0 -1 0.0 0 0 0 0 0 4
|
||||
1460 1005 1530 805 1600 1005 1460 1005
|
||||
# c1
|
||||
2 3 0 1 0 7 1 0 -1 0.0 0 0 0 0 0 5
|
||||
5790 2160 5790 1780 7450 1780 7450 2160 5790 2160
|
||||
4 0 0 1 0 16 10.0 0.0000 6 10.0 50.0 5870 1988 AccesVariable \001
|
||||
# c2
|
||||
2 3 0 1 0 7 1 0 -1 0.0 0 0 0 0 0 5
|
||||
2510 5120 2510 4740 3610 4740 3610 5120 2510 5120
|
||||
4 0 0 1 0 16 10.0 0.0000 6 10.0 33.3 2590 4948 Addition \001
|
||||
# c4
|
||||
2 3 0 1 0 7 1 0 -1 0.0 0 0 0 0 0 5
|
||||
8130 2160 8130 1780 9410 1780 9410 2160 8130 2160
|
||||
4 0 0 1 0 16 10.0 0.0000 6 10.0 36.7 8210 1988 Constante \001
|
||||
# c5
|
||||
2 3 0 1 0 7 1 0 -1 0.0 0 0 0 0 0 5
|
||||
7990 680 7990 300 10150 300 10150 680 7990 680
|
||||
4 0 0 1 0 16 10.0 0.0000 6 10.0 63.3 8070 508 ExemplesAffichage \001
|
||||
# c6
|
||||
2 3 0 1 0 7 1 0 -1 0.0 0 0 0 0 0 5
|
||||
3050 2160 3050 1780 5090 1780 5090 2160 3050 2160
|
||||
4 0 0 1 0 16 10.0 0.0000 6 10.0 63.3 3130 1988 ExpressionBinaire \001
|
||||
# c7
|
||||
2 3 0 1 0 7 1 0 -1 0.0 0 0 0 0 0 5
|
||||
5910 800 5910 160 7310 160 7310 800 5910 800
|
||||
4 0 0 1 0 16 10.0 0.0000 6 10.0 50.0 5990 368 \302\253interface\302\273 \001
|
||||
4 0 0 1 0 16 10.0 0.0000 6 10.0 40.0 6010 628 Expression \001
|
||||
# c6->c7
|
||||
3 4 0 1 0 0 0 0 -1 0.0 0 0 0 7
|
||||
4585 1648 4816 1517 5068 1374 5330 1226 5592 1077 5845 934 6078 802
|
||||
0 1 1 1 1 1 0
|
||||
2 3 0 1 0 0 0 0 -1 0.0 0 0 0 0 0 5
|
||||
4580 1651 4436 1640 4371 1769 4515 1780 4580 1651
|
||||
4 1 0 0 0 16 10.0 0.0000 6 10.0 20.0 5718 930 gauche\001
|
||||
4 1 0 0 0 16 10.0 0.0000 6 10.0 3.3 4301 1677 1\001
|
||||
# c6->c7
|
||||
3 4 0 1 0 0 0 0 -1 0.0 0 0 0 7
|
||||
4773 1665 5034 1533 5307 1388 5581 1236 5846 1084 6090 937 6302 802
|
||||
0 1 1 1 1 1 0
|
||||
2 3 0 1 0 0 0 0 -1 0.0 0 0 0 0 0 5
|
||||
4770 1666 4628 1645 4553 1769 4696 1790 4770 1666
|
||||
4 1 0 0 0 16 10.0 0.0000 6 10.0 20.0 6592 930 droite\001
|
||||
4 1 0 0 0 16 10.0 0.0000 6 10.0 3.3 4483 1677 1\001
|
||||
# c11
|
||||
2 3 0 1 0 7 1 0 -1 0.0 0 0 0 0 0 5
|
||||
3090 3760 3090 3120 5050 3120 5050 3760 3090 3760
|
||||
4 0 0 1 0 16 10.0 0.0000 6 10.0 50.0 3450 3328 \302\253interface\302\273 \001
|
||||
4 0 0 1 0 16 10.0 0.0000 6 10.0 60.0 3170 3588 OperateurBinaire \001
|
||||
# c6->c11
|
||||
3 4 0 1 0 0 0 0 -1 0.0 0 0 0 7
|
||||
4070 2391 4070 2511 4070 2636 4070 2763 4070 2888 4070 3008 4070 3119
|
||||
0 1 1 1 1 1 0
|
||||
2 3 0 1 0 0 0 0 20 0.0 0 0 0 0 0 5
|
||||
4070 2391 4150 2271 4070 2151 3990 2271 4070 2391
|
||||
4 1 0 0 0 16 10.0 0.0000 6 10.0 30.0 3590 3027 operateur\001
|
||||
4 1 0 0 0 16 10.0 0.0000 6 10.0 3.3 4000 2279 1\001
|
||||
# c7->c1
|
||||
3 4 1 1 0 0 0 0 -1 10.0 0 0 0 7
|
||||
6610 1012 6610 1146 6610 1282 6610 1415 6610 1543 6610 1660 6610 1762
|
||||
0 1 1 1 1 1 0
|
||||
2 3 0 1 0 0 0 0 -1 0.0 0 0 0 0 0 4
|
||||
6540 1005 6610 805 6680 1005 6540 1005
|
||||
# c7->c4
|
||||
3 4 1 1 0 0 0 0 -1 10.0 0 0 0 7
|
||||
7231 914 7452 1062 7683 1215 7914 1370 8136 1518 8339 1653 8514 1769
|
||||
0 1 1 1 1 1 0
|
||||
2 3 0 1 0 0 0 0 -1 0.0 0 0 0 0 0 4
|
||||
7190 971 7063 802 7268 855 7190 971
|
||||
# c7->c6
|
||||
3 4 1 1 0 0 0 0 -1 10.0 0 0 0 7
|
||||
5730 864 5440 1016 5146 1177 4861 1340 4599 1498 4371 1642 4193 1766
|
||||
0 1 1 1 1 1 0
|
||||
2 3 0 1 0 0 0 0 -1 0.0 0 0 0 0 0 4
|
||||
5699 801 5909 774 5761 926 5699 801
|
||||
# c8
|
||||
2 3 0 1 0 7 1 0 -1 0.0 0 0 0 0 0 5
|
||||
10090 2160 10090 1780 12090 1780 12090 2160 10090 2160
|
||||
4 0 0 1 0 16 10.0 0.0000 6 10.0 60.0 10170 1988 ExpressionUnaire \001
|
||||
# c7->c8
|
||||
3 4 1 1 0 0 0 0 -1 10.0 0 0 0 13
|
||||
7435 868 7441 870 7447 872 7452 874 7458 876 7464 878 7470 880 7979 1048 8501 1214 9018 1374 9514 1523 9971 1656 10374 1769
|
||||
0 1 1 1 1 1 1 1 1 1 1 1 0
|
||||
2 3 0 1 0 0 0 0 -1 0.0 0 0 0 0 0 4
|
||||
7407 933 7241 801 7453 800 7407 933
|
||||
# c8->c7
|
||||
3 4 0 1 0 0 0 0 -1 0.0 0 0 0 13
|
||||
10396 1695 10037 1583 9632 1457 9195 1321 8740 1177 8280 1029 7830 880 7746 851 7661 822 7574 792 7487 761 7400 731 7314 701
|
||||
0 1 1 1 1 1 1 1 1 1 1 1 0
|
||||
2 3 0 1 0 0 0 0 -1 0.0 0 0 0 0 0 5
|
||||
10403 1697 10493 1809 10632 1769 10541 1657 10403 1697
|
||||
4 1 0 0 0 16 10.0 0.0000 6 10.0 26.7 7774 829 operande\001
|
||||
4 1 0 0 0 16 10.0 0.0000 6 10.0 3.3 10562 1677 1\001
|
||||
# c12
|
||||
2 3 0 1 0 7 1 0 -1 0.0 0 0 0 0 0 5
|
||||
10130 3760 10130 3120 12050 3120 12050 3760 10130 3760
|
||||
4 0 0 1 0 16 10.0 0.0000 6 10.0 50.0 10470 3328 \302\253interface\302\273 \001
|
||||
4 0 0 1 0 16 10.0 0.0000 6 10.0 56.7 10210 3588 OperateurUnaire \001
|
||||
# c8->c12
|
||||
3 4 0 1 0 0 0 0 -1 0.0 0 0 0 7
|
||||
11090 2391 11090 2511 11090 2636 11090 2763 11090 2888 11090 3008 11090 3119
|
||||
0 1 1 1 1 1 0
|
||||
2 3 0 1 0 0 0 0 20 0.0 0 0 0 0 0 5
|
||||
11090 2391 11170 2271 11090 2151 11010 2271 11090 2391
|
||||
4 1 0 0 0 16 10.0 0.0000 6 10.0 30.0 10610 3027 operateur\001
|
||||
4 1 0 0 0 16 10.0 0.0000 6 10.0 3.3 11125 2279 1\001
|
||||
# c9
|
||||
2 3 0 1 0 7 1 0 -1 0.0 0 0 0 0 0 5
|
||||
4290 5120 4290 4740 5910 4740 5910 5120 4290 5120
|
||||
4 0 0 1 0 16 10.0 0.0000 6 10.0 53.3 4370 4948 Multiplication \001
|
||||
# c10
|
||||
2 3 0 1 0 7 1 0 -1 0.0 0 0 0 0 0 5
|
||||
10510 5120 10510 4740 11690 4740 11690 5120 10510 5120
|
||||
4 0 0 1 0 16 10.0 0.0000 6 10.0 33.3 10590 4948 Negation \001
|
||||
# c11->c2
|
||||
3 4 1 1 0 0 0 0 -1 10.0 0 0 0 7
|
||||
3735 3933 3637 4072 3536 4214 3436 4356 3340 4491 3252 4614 3176 4722
|
||||
0 1 1 1 1 1 0
|
||||
2 3 0 1 0 0 0 0 -1 0.0 0 0 0 0 0 4
|
||||
3681 3888 3854 3765 3795 3969 3681 3888
|
||||
# c11->c9
|
||||
3 4 1 1 0 0 0 0 -1 10.0 0 0 0 7
|
||||
4405 3933 4503 4072 4604 4214 4704 4356 4800 4491 4888 4614 4964 4722
|
||||
0 1 1 1 1 1 0
|
||||
2 3 0 1 0 0 0 0 -1 0.0 0 0 0 0 0 4
|
||||
4345 3969 4286 3765 4459 3888 4345 3969
|
||||
# c12->c10
|
||||
3 4 1 1 0 0 0 0 -1 10.0 0 0 0 7
|
||||
11090 3972 11090 4106 11090 4242 11090 4375 11090 4503 11090 4620 11090 4722
|
||||
0 1 1 1 1 1 0
|
||||
2 3 0 1 0 0 0 0 -1 0.0 0 0 0 0 0 4
|
||||
11020 3965 11090 3765 11160 3965 11020 3965
|
||||
# end of FIG file
|
BIN
expressions.pdf
Executable file
BIN
expressions.pdf
Executable file
Binary file not shown.
Loading…
Reference in a new issue