From d8507aeed14b0691e99f8de61e8dce7c46dfb58e Mon Sep 17 00:00:00 2001 From: [mandjemb] Date: Thu, 6 Jun 2019 16:36:57 +0200 Subject: [PATCH] Fichiers --- src/noyau/Addition.java | 32 ++++++++++++++++++++++++++++++++ src/noyau/Case.java | 13 +++++++++++++ src/noyau/Division.java | 34 ++++++++++++++++++++++++++++++++++ src/noyau/Fonctions.java | 25 +++++++++++++++++++++++++ src/noyau/Formule.java | 9 +++++++++ src/noyau/Grille.java | 1 + src/noyau/Moyenne.java | 33 +++++++++++++++++++++++++++++++++ src/noyau/Multiplication.java | 30 ++++++++++++++++++++++++++++++ src/noyau/OperationBinaire.java | 24 ++++++++++++++++++++++++ src/noyau/Somme.java | 31 +++++++++++++++++++++++++++++++ src/noyau/Soustraction.java | 32 ++++++++++++++++++++++++++++++++ 11 files changed, 264 insertions(+), 0 deletions(-) create mode 100644 src/noyau/Addition.java create mode 100644 src/noyau/Case.java create mode 100644 src/noyau/Division.java create mode 100644 src/noyau/Fonctions.java create mode 100644 src/noyau/Formule.java create mode 100644 src/noyau/Moyenne.java create mode 100644 src/noyau/Multiplication.java create mode 100644 src/noyau/OperationBinaire.java create mode 100644 src/noyau/Somme.java create mode 100644 src/noyau/Soustraction.java diff --git a/src/noyau/Addition.java b/src/noyau/Addition.java new file mode 100644 index 0000000..cc9be81 --- /dev/null +++ b/src/noyau/Addition.java @@ -0,0 +1,32 @@ +package noyau; + +import java.util.stream.Collectors; + +public class Addition extends OperationBinaire { + + Addition(Case g,Case d){ + gauche=g; + droite=d; + } + + + public double eval() { + + if (!creerCycle(gauche) && !creerCycle(droite)) + return gauche.getValeur() + droite.getValeur(); + + } + + + public String toString(){ + + return gauche.getId() +" + " + droite.getId() ; + } + + + public String getFormuleDeveloppe(){ + + return ""; + } + +} diff --git a/src/noyau/Case.java b/src/noyau/Case.java new file mode 100644 index 0000000..468a205 --- /dev/null +++ b/src/noyau/Case.java @@ -0,0 +1,13 @@ +package noyau; + +import java.util.*; + +public class Case { + + String colonne; + int ligne; + double valeur; + ArrayList utiliseDans = new ArrayList(); + boolean isFormule; + +} diff --git a/src/noyau/Division.java b/src/noyau/Division.java new file mode 100644 index 0000000..c7c8472 --- /dev/null +++ b/src/noyau/Division.java @@ -0,0 +1,34 @@ +package noyau; + +public class Division extends OperationBinaire{ + + Division(Case g,Case d){ + gauche=g; + droite=d; + } + + + + public double eval() { + + try{ + if (!creerCycle(gauche) && !creerCycle(droite)) + return gauche.getValeur() / droite.getValeur(); + } + catch(ArithmeticException ex){} + } + + + public String toString(){ + + return gauche.getId() +" / " + droite.getId() ; + } + + + + public String getFormuleDeveloppe(){ + + return ""; + } + +} diff --git a/src/noyau/Fonctions.java b/src/noyau/Fonctions.java new file mode 100644 index 0000000..41534bb --- /dev/null +++ b/src/noyau/Fonctions.java @@ -0,0 +1,25 @@ +package noyau; + +import java.util.*; + +abstract public class Fonctions extends Formule { + + ArrayList listCases = new ArrayList(); + + abstract public String getFormuleDeveloppe(); + + + + public boolean creerCycle(Case uneCase){ + + //if (!listePlage.contains(uneCase) && uneCase.utiliseDans.size()==0) + return false; + + + + + + } + + +} diff --git a/src/noyau/Formule.java b/src/noyau/Formule.java new file mode 100644 index 0000000..0f74850 --- /dev/null +++ b/src/noyau/Formule.java @@ -0,0 +1,9 @@ +package noyau; + +abstract public class Formule { + + abstract public String toString(); + abstract public double eval(); + + +} diff --git a/src/noyau/Grille.java b/src/noyau/Grille.java index 0b8c48c..bfb81ed 100644 --- a/src/noyau/Grille.java +++ b/src/noyau/Grille.java @@ -1,4 +1,5 @@ package noyau; public class Grille { + } diff --git a/src/noyau/Moyenne.java b/src/noyau/Moyenne.java new file mode 100644 index 0000000..17d0fb6 --- /dev/null +++ b/src/noyau/Moyenne.java @@ -0,0 +1,33 @@ +package noyau; + +import java.util.stream.Collectors; + +public class Moyenne extends Fonctions{ + + + public String toString(){ + + return "MOYENNE(" + listCases.stream() + .map( n -> n.getId() ) + .collect( Collectors.joining( "," ) ) + +")"; + } + + public String getFormuleDeveloppe(){ + + return ""; + } + + public double eval() { + + double val=0; + + try{ + for(int i=0; i n.getId() ) + .collect( Collectors.joining( "," ) ) + +")"; + } + + public String getFormuleDeveloppe(){ + + return ""; + } + + public double eval() { + + double val=0; + + if (listCases.size() != 0) + for(int i=0; i