analyseWriter/src/evaluer/analyseFichier.java

488 lines
27 KiB
Java

package evaluer;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import javax.swing.JEditorPane;
import MEPTL.commandes;
import MEPTL.meptl;
import cXML.Run;
import cXML.node;
public class analyseFichier {
/**
* Début de l'analyse par comparaison du node étudiant avec le node sujet.
* @param nodStudent, le node étudiant.
* @param nodSujet, le node sujet.
* @param indexStudent, index de l'étudiant
* @param a, objet Run de la class cXML
* @return retourne le node "ana" analyse contenant toute l'analyse.
*/
public static node analyse(node nodStudent, node nodSujet, Integer indexStudent, Run a,JEditorPane txt, String texteAfficher) {
// initialisation des nodes d'analyse
node erreurs = new node();
node nodmeta = new node();
node nodpage = new node();
node nodparagraph = new node();
node nodsequence = new node();
node nodnumerochapitre = new node();
node nodframes = new node();
node nodsections = new node();
node nodtableaux = new node();
node nodbiblio = new node();
node nodtablematieres = new node();
node nodtableillustrations = new node();
node nodstructurepage = new node();
// ouverture
node nodouverture = new node();
nodouverture.setNomElt("ouverture");
nodouverture.setAttributs(nodSujet.getAttributs());
nodouverture.getAttributs().put("dossier",a.getLectDossiers().getEC().getListeNomDossier().get(indexStudent));
if(a.getLectDossiers().getEC().getListeFichierodt().get(indexStudent)!=null) {
nodouverture.getAttributs().put("filename", a.getLectDossiers().getEC().getListeFichierodt().get(indexStudent));
}
if(nodSujet.getAttributs().get("analysis_filename")!=null) nodouverture.getAttributs().put("filenameAnalyse", nodSujet.getAttributs().get("analysis_filename"));
if(nodStudent.getAttributs().get("producteur")!=null) nodouverture.getAttributs().put("producteur", nodStudent.getAttributs().get("producteur"));
if(nodStudent.getAttributs().get("dureeEdition")!=null) nodouverture.getAttributs().put("dureeEdition", nodStudent.getAttributs().get("dureeEdition"));
if(nodStudent.getAttributs().get("dateModification")!=null) nodouverture.getAttributs().put("dateModification", nodStudent.getAttributs().get("dateModification"));
nodouverture.getAttributs().put("patch", a.getPatch());
if(nodSujet.getAttributs().get("historiquePresent")!=null) nodouverture.getAttributs().put("historiquePresent", nodSujet.getAttributs().get("historiquePresent"));
if(nodSujet.getAttributs().get("controleDateCreation")!=null) nodouverture.getAttributs().put("controleDateCreation", nodSujet.getAttributs().get("controleDateCreation"));
if(nodSujet.getAttributs().get("presenceMetaSujet")!=null) nodouverture.getAttributs().put("presenceMetaSujet", nodSujet.getAttributs().get("presenceMetaSujet"));
if(nodSujet.getAttributs().get("baremeABC")!=null) nodouverture.getAttributs().put("baremeABC", nodSujet.getAttributs().get("baremeABC"));
if(nodSujet.retourneEnfantsByNameExist("setting")) {
node setting = nodSujet.retourneFirstEnfantsByName("setting");
if(setting.retourneEnfantsByNameExist("text:similarity")) {
node textSimilarity = setting.retourneFirstEnfantsByName("text:similarity");
if(textSimilarity.getAttributs().get("tolerance_text")!=null) {
nodouverture.getAttributs().put("tolerance_text", textSimilarity.getAttributs().get("tolerance_text"));
}
}
}
nodouverture.setClose(true);
texteAfficher = texteAfficher + "\n" + nodouverture.getAttributs().get("dossier");
txt.setText(texteAfficher);
// txt.setText("\nEvaluation du fichier n° " + String.valueOf(indexStudent) +"/ " + nbFichierWriter + " fichier(s)"+
// "\n" + nodouverture.getAttributs().get("dossier"));
//Body et note (par défaut valeur nulle)
node nodbodyetnotation = new node();
nodbodyetnotation.setNomElt("bodyetnotation");
nodbodyetnotation.getAttributs().put("note", "0");
nodbodyetnotation.getAttributs().put("commentaire", "");
nodbodyetnotation.getAttributs().put("proportioncorrect", "0");
nodbodyetnotation.getAttributs().put("baremeABC", "false");
if(nodSujet.getAttributs().get("baremeABC")!=null) nodbodyetnotation.getAttributs().put("baremeABC", nodSujet.getAttributs().get("baremeABC"));
nodbodyetnotation.setClose(true);
//Le menu
node nodmenu = new node();
nodmenu.setNomElt("menu");
nodmenu = meptl.retourneNodeMenu(nodSujet, nodmenu, 0, 0);
nodmenu.setClose(true);
// verification de la métadonnées Sujet
erreurs = meptl.retourneNodeErreur(nodStudent, nodSujet, a);
// verification si au moins une erreur alors l'analyse est terminée
if(Boolean.valueOf(erreurs.getAttributs().get("oneError"))){
return clotureNodeAnalyse(nodouverture, nodbodyetnotation, nodmenu, erreurs, nodmeta, nodpage, nodparagraph, nodsequence, nodnumerochapitre, nodframes, nodsections, nodtableaux, nodbiblio, nodtablematieres, nodtableillustrations, nodstructurepage, nodSujet.getContenu().get(0), null);
}
//Ordre d'affichage dans le feeback, tous les node de niveau 1
Enumeration<node> EnuNod = Collections.enumeration(nodSujet.getNodes());
ArrayList<String> ordre = new ArrayList<String>();
while(EnuNod.hasMoreElements()) {
node nod = EnuNod.nextElement();
//Analyse Meta si evaluer=true
if(nod.getNomElt().equals("office:meta")) {
if(nod.getAttributs().get("evaluer")!=null) {
if(nod.getAttributs().get("evaluer").equals("true")) {
nodmeta = analyseLesNodesPrincipaux.analyseLesMeta(nodStudent.retourneFirstEnfantsByName("office:meta"), nod, a, nodmenu);
ordre.add("meta");
}
}
}
//Analyse les pages (nécessaire d'avoir aussi les styles de paragraphes pour analyser les styles de page)
if(nod.getNomElt().equals("style:page")) {
if(nod.getAttributs().get("evaluer")!=null) {
if(nod.getAttributs().get("evaluer").equals("true")) {
if(nodSujet.containElementByName("style:paragraph")) {
nodpage = analyseLesNodesPrincipaux.analysePage(nodStudent.retourneFirstEnfantsByName("style:page"), nod, a, nodmenu,nodSujet.retourneFirstEnfantsByName("style:paragraph"),nodStudent.retourneFirstEnfantsByName("style:paragraph"));
}else {
nodpage = analyseLesNodesPrincipaux.analysePage(nodStudent.retourneFirstEnfantsByName("style:page"), nod, a, nodmenu,null,null);
}
ordre.add("pages");
}
}
}
//Analyse les styles paragraphes, caractères, listes, ...
if(nod.getNomElt().equals("style:paragraph")) {
if(nod.getAttributs().get("evaluer")!=null) {
if(nod.getAttributs().get("evaluer").equals("true")) {
nodparagraph = analyseLesNodesPrincipaux.analyseParagraph(nodStudent.retourneFirstEnfantsByName("style:paragraph"), nod, a, nodmenu);
ordre.add("paragraphs");
}
}
}
//Analyse les variables de séquence si evaluer=true
if(nod.getNomElt().equals("sequences")) {
if(nod.getAttributs().get("evaluer")!=null) {
if(nod.getAttributs().get("evaluer").equals("true")) {
nodsequence = analyseLesNodesPrincipaux.analyseLesSequences(nodStudent.retourneFirstEnfantsByName("sequences"), nod, a, nodmenu);
ordre.add("sequences");
}
}
}
//Analyse de la numérotation des chapitres si evaluer=true
if(nod.getNomElt().equals("numerotationchapitre")) {
if(nod.getAttributs().get("evaluer")!=null) {
if(nod.getAttributs().get("evaluer").equals("true")) {
nodnumerochapitre = analyseLesNodesPrincipaux.analyseLaNumerotationChapitre(nodStudent.retourneFirstEnfantsByName("numerotationchapitre"), nod, a, nodmenu);
ordre.add("numerotationchapitre");
}
}
}
//Analyse les frames si evaluer=true
if(nod.getNomElt().equals("frames")) {
if(nod.getAttributs().get("evaluer")!=null) {
if(nod.getAttributs().get("evaluer").equals("true")) {
nodframes = analyseLesNodesPrincipaux.analyseLesFrames(nodStudent.retourneFirstEnfantsByName("frames"), nod, a, nodmenu);
ordre.add("frames");
}
}
}
//Analyse des sections si evaluer=true
if(nod.getNomElt().equals("sections")) {
if(nod.getAttributs().get("evaluer")!=null) {
if(nod.getAttributs().get("evaluer").equals("true")) {
nodsections = analyseLesNodesPrincipaux.analyseLesSections(nodStudent.retourneFirstEnfantsByName("sections"), nod, a, nodmenu);
ordre.add("sections");
}
}
}
//Analyse les tableaux si evaluer=true
if(nod.getNomElt().equals("tableaux")) {
if(nod.getAttributs().get("evaluer")!=null) {
if(nod.getAttributs().get("evaluer").equals("true")) {
nodtableaux = analyseLesNodesPrincipaux.analyseLesTableaux(nodStudent.retourneFirstEnfantsByName("tableaux"), nod, a, nodmenu);
ordre.add("tableaux");
}
}
}
//Analyse la bibliographie de LibreOffice si evaluer=true
if(nod.getNomElt().equals("biblio")) {
if(nod.getAttributs().get("evaluer")!=null) {
if(nod.getAttributs().get("evaluer").equals("true")) {
nodbiblio = analyseLesNodesPrincipaux.analyseLaBiblio(nodStudent.retourneFirstEnfantsByName("biblio"), nod, a, nodmenu);
ordre.add("bibliographies");
}
}
}
//Analyse des tables des matières si evaluer=true
if(nod.getNomElt().equals("tablematieres")) {
if(nod.getAttributs().get("evaluer")!=null) {
if(nod.getAttributs().get("evaluer").equals("true")) {
nodtablematieres = analyseLesNodesPrincipaux.analyseLesTablesMatieres(nodStudent.retourneFirstEnfantsByName("tablematieres"), nod, a, nodmenu);
ordre.add("tablematieres");
}
}
}
//Analyse des tables illustrations si evaluer=true
if(nod.getNomElt().equals("tableillustrations")) {
if(nod.getAttributs().get("evaluer")!=null) {
if(nod.getAttributs().get("evaluer").equals("true")) {
nodtableillustrations = analyseLesNodesPrincipaux.analyseLesTablesIllustrations(nodStudent.retourneFirstEnfantsByName("tableillustrations"), nod, a, nodmenu);
ordre.add("tableillustrations");
}
}
}
//Analyse la structure du document
if(nod.getNomElt().equals("structurepage")) {
if(nod.getAttributs().get("evaluer")!=null) {
if(nod.getAttributs().get("evaluer").equals("true")) {
node nodSujetParagraphs = null;
if(nodSujet.retourneFirstEnfantsByName("style:paragraph").getNomElt().equals("style:paragraph")) nodSujetParagraphs = nodSujet.retourneFirstEnfantsByName("style:paragraph");
node nodStudentParagraphs = nodStudent.retourneFirstEnfantsByName("style:paragraph");
nodstructurepage = analyseLesNodesPrincipaux.analyseStructurePage(nodStudent.retourneFirstEnfantsByName("structurepage"), nod, a, nodmenu,nodSujetParagraphs, nodStudentParagraphs );
ordre.add("structurepage");
}
}
}
}
//Retourne le node analyse assemblé et calcul de la note avec le barème
if(nodSujet.getContenu().size()>0) {
return clotureNodeAnalyse(nodouverture, nodbodyetnotation, nodmenu, erreurs, nodmeta, nodpage, nodparagraph, nodsequence, nodnumerochapitre, nodframes, nodsections, nodtableaux, nodbiblio, nodtablematieres, nodtableillustrations, nodstructurepage,nodSujet.getContenu().get(0), ordre);
}else {
return clotureNodeAnalyse(nodouverture, nodbodyetnotation, nodmenu, erreurs, nodmeta, nodpage, nodparagraph, nodsequence, nodnumerochapitre, nodframes, nodsections, nodtableaux, nodbiblio, nodtablematieres, nodtableillustrations, nodstructurepage,"", ordre);
}
}
/**
* Assemblage du node analyse à partir des différents nodes de l'analyse.<br>
* <br>
* @param nodouverture
* @param nodbodyetnotation
* @param nodmenu
* @param erreurs
* @param nodmeta
* @param nodpage
* @param nodparagraph
* @param nodsequence
* @param nodnumerochapitre
* @param nodframes
* @param nodsections
* @param nodtableaux
* @param nodbiblio
* @param nodtablematieres
* @param nodtableillustrations
* @param nodstructurepage
* @return
*/
public static node clotureNodeAnalyse(node nodouverture, node nodbodyetnotation, node nodmenu, node erreurs, node nodmeta, node nodpage,
node nodparagraph, node nodsequence, node nodnumerochapitre, node nodframes, node nodsections, node nodtableaux, node nodbiblio, node nodtablematieres,
node nodtableillustrations, node nodstructurepage, String texteCommentaire, ArrayList<String> ordre) {
node nodanalyse = new node();
//recalcul les points pour les placer dans le node nodbodyetnotation
double notefrom = 20; // valeur par défaut
double progression = 1; // valeur par défaut
boolean baremeABC = false;
if(nodouverture!=null) if(nodouverture.isClose()) {
if(nodouverture.getAttributs().get("notefrom")!=null) {
try {
notefrom = Math.abs(Double.valueOf(nodouverture.getAttributs().get("notefrom")));
}catch (Exception e) {
commandes.message.append("<p>** La variable notefrom ne peut être convertie en double. **</p>");
commandes.message.append("<p>La valeur de notefrom est alors automatique de 20.</p>");
System.out.println("The \"noteFrom\" attribute of the analyze file cannot be converted to a \"double\".");
System.out.println("Value of notefrom = 20.");
}
}
if(nodouverture.getAttributs().get("progression")!=null) {
try {
progression = Math.abs(Double.valueOf(nodouverture.getAttributs().get("progression")));
}catch (Exception e) {
commandes.message.append("<p>** La variable progression ne peut être convertie en double. **</p>");
commandes.message.append("<p>La valeur du coef. de progression est alors automatique de 1.</p>");
System.out.println("The \"progression\" attribute of the analyze file cannot be converted to \"double\".");
System.out.println("Value of progression = 1.");
}
}
if(nodouverture.getAttributs().get("baremeABC")!=null) {
try {
baremeABC = Boolean.valueOf(nodouverture.getAttributs().get("baremeABC"));
}catch (Exception e) {
commandes.message.append("<p>** La variable baremeABC ne peut être convertie en boolean. **</p>");
commandes.message.append("<p>La valeur de baremeABC est alors automatique de false.</p>");
System.out.println("The \"baremeABC\" attribute of the analyze file cannot be converted to \"boolean\".");
System.out.println("Value of baremeABC = false.");
}
}
}
double pointmeta = 0; double pointmetatotal = 0 ; double poidsmeta = 0;
if(nodmeta!=null) if(nodmeta.isClose()) {
if(nodmeta.getAttributs().get("pointgagner")!=null) pointmeta = Double.valueOf(nodmeta.getAttributs().get("pointgagner"));
if(nodmeta.getAttributs().get("pointtotal")!=null) pointmetatotal = Double.valueOf(nodmeta.getAttributs().get("pointtotal"));
if(nodmeta.getAttributs().get("poids")!=null) try{poidsmeta = Math.abs(Double.valueOf(nodmeta.getAttributs().get("poids")));}catch (Exception e) { };
}
double pointpage = 0; double pointpagetotal = 0 ; double poidspage = 0;
if(nodpage!=null) if(nodpage.isClose()) {
if(nodpage.getAttributs().get("pointgagner")!=null) pointpage = Double.valueOf(nodpage.getAttributs().get("pointgagner"));
if(nodpage.getAttributs().get("pointtotal")!=null) pointpagetotal = Double.valueOf(nodpage.getAttributs().get("pointtotal"));
if(nodpage.getAttributs().get("poids")!=null) try{poidspage = Math.abs(Double.valueOf(nodpage.getAttributs().get("poids")));}catch (Exception e) { };
}
double pointparagraph = 0; double pointparagraphtotal = 0 ; double poidsparagraph = 0;
if(nodparagraph!=null) if(nodparagraph.isClose()) {
if(nodparagraph.getAttributs().get("pointgagner")!=null) pointparagraph = Double.valueOf(nodparagraph.getAttributs().get("pointgagner"));
if(nodparagraph.getAttributs().get("pointtotal")!=null) pointparagraphtotal = Double.valueOf(nodparagraph.getAttributs().get("pointtotal"));
if(nodparagraph.getAttributs().get("poids")!=null) try{Math.abs(poidsparagraph = Double.valueOf(nodparagraph.getAttributs().get("poids")));}catch (Exception e) { };
}
double pointsequence = 0; double pointsequencetotal = 0 ; double poidssequence = 0;
if(nodsequence!=null) if(nodsequence.isClose()) {
if(nodsequence.getAttributs().get("pointgagner")!=null) pointsequence = Double.valueOf(nodsequence.getAttributs().get("pointgagner"));
if(nodsequence.getAttributs().get("pointtotal")!=null) pointsequencetotal = Double.valueOf(nodsequence.getAttributs().get("pointtotal"));
if(nodsequence.getAttributs().get("poids")!=null) try{poidssequence = Math.abs(Double.valueOf(nodsequence.getAttributs().get("poids")));}catch (Exception e) { };
}
double pointnumerotation = 0; double pointnumerotationtotal = 0 ; double poidsnumerotation = 0;
if(nodnumerochapitre!=null) if(nodnumerochapitre.isClose()) {
if(nodnumerochapitre.getAttributs().get("pointgagner")!=null) pointnumerotation = Double.valueOf(nodnumerochapitre.getAttributs().get("pointgagner"));
if(nodnumerochapitre.getAttributs().get("pointtotal")!=null) pointnumerotationtotal = Double.valueOf(nodnumerochapitre.getAttributs().get("pointtotal"));
if(nodnumerochapitre.getAttributs().get("poids")!=null) try{poidsnumerotation = Math.abs(Double.valueOf(nodnumerochapitre.getAttributs().get("poids")));}catch (Exception e) { };
}
double pointframe = 0; double pointframetotal = 0 ; double poidsframe = 0;
if(nodframes!=null) if(nodframes.isClose()) {
if(nodframes.getAttributs().get("pointgagner")!=null) pointframe = Double.valueOf(nodframes.getAttributs().get("pointgagner"));
if(nodframes.getAttributs().get("pointtotal")!=null) pointframetotal = Double.valueOf(nodframes.getAttributs().get("pointtotal"));
if(nodframes.getAttributs().get("poids")!=null) try{poidsframe = Math.abs(Double.valueOf(nodframes.getAttributs().get("poids")));}catch (Exception e) { };
}
double pointsection = 0; double pointsectiontotal = 0 ; double poidssection = 0;
if(nodsections!=null) if(nodsections.isClose()) {
if(nodsections.getAttributs().get("pointgagner")!=null) pointsection = Double.valueOf(nodsections.getAttributs().get("pointgagner"));
if(nodsections.getAttributs().get("pointtotal")!=null) pointsectiontotal = Double.valueOf(nodsections.getAttributs().get("pointtotal"));
if(nodsections.getAttributs().get("poids")!=null) try{poidssection = Math.abs(Double.valueOf(nodsections.getAttributs().get("poids")));}catch (Exception e) { };
}
double pointtableau = 0; double pointtableautotal = 0 ; double poidstableau = 0;
if(nodtableaux!=null) if(nodtableaux.isClose()) {
if(nodtableaux.getAttributs().get("pointgagner")!=null) pointsection = Double.valueOf(nodtableaux.getAttributs().get("pointgagner"));
if(nodtableaux.getAttributs().get("pointtotal")!=null) pointsectiontotal = Double.valueOf(nodtableaux.getAttributs().get("pointtotal"));
if(nodtableaux.getAttributs().get("poids")!=null) try{poidssection = Math.abs(Double.valueOf(nodtableaux.getAttributs().get("poids")));}catch (Exception e) { };
}
double pointbiblio = 0; double pointbibliototal = 0 ; double poidsbiblio = 0;
if(nodbiblio!=null) if(nodbiblio.isClose()) {
if(nodbiblio.getAttributs().get("pointgagner")!=null) pointbiblio = Double.valueOf(nodbiblio.getAttributs().get("pointgagner"));
if(nodbiblio.getAttributs().get("pointtotal")!=null) pointbibliototal = Double.valueOf(nodbiblio.getAttributs().get("pointtotal"));
if(nodbiblio.getAttributs().get("poids")!=null) try{poidsbiblio = Math.abs(Double.valueOf(nodbiblio.getAttributs().get("poids")));}catch (Exception e) { };
}
double pointtablematieres = 0; double pointtablematierestotal = 0 ; double poidstablematieres = 0;
if(nodtablematieres!=null) if(nodtablematieres.isClose()) {
if(nodtablematieres.getAttributs().get("pointgagner")!=null) pointtablematieres = Double.valueOf(nodtablematieres.getAttributs().get("pointgagner"));
if(nodtablematieres.getAttributs().get("pointtotal")!=null) pointtablematierestotal = Double.valueOf(nodtablematieres.getAttributs().get("pointtotal"));
if(nodtablematieres.getAttributs().get("poids")!=null) try{poidstablematieres = Math.abs(Double.valueOf(nodtablematieres.getAttributs().get("poids")));}catch (Exception e) { };
}
double pointtableillustration = 0; double pointtableillustrationtotal = 0 ; double poidstableillustration = 0;
if(nodtableillustrations!=null) if(nodtableillustrations.isClose()) {
if(nodtableillustrations.getAttributs().get("pointgagner")!=null) pointtableillustration = Double.valueOf(nodtableillustrations.getAttributs().get("pointgagner"));
if(nodtableillustrations.getAttributs().get("pointtotal")!=null) pointtableillustrationtotal = Double.valueOf(nodtableillustrations.getAttributs().get("pointtotal"));
if(nodtableillustrations.getAttributs().get("poids")!=null) try{poidstableillustration = Math.abs(Double.valueOf(nodtableillustrations.getAttributs().get("poids")));}catch (Exception e) { };
}
double pointstructure = 0; double pointstructuretotal = 0 ; double poidsstructure = 0;
if(nodstructurepage!=null) if(nodstructurepage.isClose()) {
if(nodstructurepage.getAttributs().get("pointgagner")!=null) pointstructure = Double.valueOf(nodstructurepage.getAttributs().get("pointgagner"));
if(nodstructurepage.getAttributs().get("pointtotal")!=null) pointstructuretotal = Double.valueOf(nodstructurepage.getAttributs().get("pointtotal"));
if(nodstructurepage.getAttributs().get("poids")!=null) try{poidsstructure = Math.abs(Double.valueOf(nodstructurepage.getAttributs().get("poids")));}catch (Exception e) { };
}
double proportionCorrect = 0 ;
double poidsTotal = 0;
double pointsTotal = 0;
double pointgagner = 0;
double note = 0 ;
proportionCorrect = (poidsmeta*pointmeta + poidspage*pointpage + poidsparagraph*pointparagraph + poidssequence*pointsequence + poidsnumerotation*pointnumerotation + poidsframe*pointframe + poidsbiblio*pointbiblio + poidstablematieres*pointtablematieres + poidstableillustration*pointtableillustration + poidsstructure*pointstructure + poidssection*pointsection + poidstableau*pointtableau)
/ (poidsmeta*pointmetatotal + poidspage*pointpagetotal + poidsparagraph*pointparagraphtotal + poidssequence*pointsequencetotal + poidsnumerotation*pointnumerotationtotal + poidsframe*pointframetotal + poidsbiblio*pointbibliototal + poidstablematieres*pointtablematierestotal + poidstableillustration*pointtableillustrationtotal + poidsstructure*pointstructuretotal + poidssection*pointsectiontotal + poidstableau*pointtableautotal);
poidsTotal = poidsmeta + poidspage + poidsparagraph + poidssequence + poidsnumerotation + poidsframe + poidsbiblio + poidstablematieres + poidstableillustration + poidsstructure + poidssection + poidstableau;
pointsTotal = pointmetatotal + pointpagetotal + pointparagraphtotal + pointsequencetotal + pointnumerotationtotal + pointframetotal + pointbibliototal + pointtablematierestotal + pointtableillustrationtotal + pointstructuretotal + pointsectiontotal;
pointgagner = pointmeta + pointpage + pointparagraph + pointsequence + pointnumerotation + pointframe + pointsection + pointtableau + pointbiblio + pointtablematieres + pointtableillustration + pointstructure;
note = Math.pow(proportionCorrect, progression)*notefrom;
DecimalFormat df = new DecimalFormat("###.##");
nodbodyetnotation.getAttributs().put("proportioncorrect", df.format(proportionCorrect*100) + "%");
nodbodyetnotation.getAttributs().put("note", df.format(note));
nodbodyetnotation.getAttributs().put("pointstotal", String.valueOf(pointsTotal));
nodbodyetnotation.getAttributs().put("poidstotal", String.valueOf(poidsTotal));
nodbodyetnotation.getAttributs().put("pointgagner", String.valueOf(pointgagner));
if(Boolean.valueOf(erreurs.getAttributs().get("oneError"))) {
nodbodyetnotation.getAttributs().put("proportioncorrect", "0%");
nodbodyetnotation.getAttributs().put("note", "0.00");
proportionCorrect = 0.00;
}
// si bareme ABC (5 intervalles A, B, C, D, E de 20%)
if(baremeABC) {
double intervalle1 = Math.pow(0.2, 1/progression) ;
double intervalle2 = Math.pow(0.4, 1/progression) ;
double intervalle3 = Math.pow(0.6, 1/progression) ;
double intervalle4 = Math.pow(0.8, 1/progression) ;
nodbodyetnotation.getAttributs().put("BorneE", String.valueOf(intervalle1));
nodbodyetnotation.getAttributs().put("BorneD", String.valueOf(intervalle2));
nodbodyetnotation.getAttributs().put("BorneC", String.valueOf(intervalle3));
nodbodyetnotation.getAttributs().put("BorneB", String.valueOf(intervalle4));
nodbodyetnotation.getAttributs().put("BorneA", "1.00");
if(proportionCorrect<intervalle1) nodbodyetnotation.getAttributs().put("noteABC", "E");
if(proportionCorrect>=intervalle1 && proportionCorrect<intervalle2) nodbodyetnotation.getAttributs().put("noteABC", "D");
if(proportionCorrect>=intervalle2 && proportionCorrect<intervalle3) nodbodyetnotation.getAttributs().put("noteABC", "C");
if(proportionCorrect>=intervalle3 && proportionCorrect<intervalle4) nodbodyetnotation.getAttributs().put("noteABC", "B");
if(proportionCorrect>=intervalle4) nodbodyetnotation.getAttributs().put("noteABC", "A");
}
nodanalyse.ajouteEnfant(nodouverture);
nodanalyse.ajouteEnfant(nodbodyetnotation);
nodanalyse.ajouteEnfant(nodmenu);
nodanalyse.ajouteEnfant(erreurs);
if(ordre!=null) {
Enumeration<String> Key = Collections.enumeration(ordre);
while(Key.hasMoreElements()) {
String K = Key.nextElement();
if(K.equals("meta")) if(!nodmeta.isVide()) nodanalyse.ajouteEnfant(nodmeta);
if(K.equals("pages")) if(!nodpage.isVide()) nodanalyse.ajouteEnfant(nodpage);
if(K.equals("paragraphs")) if(!nodparagraph.isVide()) nodanalyse.ajouteEnfant(nodparagraph);
if(K.equals("sequences")) if(!nodsequence.isVide()) nodanalyse.ajouteEnfant(nodsequence);
if(K.equals("numerotationchapitre")) if(!nodnumerochapitre.isVide()) nodanalyse.ajouteEnfant(nodnumerochapitre);
if(K.equals("frames")) if(!nodframes.isVide()) nodanalyse.ajouteEnfant(nodframes);
if(K.equals("sections")) if(!nodsections.isVide()) nodanalyse.ajouteEnfant(nodsections);
if(K.equals("tableaux")) if(!nodtableaux.isVide()) nodanalyse.ajouteEnfant(nodtableaux);
if(K.equals("bibliographies")) if(!nodbiblio.isVide()) nodanalyse.ajouteEnfant(nodbiblio);
if(K.equals("tablematieres")) if(!nodtablematieres.isVide()) nodanalyse.ajouteEnfant(nodtablematieres);
if(K.equals("tableillustrations")) if(!nodtableillustrations.isVide()) nodanalyse.ajouteEnfant(nodtableillustrations);
if(K.equals("structurepage")) if(!nodstructurepage.isVide()) nodanalyse.ajouteEnfant(nodstructurepage);
}
}
node nodfermeturebodyHTML = new node();
nodfermeturebodyHTML.setNomElt("fermeture");
nodfermeturebodyHTML.setClose(true);
nodanalyse.getNodes().add(nodfermeturebodyHTML);
nodanalyse.setNomElt("analyse");
nodanalyse.setContenu(texteCommentaire);
nodanalyse.setClose(true);
return nodanalyse;
}
}