diff --git a/analyseWriter.jar b/analyseWriter.jar index 83fd4e0..179e731 100644 Binary files a/analyseWriter.jar and b/analyseWriter.jar differ diff --git a/bin/.gitignore b/bin/.gitignore deleted file mode 100644 index 16f90ab..0000000 --- a/bin/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/MEPTL/ diff --git a/bin/MEPTL/HTML.class b/bin/MEPTL/HTML.class index cdfabe5..9c12d1c 100644 Binary files a/bin/MEPTL/HTML.class and b/bin/MEPTL/HTML.class differ diff --git a/bin/MEPTL/analyseLesNodesEnfants.class b/bin/MEPTL/analyseLesNodesEnfants.class new file mode 100644 index 0000000..5b60a72 Binary files /dev/null and b/bin/MEPTL/analyseLesNodesEnfants.class differ diff --git a/bin/MEPTL/analyseLesNodesPrincipaux.class b/bin/MEPTL/analyseLesNodesPrincipaux.class new file mode 100644 index 0000000..81649a5 Binary files /dev/null and b/bin/MEPTL/analyseLesNodesPrincipaux.class differ diff --git a/bin/MEPTL/commandes.class b/bin/MEPTL/commandes.class index fae2088..b493c8d 100644 Binary files a/bin/MEPTL/commandes.class and b/bin/MEPTL/commandes.class differ diff --git a/bin/MEPTL/feedbacks.class b/bin/MEPTL/feedbacks.class new file mode 100644 index 0000000..2168b9e Binary files /dev/null and b/bin/MEPTL/feedbacks.class differ diff --git a/bin/MEPTL/meptl.class b/bin/MEPTL/meptl.class index c7b5cc6..351fc91 100644 Binary files a/bin/MEPTL/meptl.class and b/bin/MEPTL/meptl.class differ diff --git a/bin/MEPTL/rechercherUnNodeStudent.class b/bin/MEPTL/rechercherUnNodeStudent.class new file mode 100644 index 0000000..8b4c5f5 Binary files /dev/null and b/bin/MEPTL/rechercherUnNodeStudent.class differ diff --git a/bin/MEPTL/verificationFichierAnalyse.class b/bin/MEPTL/verificationFichierAnalyse.class index 27649be..da16265 100644 Binary files a/bin/MEPTL/verificationFichierAnalyse.class and b/bin/MEPTL/verificationFichierAnalyse.class differ diff --git a/documentation analyseWriter.pdf b/documentation analyseWriter.pdf index c83712a..6ab34c2 100644 Binary files a/documentation analyseWriter.pdf and b/documentation analyseWriter.pdf differ diff --git a/src/MEPTL/HTML.java b/src/MEPTL/HTML.java index db205bf..7d6f713 100644 --- a/src/MEPTL/HTML.java +++ b/src/MEPTL/HTML.java @@ -1,15 +1,14 @@ package MEPTL; -import java.text.DateFormat; import java.text.DecimalFormat; import java.util.ArrayList; -import java.util.Date; + import cXML.node; /** * - * @author pablo rodriguez - 2000 + * @author pablo rodriguez * */ public class HTML { @@ -221,14 +220,10 @@ public class HTML { public static String Table(node nod) { String code = HTML.SautLigne(); - if(nod.getAttributs().get("titre")!=null) if(!nod.getAttributs().get("titre").isEmpty()) { - code = code + HTML.H1(nod.getAttributs().get("titre"),nod.getAttributs().get("id"))+ HTML.SautLigne() ; - }else { - code = code + HTML.H1("",nod.getAttributs().get("id"))+ HTML.SautLigne() ; - } + code = addSautEtTitres(code,nod); //ajoute le commentaire - if(!nod.getContenu().isEmpty()) if(nod.getNodes().size()==1) code = code + HTML.Paragraph_classp6(nod.getContenu().get(0)) + HTML.SautLigne(); + if(!nod.getContenu().isEmpty()) if(nod.getNodes().size()>0) code = code + HTML.Paragraph_classp6(nod.getContenu().get(0)) + HTML.SautLigne(); code = code + HTML.TableEntete(); //ajoute l'entête @@ -248,25 +243,16 @@ public class HTML { code = code + HTML.Table(Tst, Key, valueStudent, valueSujet, niveau); }else { + + code = addSautEtTitres(code,nod.getNodes().get(k)); + - if(nod.getNodes().get(k).getAttributs().get("titre")!=null) if(!nod.getNodes().get(k).getAttributs().get("titre").isEmpty()){ - code = code + HTML.SautLigne() + HTML.H2(nod.getNodes().get(k).getAttributs().get("titre")) - + HTML.SautLigne(); - }else { - code = code + HTML.SautLigne(); - } - - - if(nod.getNodes().get(k).getAttributs().get("saut")!=null) if(nod.getNodes().get(k).getAttributs().get("saut").equals("true")) { - code = code + HTML.SautLigne(); - } - if(!nod.getContenu().isEmpty()) code = code + HTML.Paragraph_classp6(nod.getContenu().get(0)) + HTML.SautLigne(); for(int l = 0 ; l < nod.getNodes().get(k).getNodes().size() ; l++) { if(!nod.getNodes().get(k).getNodes().get(l).getNomElt().equals("saut")){ String Tst = nod.getNodes().get(k).getNodes().get(l).getAttributs().get("resultat"); - // String Key = outils.Traduction(nod.getNodes().get(k).getNodes().get(l).getAttributs().get("elt") + " " + outils.withoutCodeAndPoint(nod.getNodes().get(k).getNodes().get(l).getAttributs().get("attribut"))); + String Key2 = outils.traduction.get(nod.getNodes().get(k).getNodes().get(l).getAttributs().get("elt") + " " + outils.withoutCodeAndPoint(nod.getNodes().get(k).getNodes().get(l).getAttributs().get("attribut"))); if(Key2==null) Key2 = nod.getNodes().get(k).getNodes().get(l).getAttributs().get("elt") + " " + outils.withoutCodeAndPoint(nod.getNodes().get(k).getNodes().get(l).getAttributs().get("attribut")); String valueStudent = nod.getNodes().get(k).getNodes().get(l).getAttributs().get("valueStudent"); @@ -275,9 +261,7 @@ public class HTML { code = code + HTML.Table(Tst, Key2, valueStudent, valueSujet, niveau); }else { - if(nod.getNodes().get(k).getNodes().get(l).getAttributs().get("titre")!=null) code = code + HTML.SautLigneOnduleBleu(nod.getNodes().get(k).getNodes().get(l).getAttributs().get("titre")); - if(nod.getNodes().get(k).getNodes().get(l).getAttributs().get("titre1")!=null) code = code + HTML.SautLigneOnduleBleu(nod.getNodes().get(k).getNodes().get(l).getAttributs().get("titre1")); - if(nod.getNodes().get(k).getNodes().get(l).getAttributs().get("titre2")!=null) code = code + HTML.SautP8(nod.getNodes().get(k).getNodes().get(l).getAttributs().get("titre2")); + code = addSautEtTitres(code,nod.getNodes().get(k).getNodes().get(l)); } } @@ -292,6 +276,27 @@ public class HTML { } + private static String addSautEtTitres(String code, node nodeAna) { + if(nodeAna.getNomElt().equals("saut")) { + code = code + HTML.SautLigne(); + } + if(nodeAna.getAttributs().get("titre")!=null) if(!nodeAna.getAttributs().get("titre").isEmpty()){ + if(nodeAna.getAttributs().get("id")!=null) code = code + HTML.SautLigne()+ HTML.H1(nodeAna.getAttributs().get("titre"),nodeAna.getAttributs().get("id")) + HTML.SautLigne(); ; + if(nodeAna.getAttributs().get("id")==null) code = code + HTML.SautLigne()+ HTML.H1(nodeAna.getAttributs().get("titre")) + HTML.SautLigne(); ; + } + if(nodeAna.getAttributs().get("titre1")!=null) if(!nodeAna.getAttributs().get("titre1").isEmpty()){ + code = code + HTML.SautLigne() + HTML.H2(nodeAna.getAttributs().get("titre1")) + HTML.SautLigne(); ; + } + if(nodeAna.getAttributs().get("titre2")!=null) if(!nodeAna.getAttributs().get("titre2").isEmpty()){ + code = code + HTML.SautLigne() + HTML.SautLigneOnduleBleu(nodeAna.getAttributs().get("titre2")) + HTML.SautLigne(); ; + } + if(nodeAna.getAttributs().get("titre3")!=null) if(!nodeAna.getAttributs().get("titre3").isEmpty()){ + code = code + HTML.SautLigne() + HTML.SautP8(nodeAna.getAttributs().get("titre3")) + HTML.SautLigne(); ; + } + return code; + } + + // Table correct pour application des styles public static String TableApplStyle(String NomStyle,ArrayList T, ArrayList S, boolean erreur) { @@ -411,7 +416,10 @@ public class HTML { ""; } - // image de la progression + /** + * Image SVG de la progression + * @return + */ public static String imgProgression() { return "\r\n" + ""; } - + + /** + * Image SVG de la note A. + * @return + */ public static String NoteA( ) { return "\r\n" + "\r\n" @@ -2838,6 +2850,10 @@ public class HTML { + "\r\n"; } + /** + * Image SVG de la note B + * @return + */ public static String NoteB() { return "\r\n" + "\r\n" @@ -3164,6 +3180,10 @@ public class HTML { + "\r\n"; } + /** + * Image SVG de la note C + * @return + */ public static String NoteC() { return "\r\n" + "\r\n" @@ -5406,6 +5426,10 @@ public class HTML { + "\r\n"; } + /** + * Image SVG de la note D + * @return + */ public static String NoteD() { return "\r\n" + "\r\n" @@ -5520,6 +5544,10 @@ public class HTML { + ""; } + /** + * Image SVG de la note E + * @return + */ public static String NoteE() { return "\r\n" + "\r\n" @@ -5610,7 +5638,10 @@ public class HTML { + ""; } - // image du bouton interrogation + /** + * Image SVG Interoorgation + * @return + */ public static String imgInterogation() { return "\r" - + "\r" - + "\r" - + "\r" - + "Analyse mise en page d'un texte long\r" - - + "" - + "" - + "" - + "" - + "" - - +"" - - +"\r"; + + ".footer {position: fixed;left: 0;bottom: 0;width: 100%;background-color: white;color: black;text-align: center;}" + +"\r\r"; } - - /** - * Retourne l'ouverture de la balise body - * @return - */ - public static String getHTMLdebutBody(double note, String noteFrom, String NumSujet, String dossier, double proportioncorrect, String progression) { - DecimalFormat df1 = new DecimalFormat("##.##"); - Date aujourdhui = new Date(); - DateFormat mediumDateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM,DateFormat.MEDIUM); - - return "\r" - +"
" - +"

\r\n" + - "Feedback - Analyse LibreOffice Writer
"+HTML.imgLogos()+"

\r" - +"

" + df1.format(note) + " / " + noteFrom +"
Sujet "+ NumSujet +"

\r" - +"

Date d'analyse : "+ mediumDateFormat.format(aujourdhui) + "
" - +"
Dossier étudiant : "+ dossier + "Dossier téléchargé depuis la plateforme Moodle.

" - +"Analyse MEPTL : sujet "+ NumSujet + "
\r" - +"Méthode :
Progression " + progression + "Explication
"+ HTML.imgProgression() +"
- Proportion correcte du fichier analysé : " + Math.floor(proportioncorrect*10000)/100 + "%
" - +"
Auteur : P. Rodriguez - Licence GPL v3.0 - Avril 2020

" - +"
"; - } - /** - * Retourne la fermeture de la balise body et html - * @return - */ - public static String getHTMLfinBodyHTML() { - return "\r"; - } /** * Retourne le code HTML du menu @@ -5784,7 +5796,7 @@ public class HTML { String codeHTMLMenu= "
Note"; for(int i =0 ; i < items.size(); i++) { - codeHTMLMenu = codeHTMLMenu + "" + items.get(i).getAttributs().get("titre") + ""; + codeHTMLMenu = codeHTMLMenu + "" + items.get(i).getAttributs().get("titre") + ""; } codeHTMLMenu = codeHTMLMenu + "
"; diff --git a/src/MEPTL/analyseLesNodesEnfants.java b/src/MEPTL/analyseLesNodesEnfants.java index 41d86df..59ab331 100644 --- a/src/MEPTL/analyseLesNodesEnfants.java +++ b/src/MEPTL/analyseLesNodesEnfants.java @@ -28,10 +28,16 @@ public class analyseLesNodesEnfants { nodEnfantSujet = nodSujet.getNodes().get(j); String nameNode = nodEnfantSujet.getNomElt(); + + //***************************** + //** Ajoute un saut de ligne ** + //***************************** + PourAnalyse = meptl.addSaut(nodEnfantSujet, PourAnalyse); + //******************************** //** Ajoute des sauts et titres ** //******************************** - PourAnalyse = meptl.addNodeSautTitre(nodEnfantSujet, PourAnalyse); // ajoute des saut de page s'il y a des sauts avec des titres + PourAnalyse = meptl.addNodeSautTitre(nodEnfantSujet, PourAnalyse); //*************************************************** //** Recherche le node correspondant de l'étudiant ** @@ -55,7 +61,7 @@ public class analyseLesNodesEnfants { //************************************************************** //** Analyse attribut et contenu du node enfant de l'étudiant ** //************************************************************** - PourAnalyse = meptl.analyseLesAttributEtContenuDuNode(nodStudentCorrespondantAuNodSujet, nodEnfantSujet, PourAnalyse, nomDuNodePourAnalyse,nameNode); + PourAnalyse = meptl.evalLesAttributEtContenuDuNode(nodStudentCorrespondantAuNodSujet, nodEnfantSujet, PourAnalyse, nomDuNodePourAnalyse,nameNode); //******************************* //** méthode analyseStyle=true ** @@ -114,10 +120,21 @@ public class analyseLesNodesEnfants { //ajoute les valeurs par défaut. if(StyleParagraphStudent!=null) StyleParagraphStudent = meptl.ajouteValeurParDefautAuStyleParagraph(nodStudentParagraphs , StyleParagraphStudent); + //***************************** + //** Ajoute un saut de ligne ** + //***************************** + PourAnalyse = meptl.addSaut(StyleParagraphSujet, PourAnalyse); + + //******************************** + //** Ajoute des sauts et titres ** + //******************************** + PourAnalyse = meptl.addNodeSautTitre(StyleParagraphSujet, PourAnalyse); + + //************************************************************** //** Analyse attribut et contenu du node enfant de l'étudiant ** //************************************************************** - PourAnalyse = meptl.analyseLesAttributAnalyseStyle(StyleParagraphStudent, StyleParagraphSujet, PourAnalyse, nomDuNodePourAnalyse,"style:style"); + PourAnalyse = meptl.evalLesAttributAnalyseStyle(StyleParagraphStudent, StyleParagraphSujet, PourAnalyse, nomDuNodePourAnalyse,"style:style"); } } diff --git a/src/MEPTL/analyseLesNodesPrincipaux.java b/src/MEPTL/analyseLesNodesPrincipaux.java index 36ea618..5e5290f 100644 --- a/src/MEPTL/analyseLesNodesPrincipaux.java +++ b/src/MEPTL/analyseLesNodesPrincipaux.java @@ -47,35 +47,41 @@ public class analyseLesNodesPrincipaux { biblio.setNomElt("biblio"); biblio.getAttributs().put("namebiblio", nomDeLaBiblio); - if(nodSujetBibio.getAttributs().get("titre")!=null) { - biblio.getAttributs().put("titre", nodSujetBibio.getAttributs().get("titre")); - } + //***************************** + //** Ajoute un saut de ligne ** + //***************************** + biblio = meptl.addSaut(nodSujetBibio,biblio); + + //********************* + //** Ajoute un titre ** + //********************* + biblio = meptl.addNodeSautTitre(nodSujetBibio,biblio); + String TitreTable = outils.withoutCodeAndPoint(nodSujetBibio.retourneFirstEnfantsByName("text:index-title").retourneLesContenusEnfants("")); - node nodSujet = a.retourneFirstNodeParagrapheContain(a.retourneNames(nodSujetBiblio, "text:index-body"), TitreTable); node nodStudent = a.retourneFirstNodeParagrapheContain(a.retourneNames(nodStudentBiblio, "text:index-body"), TitreTable); - biblio = meptl.analyseLesAttributEtContenuDuNode(nodStudent, nodSujet, biblio, "ana:biblio", nodSujet.getNomElt()); + biblio = meptl.evalLesAttributEtContenuDuNode(nodStudent, nodSujet, biblio, "ana:biblio", nodSujet.getNomElt()); for(int j =0 ; j < nodSujet.getNodes().size();j++) { if(nodStudent!=null) { if(j ** //******************************************** - numerotation = meptl.analyseLesAttributEtContenuDuNode(numerotationStudent, numerotationSujet, numerotation, "ana:numerotation",numerotationSujet.getNomElt()); + numerotation = meptl.evalLesAttributEtContenuDuNode(numerotationStudent, numerotationSujet, numerotation, "ana:numerotation",numerotationSujet.getNomElt()); //************************************ //** analyse tous les nodes enfants ** @@ -209,6 +229,11 @@ public class analyseLesNodesPrincipaux { frame.setNomElt("frame"); frame.getAttributs().put("nameframe", nomDuFrame); + //***************************** + //** Ajoute un saut de ligne ** + //***************************** + frame = meptl.addSaut(frameSujet,frame); + //********************* //** Ajoute un titre ** //********************* @@ -222,7 +247,7 @@ public class analyseLesNodesPrincipaux { //******************************************** //** analyse les attributs des nodes ** //******************************************** - frame = meptl.analyseLesAttributEtContenuDuNode(frameStudent, frameSujet, frame, "ana:frame",frameSujet.getNomElt()); + frame = meptl.evalLesAttributEtContenuDuNode(frameStudent, frameSujet, frame, "ana:frame",frameSujet.getNomElt()); //************************************ //** analyse tous les nodes enfants ** @@ -282,6 +307,11 @@ public class analyseLesNodesPrincipaux { node nodSujet = sujet.get(i); String namenode = nodSujet.getNomElt(); + //***************************** + //** Ajoute un saut de ligne ** + //***************************** + nodmeta = meptl.addSaut(nodSujet,nodmeta); + //********************* //** Ajoute un titre ** //********************* @@ -299,7 +329,7 @@ public class analyseLesNodesPrincipaux { //** Recherche le node Student ** //******************************* node nodStudent = a.retourneFirstNodeByNameAttributContainsValueNetTexte(nodStudentMeta, namenode,k,outils.withoutCodeAndPointPourRechercheContenuExact(valueOfAttribut)); - nodmeta = meptl.analyseLesAttributEtContenuDuNode(nodStudent, nodSujet, nodmeta, "ana:meta", namenode); + nodmeta = meptl.evalLesAttributEtContenuDuNode(nodStudent, nodSujet, nodmeta, "ana:meta", namenode); } } }else { @@ -310,12 +340,12 @@ public class analyseLesNodesPrincipaux { if(NStudent!=null) { if(!NStudent.isEmpty()) { - nodmeta = meptl.analyseLesAttributEtContenuDuNode(NStudent.get(0), sujet.get(i), nodmeta, "ana:meta", namenode); + nodmeta = meptl.evalLesAttributEtContenuDuNode(NStudent.get(0), sujet.get(i), nodmeta, "ana:meta", namenode); }else { - nodmeta = meptl.analyseLesAttributEtContenuDuNode(null, sujet.get(i), nodmeta, "ana:meta", namenode); + nodmeta = meptl.evalLesAttributEtContenuDuNode(null, sujet.get(i), nodmeta, "ana:meta", namenode); } }else { - nodmeta = meptl.analyseLesAttributEtContenuDuNode(null, sujet.get(i), nodmeta, "ana:meta", namenode); + nodmeta = meptl.evalLesAttributEtContenuDuNode(null, sujet.get(i), nodmeta, "ana:meta", namenode); } } @@ -361,7 +391,7 @@ public class analyseLesNodesPrincipaux { //******************************************************* //** Parcours les nodes enfants du node ** //******************************************************* - for(int i = 0 ; i < nodSujetSections.getNodes().size(); i++) { //niveau 1 + for(int i = 0 ; i < nodSujetSections.getNodes().size(); i++) { if(nodSujetSections.getNodes().get(i).getNomElt().equals("text:section")) { node sectionSujet = nodSujetSections.getNodes().get(i); int pointDebut = outils.getPointsClass(); @@ -372,6 +402,11 @@ public class analyseLesNodesPrincipaux { section.setNomElt("section"); section.getAttributs().put("namesection", nomDeLaSection); + //***************************** + //** Ajoute un saut de ligne ** + //***************************** + section = meptl.addSaut(sectionSujet,section); + //********************* //** Ajoute un titre ** //********************* @@ -385,7 +420,7 @@ public class analyseLesNodesPrincipaux { //*********************************************** //** analyse les attributs des nodes
** //*********************************************** - section = meptl.analyseLesAttributEtContenuDuNode(sectionStudent, sectionSujet, section, "ana:section",sectionSujet.getNomElt()); + section = meptl.evalLesAttributEtContenuDuNode(sectionStudent, sectionSujet, section, "ana:section",sectionSujet.getNomElt()); //************************************ //** analyse tous les nodes enfants ** @@ -493,7 +528,7 @@ public class analyseLesNodesPrincipaux { node nodseq = new node(); nodseq.setNomElt("sequences"); nodseq.setAttributs(nodSujetSequence.getAttributs()); - nodseq.setContenu(nodSujetSequence.getContenu()); //ajoute le commantire + nodseq.setContenu(nodSujetSequence.getContenu()); //ajoute le commentaire //*************************************** //** Ajoute l'identifiant pour le menu ** @@ -520,6 +555,11 @@ public class analyseLesNodesPrincipaux { seq.setNomElt("sequence"); seq.getAttributs().put("name", nomSequence); + //***************************** + //** Ajoute un saut de ligne ** + //***************************** + seq = meptl.addSaut(seqSujet,seq); + //********************* //** Ajoute un titre ** //********************* @@ -538,7 +578,7 @@ public class analyseLesNodesPrincipaux { //*********************************************** //** analyse les attributs des nodes
** //*********************************************** - seq = meptl.analyseLesAttributEtContenuDuNode(seqStudent, seqSujet, seq, "ana:seq",seqSujet.getNomElt()); + seq = meptl.evalLesAttributEtContenuDuNode(seqStudent, seqSujet, seq, "ana:seq",seqSujet.getNomElt()); //**************************************************************** //** Insère les attributs des points dans les node de l'analyse ** @@ -588,7 +628,7 @@ public class analyseLesNodesPrincipaux { //****************************************************** //** Parcours les nodes enfants du node ** //****************************************************** - for(int i = 0 ; i < nodSujetTableaux.getNodes().size(); i++) { //niveau 1 + for(int i = 0 ; i < nodSujetTableaux.getNodes().size(); i++) { if(nodSujetTableaux.getNodes().get(i).getNomElt().equals("table:table")) { int pointDebut = outils.getPointsClass(); int pointTotalDebut = outils.getPointTotal(); @@ -599,6 +639,11 @@ public class analyseLesNodesPrincipaux { tableau.setNomElt("tableau"); tableau.getAttributs().put("nametableau", nomDeLaTable); + //***************************** + //** Ajoute un saut de ligne ** + //***************************** + tableau = meptl.addSaut(tableSujet,tableau); + //********************* //** Ajoute un titre ** //********************* @@ -612,7 +657,7 @@ public class analyseLesNodesPrincipaux { //*************************************************** //** analyse les attributs des nodes ** //*************************************************** - tableau = meptl.analyseLesAttributEtContenuDuNode(tableauStudent, tableSujet, tableau, "ana:tableau",tableSujet.getNomElt()); + tableau = meptl.evalLesAttributEtContenuDuNode(tableauStudent, tableSujet, tableau, "ana:tableau",tableSujet.getNomElt()); //************************************ //** analyse tous les nodes enfants ** @@ -713,72 +758,88 @@ public class analyseLesNodesPrincipaux { nodTablesMs.setAttributs(nodSujetTableI.getAttributs());//ajoute tous les attributs du sujet nodTablesMs.setContenu(nodSujetTableI.getContenu());//ajoute le commentaire du sujet - //ajoute l'identifiant pour le menu + //*************************************** + //** Ajoute l'identifiant pour le menu ** + //*************************************** if(a.retourneFirstNodeByNameAttributValue(nodmenu, "item", "name", "tableillustrations")!=null) { nodTablesMs.getAttributs().put("id", a.retourneFirstNodeByNameAttributValue(nodmenu, "item", "name", "tableillustrations").getAttributs().get("id")); } - //initialise les points + //*************************** + //** initialise les points ** + //*************************** outils.initiliseLesPoints(); for(int i = 0 ; i < nodSujetTableI.getNodes().size(); i++) { if(nodSujetTableI.getNodes().get(i).getNomElt().equals("text:illustration-index")) { + int pointDebut = outils.getPointsClass(); + int pointTotalDebut = outils.getPointTotal(); node table = new node(); table.setNomElt("tableillustrations"); + String TitreTable = outils.withoutCodeAndPoint(nodSujetTableI.getNodes().get(i).retourneFirstEnfantsByName("text:index-title").retourneLesContenusEnfants("")); + node nodSujet = a.retourneFirstNodeParagrapheContain(a.retourneNames(nodSujetTableI, "text:index-body"), TitreTable); + + //***************************** + //** Ajoute un saut de ligne ** + //***************************** + table = meptl.addSaut(nodSujet,table); //********************* //** Ajoute un titre ** //********************* - if(nodSujetTableI.getNodes().get(i).getAttributs().get("titre")!=null) { - String titre = nodSujetTableI.getNodes().get(i).getAttributs().get("titre"); - if(!titre.isEmpty()) table.getAttributs().put("titre", titre); - } + table = meptl.addNodeSautTitre(nodSujet,table); - - int pointDebut = outils.getPointsClass(); - int pointTotalDebut = outils.getPointTotal(); - String TitreTable = outils.withoutCodeAndPoint(nodSujetTableI.getNodes().get(i).retourneFirstEnfantsByName("text:index-title").retourneLesContenusEnfants("")); - - node nodSujet = a.retourneFirstNodeParagrapheContain(a.retourneNames(nodSujetTableI, "text:index-body"), TitreTable); + //******************************* + //** Recherche le node Student ** + //******************************* node nodStudent = a.retourneFirstNodeParagrapheContain(a.retourneNames(nodStudentTableI, "text:index-body"), TitreTable); - table = meptl.analyseLesAttributEtContenuDuNode(nodStudent, nodSujet, table, "ana:tableillustration", nodSujet.getNomElt()); + //********************************************* + //** analyse les attributs des nodes ** + //********************************************* + table = meptl.evalLesAttributEtContenuDuNode(nodStudent, nodSujet, table, "ana:tableillustration", nodSujet.getNomElt()); + //**************************************************************** + //** Parcours les nodes enfants du node ** + //**************************************************************** for(int j =0 ; j < nodSujet.getNodes().size();j++) { if(nodStudent!=null) { if(j ** + //********************************************* + table = meptl.evalLesAttributEtContenuDuNode(nodStudent, nodSujet, table, "ana:tablematiere", nodSujet.getNomElt()); + + //**************************************************************** + //** Parcours les nodes enfants du node ** + //**************************************************************** for(int j =0 ; j < nodSujet.getNodes().size();j++) { if(nodStudent!=null) { if(j ** //******************************************** - page = meptl.analyseLesAttributEtContenuDuNode(pageStudent, pageSujet, page, "ana:page",pageSujet.getNomElt()); + page = meptl.evalLesAttributEtContenuDuNode(pageStudent, pageSujet, page, "ana:page",pageSujet.getNomElt()); //********************************************** //** Analyse de tous les autres nodes enfants ** @@ -980,87 +1065,106 @@ public class analyseLesNodesPrincipaux { paragraph.setNomElt("paragraph"); paragraph.getAttributs().put("name", nomDuParagraph); + //***************************** + //** Ajoute un saut de ligne ** + //***************************** + paragraph = meptl.addSaut(paragraphSujet,paragraph); + //********************* //** Ajoute un titre ** //********************* - if(paragraphSujet.getAttributs().get("titre")!=null) { - paragraph.getAttributs().put("titre", nodSujetParagraph.getNodes().get(i).getAttributs().get("titre")); - } + paragraph = meptl.addNodeSautTitre(paragraphSujet,paragraph); //******************************* //** Recherche le node Student ** //******************************* node paragraphStudent = a.retourneFirstNodeByNameAttributValue(nodStudentParagraph, "style:style", "style:name", nomDuParagraph); - // ajoute les valeurs par héritage + //************************************************************** + //** Ajoute les valeurs par héritage au node paragraphStudent ** + //************************************************************** if(paragraphStudent!=null) paragraphStudent = meptl.ajouteValeurLesValeursDuStyleParagraphParent(nodStudentParagraph, paragraphStudent); - // ajoute les valeurs par défauts + //************************************************************ + //** Ajoute les valeurs par défaut au node paragraphStudent ** + //************************************************************ if(paragraphStudent!=null) paragraphStudent = meptl.ajouteValeurParDefautAuStyleParagraph(nodStudentParagraph, paragraphStudent); - // analyse les attributs du node - paragraph = meptl.analyseLesAttributEtContenuDuNode(paragraphStudent, paragraphSujet, paragraph, "ana:paragraph",paragraphSujet.getNomElt()); + //************************************************* + //** analyse les attributs des nodes ** + //************************************************* + paragraph = meptl.evalLesAttributEtContenuDuNode(paragraphStudent, paragraphSujet, paragraph, "ana:paragraph",paragraphSujet.getNomElt()); - // les enfants du premier niveau du node - for(int j = 0 ; j < paragraphSujet.getNodes().size();j++ ) { - - node nodSujet = paragraphSujet.getNodes().get(j); - String nameNode = nodSujet.getNomElt(); - node nodStudent = null; - if(paragraphStudent!=null) { - if(paragraphStudent.retourneFirstEnfantsByName(nameNode).getNomElt().equals(nameNode)) { - nodStudent = paragraphStudent.retourneFirstEnfantsByName(nameNode); - } - } + //************************************ + //** analyse tous les nodes enfants ** + //************************************ + paragraph = analyseLesNodesEnfants.nodeNext(paragraph, "ana:paragraph", paragraphStudent, null, null, paragraphSujet, null, null, a); + - //insère un saut si titre pas vide et saut=true - paragraph = meptl.addNodeSautTitre(nodSujet, paragraph); - // analyse attribut et contenu des enfants du premier niveau - paragraph = meptl.analyseLesAttributEtContenuDuNode(nodStudent, nodSujet, paragraph, "ana:paragraph",nodSujet.getNomElt()); +// // les enfants du premier niveau du node +// for(int j = 0 ; j < paragraphSujet.getNodes().size();j++ ) { +// +// node nodSujet = paragraphSujet.getNodes().get(j); +// String nameNode = nodSujet.getNomElt(); +// node nodStudent = null; +// if(paragraphStudent!=null) { +// if(paragraphStudent.retourneFirstEnfantsByName(nameNode).getNomElt().equals(nameNode)) { +// nodStudent = paragraphStudent.retourneFirstEnfantsByName(nameNode); +// } +// } +// +// //insère un saut si titre pas vide et saut=true +// paragraph = meptl.addNodeSautTitre(nodSujet, paragraph); +// +// // analyse attribut et contenu des enfants du premier niveau +// paragraph = meptl.evalLesAttributEtContenuDuNode(nodStudent, nodSujet, paragraph, "ana:paragraph",nodSujet.getNomElt()); +// +// +// for(int k = 0 ; k < nodSujet.getNodes().size();k++) { +// node nod2Sujet = nodSujet.getNodes().get(k); +// String nameNode2 = nod2Sujet.getNomElt(); +// node nod2Student = null; +// if(nodStudent!=null) if(nodStudent.retourneFirstEnfantsByName(nameNode2).getNomElt().equals(nameNode2)) { +// nod2Student = paragraphStudent.retourneFirstEnfantsByName(nameNode2); +// } +// +// //insère un saut si titre pas vide et saut=true +// paragraph = meptl.addNodeSautTitre(nod2Sujet, paragraph); +// +// // analyse attribut et contenu des enfants du second niveau +// paragraph = meptl.evalLesAttributEtContenuDuNode(nod2Student, nod2Sujet, paragraph, "ana:paragraph",nod2Sujet.getNomElt() ); +// +// for(int l = 0 ; l < nod2Sujet.getNodes().size();l++) { +// node nod3Sujet = nod2Sujet.getNodes().get(l); +// String nameNode3 = nod3Sujet.getNomElt(); +// node nod3Student = null; +// if(nod2Student!=null) if(nod2Student.retourneFirstEnfantsByName(nameNode3).getNomElt().equals(nameNode3)) { +// nod3Student = paragraphStudent.retourneFirstEnfantsByName(nameNode3); +// } +// +// //insère un saut si titre pas vide et saut=true +// paragraph = meptl.addNodeSautTitre(nod3Sujet, paragraph); +// +// // analyse attribut et contenu des enfants du troisième niveau +// paragraph = meptl.evalLesAttributEtContenuDuNode(nod3Student, nod3Sujet, paragraph, "ana:paragraph", nod3Sujet.getNomElt()); +// } +// +// } +// +// } - - for(int k = 0 ; k < nodSujet.getNodes().size();k++) { - node nod2Sujet = nodSujet.getNodes().get(k); - String nameNode2 = nod2Sujet.getNomElt(); - node nod2Student = null; - if(nodStudent!=null) if(nodStudent.retourneFirstEnfantsByName(nameNode2).getNomElt().equals(nameNode2)) { - nod2Student = paragraphStudent.retourneFirstEnfantsByName(nameNode2); - } - - //insère un saut si titre pas vide et saut=true - paragraph = meptl.addNodeSautTitre(nod2Sujet, paragraph); - - // analyse attribut et contenu des enfants du second niveau - paragraph = meptl.analyseLesAttributEtContenuDuNode(nod2Student, nod2Sujet, paragraph, "ana:paragraph",nod2Sujet.getNomElt() ); - - for(int l = 0 ; l < nod2Sujet.getNodes().size();l++) { - node nod3Sujet = nod2Sujet.getNodes().get(l); - String nameNode3 = nod3Sujet.getNomElt(); - node nod3Student = null; - if(nod2Student!=null) if(nod2Student.retourneFirstEnfantsByName(nameNode3).getNomElt().equals(nameNode3)) { - nod3Student = paragraphStudent.retourneFirstEnfantsByName(nameNode3); - } - - //insère un saut si titre pas vide et saut=true - paragraph = meptl.addNodeSautTitre(nod3Sujet, paragraph); - - // analyse attribut et contenu des enfants du troisième niveau - paragraph = meptl.analyseLesAttributEtContenuDuNode(nod3Student, nod3Sujet, paragraph, "ana:paragraph", nod3Sujet.getNomElt()); - } - - } - - } - + //**************************************************************** + //** Insère les attributs des points dans les node de l'analyse ** + //**************************************************************** paragraph.getAttributs().put("point", String.valueOf(outils.getPointsClass()-pointDebut)); paragraph.getAttributs().put("pointTotal", String.valueOf(outils.getPointTotal()-pointTotalDebut)); nodparagraphs.getNodes().add(paragraph); - - } } - + //**************************************************************** + //** Insère les attributs des points dans les node de l'analyse ** + //**************************************************************** nodparagraphs.getAttributs().put("pointgagner",String.valueOf(outils.getPointsClass())); nodparagraphs.getAttributs().put("pointtotal",String.valueOf(outils.getPointTotal())); nodparagraphs.getAttributs().put("proportioncorrect",String.valueOf(outils.getProportionCorrect())); @@ -1072,7 +1176,7 @@ public class analyseLesNodesPrincipaux { * Cette méthode permet d'analyse la structure du document.
* La structure de l'étudiant est comparé avec la structure du sujet.
* Le node d'analyse est retourné.
- * Le nom du node analysé pour cette partie est puis .
+ * Le nom du node analysé pour cette partie est page puis ana:page.
*
* @param nodStudentS : node de la structure de l'étudiant. * @param nodSujetS : node de la structure du sujet. @@ -1117,6 +1221,11 @@ public class analyseLesNodesPrincipaux { page.getAttributs().put("namepage", nomDeLaPage); page.getAttributs().put("numeroabsolue", numeroabsolue); + //***************************** + //** Ajoute un saut de ligne ** + //***************************** + page = meptl.addSaut(pageSujet,page); + //********************* //** Ajoute un titre ** //********************* @@ -1130,7 +1239,7 @@ public class analyseLesNodesPrincipaux { //******************************************** //** analyse les attributs des nodes ** //******************************************** - page = meptl.analyseLesAttributEtContenuDuNode(pageStudent, pageSujet, page, "ana:page",pageSujet.getNomElt()); + page = meptl.evalLesAttributEtContenuDuNode(pageStudent, pageSujet, page, "ana:page",pageSujet.getNomElt()); //************************************ //** analyse tous les nodes enfants ** diff --git a/src/MEPTL/commandes.java b/src/MEPTL/commandes.java index 65aac77..d88b94d 100644 --- a/src/MEPTL/commandes.java +++ b/src/MEPTL/commandes.java @@ -24,6 +24,7 @@ public class commandes { public static boolean analyse = false; //analyse des fichiers étudiants public static boolean ecritCode = false; // -write : ecriture du code du sujet public static boolean ecritSujet = false; // -sujet : ecriture 2 du code du sujet, uniquement les nodes évalués + public static boolean ecritNodeAnalyse = false; public static boolean ecritNoteCSV = false; // ecriture note.csv public static boolean writefiles = false; // -writefiles permet d'écrire tous les fichiers XML après la lecture en node public static boolean calculLeHashDuFichier = false; // -hash retourne le hash du fichier d'analyse @@ -82,18 +83,21 @@ public class commandes { if(args.length==0) {badCommand=true; System.out.println("Il doit y avoir une commande.");System.out.println("Vous pouvez saisir les commandes -aide ou -help pour obtenir la liste des commandes.");} for(int i = 0 ; i < args.length ; i++) { if(args[i].equals("-use")) if((i+1)=0){ if(args[i-1].equals("-use")) analyse=true; if(args[i-1].equals("-hash")) calculLeHashDuFichier=true; - if(!analyse&&!calculLeHashDuFichier) { + if(args[i-1].equals("-a")) ecritNodeAnalyse=true; + if(!analyse&&!calculLeHashDuFichier&&!ecritNodeAnalyse) { badCommand=true; - System.out.println("Les commandes -use ou -hash doit être suivi du nom du fichier d'analyse."); + System.out.println("Les commandes -use ou -hash ou -a doit être suivi du nom du fichier d'analyse."); } } } + if(args[i].contains(".csv")) { Matcher m = Pattern.compile("{1,}.csv$").matcher(args[i]); if(m.find()) {fourniCSV=true; nameCSV = args[i];}else {badCommand=true;System.out.println("Il y a un problème avec l'extension du fichier CSV.\nL'extension doit être \".csv\".");} @@ -156,6 +160,10 @@ public class commandes { if(args.length>2) {System.out.println("\n\n***\nLa commande -hash suivi du nom du fichier d'analyse doit être la seule commande.\n***");clotureWithError();} calculLeHashDuFichier=true; } + if(args[i].equals("-a")) { + if(args.length>2) {System.out.println("\n\n***\nLa commande -a suivi du nom du fichier d'analyse doit être la seule commande.\n***");clotureWithError();} + ecritNodeAnalyse=true; + } if(args[i].equals("-sujet")) { if(!(analyse&&args.length==3&&Command.contains("-use"))) {badCommand=true; System.out.println("Vous devez saisir la commande -use suivi du fichier d'analyse et après vous pouvez saisir la commande -sujet.");} ecritSujet=true; @@ -209,7 +217,7 @@ public class commandes { &&!args[i].contains(".csv")&&!args[i].contains(".svg")&&!args[i].contains(".xml")&&!args[i].contains("-nofeedback")&&!args[i].contains("-help")&&!args[i].equals("-aide") &&!args[i].equals("-about")&&!args[i].equals("-nonote") &&!args[i].equals("-dest")&&!args[i].equals("-sujet")&&!args[i].equals("-nologo") &&!args[i].equals("-licence")&&!args[i].equals("-zipfeedback")&&!args[i].equals("-newLogo")&&!args[i].equals("-f")&&!m.find()&&!args[i].equals("-writefiles") - &&!args[i].equals("-hash")&&!m.find()) { + &&!args[i].equals("-hash")&&!m.find() &&!args[i].equals("-a")&&!m.find()) { badCommand=true; System.out.println("La commande " + args[i] + " est inconnu.");System.out.println("Vous pouvez taper \"java -jar analyseWriter.jar -aide\" pour obtenir la liste des commandes."); } } diff --git a/src/MEPTL/feedbacks.java b/src/MEPTL/feedbacks.java index 551e4e7..a7fc362 100644 --- a/src/MEPTL/feedbacks.java +++ b/src/MEPTL/feedbacks.java @@ -80,83 +80,22 @@ public class feedbacks { // auteur du sujet String auteurSujet = nodana.retourneFirstEnfantsByName("ouverture").getAttributs().get("auteur"); - if(auteurSujet==null) auteurSujet=""; - //création du feedback fichier.append("\r" + "\r" + "\r" + "\r" - + "Analyse LibreOffice Calc\r"); + + "Fichier généré par AnalyseWriter - Développeur : Pablo Rodriguez\r"); - fichier.append("" - + "" - + ""); + fichier.append("\r" + + "\r" + + "\r"); - fichier.append(""); + fichier.append(HTML.getStyleCSS()); - fichier.append("\r"); + fichier.append("\r\r"); fichier.append("\r"); fichier.append("
"); @@ -347,14 +286,17 @@ public class feedbacks { fichier.append(HTML.TableEnteteTableurSynthese()); String IdError = ""; // permet de récupérer les id des menu ou la proportioncorrect est NaN. (à cause de l'attribut analyseStyle=true) + for(int k = 0 ; k < nodana.getNodes().size();k++) { - if(nodana.getNodes().get(k).getAttributs().get("addmenu")!=null) if(nodana.getNodes().get(k).getAttributs().get("addmenu").equals("true")) { - if(!nodana.getNodes().get(k).getAttributs().get("proportioncorrect").equals("NaN")) { - fichier.append(HTML.TablePointsSyntheseStyle(nodana.getNodes().get(k).getAttributs().get("titre"),Double.valueOf(nodana.getNodes().get(k).getAttributs().get("proportioncorrect")),nodana.getNodes().get(k).getAttributs().get("pointtotal") + " pt",nodana.getNodes().get(k).getAttributs().get("pointgagner") + " pt", nodana.getNodes().get(k).getAttributs().get("poids"),nodana.getNodes().get(k).getAttributs().get("id"))); - }else { - IdError = IdError + nodana.getNodes().get(k).getAttributs().get("id"); - } - } + if(nodana.getNodes().get(k).getAttributs().get("addmenu")!=null) { + if(nodana.getNodes().get(k).getAttributs().get("addmenu").equals("true")) { + if(!nodana.getNodes().get(k).getAttributs().get("proportioncorrect").equals("NaN")) { + fichier.append(HTML.TablePointsSyntheseStyle(nodana.getNodes().get(k).getAttributs().get("titre"),Double.valueOf(nodana.getNodes().get(k).getAttributs().get("proportioncorrect")),nodana.getNodes().get(k).getAttributs().get("pointtotal") + " pt",nodana.getNodes().get(k).getAttributs().get("pointgagner") + " pt", nodana.getNodes().get(k).getAttributs().get("poids"),nodana.getNodes().get(k).getAttributs().get("id"))); + }else { + IdError = IdError + nodana.getNodes().get(k).getAttributs().get("id"); + } + } + } } diff --git a/src/MEPTL/meptl.java b/src/MEPTL/meptl.java index f21fe40..3e10ac0 100644 --- a/src/MEPTL/meptl.java +++ b/src/MEPTL/meptl.java @@ -143,7 +143,7 @@ public class meptl { //*********************************************************************************** //** PREPARATION du node Sujet pour analyse -use file.xml ou -use file.xml -sujet ** //*********************************************************************************** - if(commandes.analyse) { + if(commandes.analyse||commandes.ecritNodeAnalyse) { nodeSujet = chargementsujet(commandes.nameSujet, true); if(nodeSujet==null) { @@ -281,17 +281,23 @@ public class meptl { //********************************** //** Analyse des fichiers student ** //********************************** - if(commandes.analyse) { - node init = InitialisationAvantAnalyse(nodeSujet); + if(commandes.analyse||commandes.ecritNodeAnalyse) { + node init =verificationFichierAnalyse.InitialisationAvantAnalyse(nodeSujet); if(!Boolean.valueOf(init.getAttributs().get("erreur"))) { -// a.ecritureNodeEnXML(nodStudent, "fichier student",patch,false,""); //écriture du node analyse de l'étudiant +// a.ecritureNodeEnXML(nodStudent, "fichier student",patch,false,""); //écriture du node nodStudent de l'étudiant node ana = analyse(nodStudent, nodeSujet, i, a); -// a.ecritureNodeEnXML(ana, "nodana"+ana.retourneFirstEnfantsByName("ouverture").getAttributs().get("dossier"),"",false,""); //écriture du node analyse de l'étudiant + + //************************************************** + //** Ecriture des fichiers d'analyse des students ** + //************************************************** + if(commandes.ecritNodeAnalyse) { + Run.ecritureNodeEnXML(ana, "nodana"+ana.retourneFirstEnfantsByName("ouverture").getAttributs().get("dossier"),"",false,""); //écriture du node analyse de l'étudiant + } //**************************** //** Création des feedbacks ** //**************************** - if(!commandes.sansFeeback) { + if(!commandes.sansFeeback&&!commandes.ecritNodeAnalyse) { if(!commandes.zipfeedback) { //feedback(ana, verif); //classique directement dans le répertoire feedbacks.feedback(ana,verif, false); @@ -951,84 +957,7 @@ public class meptl { - /** - * Vérification du node sujet (premier node fichier et des paramètres.
- *
- * @param nodSujet - * @return - */ - private static node InitialisationAvantAnalyse(node nodSujet) { - node initSujet = new node(); - initSujet.setNomElt("init"); - - boolean erreur=false; - boolean erreurNomPremierNodeFichier=false; - boolean erreurManqueAttributEvaluerPremierNodeFichier=false; - boolean erreurValeurAttributEvaluerPremierNodeFichier=false; - boolean erreurPasNodesEnfantsAuPremierNodeFichier=false; - boolean erreurPasAttributMetaSujetAuPremierNodeFichier=false; - boolean erreurValeurVideAttributMetaSujetAuPremierNodeFichier=false; - boolean erreurValeurAttributProgressionNonConvertibleEnDouble=false; - boolean erreurValeurAttributNoteFromNonConvertibleEnDouble=false; - - if(!nodSujet.getNomElt().equals("fichier")) { - erreur=true; - erreurNomPremierNodeFichier = true; - } - if(nodSujet.getAttributs().get("evaluer")==null) { - erreur=true; - erreurManqueAttributEvaluerPremierNodeFichier = true; - } - if(!nodSujet.getAttributs().get("evaluer").equals("true")) { - erreur=true; - erreurValeurAttributEvaluerPremierNodeFichier=true; - } - if(nodSujet.getNodes().size()==0) { - erreur=true; - erreurPasNodesEnfantsAuPremierNodeFichier=true; - } - if(nodSujet.getAttributs().get("metaSujet")==null) { - erreur=true; - erreurPasAttributMetaSujetAuPremierNodeFichier=true; - } - if(nodSujet.getAttributs().get("metaSujet")!=null) { - if(nodSujet.getAttributs().get("metaSujet").isEmpty()) { - erreur=true; - erreurValeurVideAttributMetaSujetAuPremierNodeFichier=true; - } - } - if(nodSujet.getAttributs().get("progression")!=null) { - String p = nodSujet.getAttributs().get("progression"); - try { - Double.valueOf(p); - } catch (Exception e) { - erreur=true; - erreurValeurAttributProgressionNonConvertibleEnDouble=true; - } - } - if(nodSujet.getAttributs().get("notefrom")!=null) { - String p = nodSujet.getAttributs().get("notefrom"); - try { - Double.valueOf(p); - } catch (Exception e) { - erreur=true; - erreurValeurAttributNoteFromNonConvertibleEnDouble=true; - } - } - - initSujet.getAttributs().put("erreur",String.valueOf(erreur)); - initSujet.getAttributs().put("erreurNomPremierNodeFichier",String.valueOf(erreurNomPremierNodeFichier)); - initSujet.getAttributs().put("erreurManqueAttributEvaluerPremierNodeFichier",String.valueOf(erreurManqueAttributEvaluerPremierNodeFichier)); - initSujet.getAttributs().put("erreurValeurAttributEvaluerPremierNodeFichier",String.valueOf(erreurValeurAttributEvaluerPremierNodeFichier)); - initSujet.getAttributs().put("erreurPasNodesEnfantsAuPremierNodeFichier",String.valueOf(erreurPasNodesEnfantsAuPremierNodeFichier)); - initSujet.getAttributs().put("erreurPasAttributMetaSujetAuPremierNodeFichier",String.valueOf(erreurPasAttributMetaSujetAuPremierNodeFichier)); - initSujet.getAttributs().put("erreurValeurVideAttributMetaSujetAuPremierNodeFichier",String.valueOf(erreurValeurVideAttributMetaSujetAuPremierNodeFichier)); - initSujet.getAttributs().put("erreurValeurAttributProgressionNonConvertibleEnDouble",String.valueOf(erreurValeurAttributProgressionNonConvertibleEnDouble)); - initSujet.getAttributs().put("erreurValeurAttributNoteFromNonConvertibleEnDouble",String.valueOf(erreurValeurAttributNoteFromNonConvertibleEnDouble)); - - return initSujet; - } - + /** * Début de l'analyse par comparaison du node étudiant avec le node sujet. * @param nodStudent, le node étudiant. @@ -1524,7 +1453,7 @@ public class meptl { * @param nameElt : le nom de l'élément (node) analysé. * @return le node retour avec tous les nodes enfants nameItem contenant les différentes analyse. */ - public static node analyseLesAttributEtContenuDuNode(node nodeStudent, node sujet, node retour, String nameItem, String nameElt) { + public static node evalLesAttributEtContenuDuNode(node nodeStudent, node sujet, node retour, String nameItem, String nameElt) { Enumeration key = sujet.getAttributs().keys(); while(key.hasMoreElements()) { String k = key.nextElement(); @@ -1564,9 +1493,9 @@ public class meptl { if(k.equals("evalNameInitialCreator") && sujet.getNomElt().equals("meta:initial-creator")) { if(nodeStudent!=null) { - retour = analyseNameInitialCreator(retour,nodeStudent, nodeStudent.getContenu().get(0), sujet.getAttributs().get("evalNameInitialCreator"),"Créateur"); + retour = evalNameInitialCreator(retour,nodeStudent, nodeStudent.getContenu().get(0), sujet.getAttributs().get("evalNameInitialCreator"),"Créateur"); }else { - retour = analyseNameInitialCreator(retour,null, "Créateur inconnu", sujet.getAttributs().get("evalNameInitialCreator"),"Créateur"); + retour = evalNameInitialCreator(retour,null, "Créateur inconnu", sujet.getAttributs().get("evalNameInitialCreator"),"Créateur"); } } @@ -1660,7 +1589,7 @@ public class meptl { * @param nameElt : le nom de l'élément (node) analysé. * @return le node retour avec tous les nodes enfants nameItem contenant les différentes analyse. */ - public static node analyseLesAttributAnalyseStyle(node nodeStyleParagraphStudent, node nodeStyleParagraphSujet, node retour, String nameItem, String nameElt) { + public static node evalLesAttributAnalyseStyle(node nodeStyleParagraphStudent, node nodeStyleParagraphSujet, node retour, String nameItem, String nameElt) { Enumeration key = nodeStyleParagraphSujet.getAttributs().keys(); while(key.hasMoreElements()) { @@ -1868,7 +1797,7 @@ public class meptl { /** * Ajoute dans le node nodanalyse.
* Le node saut et son attribut titre
- * Et place un titre1, ou titre2, ou titre3
+ * Et place un titre, ou titre1, ou titre2, ou titre3
*
* @param nod * @return @@ -1881,6 +1810,13 @@ public class meptl { N.setClose(true); nodanalyse.getNodes().add(N); } + if(nodSujet.getAttributs().get("titre1")!=null) { + node N = new node(); + N.setNomElt("saut"); + N.getAttributs().put("titre1", nodSujet.getAttributs().get("titre1")); + N.setClose(true); + nodanalyse.getNodes().add(N); + } if(nodSujet.getAttributs().get("titre2")!=null) { node N = new node(); N.setNomElt("saut"); @@ -1899,6 +1835,26 @@ public class meptl { return nodanalyse; } + /** + * Ajoute un saut de ligne.
+ * @param nodSujet + * @param nodanalyse + * @return + */ + public static node addSaut(node nodSujet, node nodanalyse) { + if(nodSujet.getAttributs().get("saut")!=null) { + if(nodSujet.getAttributs().get("saut").equalsIgnoreCase("true")) { + node N = new node(); + N.setNomElt("saut"); + //N.getAttributs().put("titre", ""); + N.setClose(true); + nodanalyse.getNodes().add(N); + } + } + + return nodanalyse; + } + /** * Vérirication des historiques * @param verification @@ -2696,7 +2652,7 @@ public class meptl { * @param nameElt * @return */ - private static node analyseNameInitialCreator(node retour, node nodStudent, String nameCreator, String point, String nameElt) { + private static node evalNameInitialCreator(node retour, node nodStudent, String nameCreator, String point, String nameElt) { node item = null; if(nodStudent!=null) { item = retourneNoteAvecResultatsAnalyse(nameCreator,"name", nodStudent.getAttributs().get("initial-creator"),nameCreator + "↑‽" +point, nameElt ); diff --git a/src/MEPTL/rechercherUnNodeStudent.java b/src/MEPTL/rechercherUnNodeStudent.java index f6dfac8..d5e95c6 100644 --- a/src/MEPTL/rechercherUnNodeStudent.java +++ b/src/MEPTL/rechercherUnNodeStudent.java @@ -57,6 +57,13 @@ public class rechercherUnNodeStudent { nodStudent = findDrawFrame(nameNode, nodSujet, nod0Student, nod1Student, nod2Student, a); } + //************************************************* + //** Recherche le nodes text:date par text:fixed ** + //************************************************* + if(nameNode.equals("text:date")) { + nodStudent = findTextDate(nameNode, nodSujet, nod0Student, nod1Student, nod2Student, a); + } + //*********************************************** //** Recherche le nodes text:xxx par text:name ** //*********************************************** @@ -84,6 +91,7 @@ public class rechercherUnNodeStudent { if(nameNode.equals("text:h")) { nodStudent = findByContentWithTolerance(nameNode, nodSujet, nod0Student, nod1Student, nod2Student, a); } + //******************************************************* //** Recherche le node par l'index mais si pas demandé ** @@ -92,6 +100,12 @@ public class rechercherUnNodeStudent { nodStudent = findByIndexEvenIsFalse(nameNode, nodSujet, nod0Student, nod1Student, nod2Student, a); } + //**************************************************************** + //** Recherche le node text:conditional-text par text:condition ** + //**************************************************************** + if(nameNode.equals("text:conditional-text") ) { + nodStudent = findTextConditional(nameNode, nodSujet, nod0Student, nod1Student, nod2Student, a); + } //*************************************************************** //** Recherche le node table:table-column par table:style-name ** @@ -106,7 +120,6 @@ public class rechercherUnNodeStudent { if(nameNode.equals("text:tab") || nameNode.equals("style:graphic-properties")) { nodStudent = findByContentZero(nameNode, nodSujet, nod0Student, nod1Student, nod2Student, a); } - //***************************************************************** //** Recherche Le node text:p par les différents contenu du node ** @@ -185,55 +198,123 @@ public class rechercherUnNodeStudent { node nodStudent =null; - //si le node "text:p" contient un "text:user-defined" alors le recherche par le "text:name" de ce node "text:user-defined" - if(nodSujet.containElementByName("text:user-defined")) { - String valueAttribut = outils.withoutCodeAndPoint(nodSujet.retourneFirstEnfantsByName("text:user-defined").getAttributs().get("text:name")); - if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:user-defined", "text:name", valueAttribut); - if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:user-defined", "text:name", valueAttribut); - if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:user-defined", "text:name", valueAttribut); - } - //si le node "text:p" contient un "text:conditional-text" alors le recherche par le "text:condition" de ce node "text:conditional-text" - if(nodSujet.containElementByName("text:conditional-text")) { - String valueAttribut = outils.withoutCodeAndPoint(nodSujet.retourneFirstEnfantsByName("text:conditional-text").getAttributs().get("text:condition")); - if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:conditional-text", "text:condition", valueAttribut); - if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:conditional-text", "text:condition", valueAttribut); - if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:conditional-text", "text:condition", valueAttribut); - } - //si le node "text:p" contient un "text:database-display" alors le recherche par le "text:column-name" de ce node "text:database-display" - if(nodSujet.containElementByName("text:database-display")) { - String valueAttribut = outils.withoutCodeAndPoint(nodSujet.retourneFirstEnfantsByName("text:database-display").getAttributs().get("text:column-name")); - if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:database-display", "text:column-name", valueAttribut); - if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:database-display", "text:column-name", valueAttribut); - if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:database-display", "text:column-name", valueAttribut); - } - //si le node "text:p" contient un "text:date" alors le recherche par le "text:fixed" de ce node "text:date" - if(nodSujet.containElementByName("text:date")) { - String valueAttribut = outils.withoutCodeAndPoint(nodSujet.retourneFirstEnfantsByName("text:date").getAttributs().get("text:fixed")); - if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:date", "text:fixed", valueAttribut); - if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:date", "text:fixed", valueAttribut); - if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:date", "text:fixed", valueAttribut); - } - if(nodSujet.containElementByName("text:subject")) { - if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:subject"); - if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:subject"); - if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:subject"); - } - if(nodSujet.containElementByName("text:title")) { - if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:title"); - if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:title"); - if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:title"); - } - if(nodSujet.containElementByName("text:initial-creator")) { - if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:initial-creator"); - if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:initial-creator"); - if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:initial-creator"); - } - if(nodSujet.containElementByName("text:creator")) { - if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:creator"); - if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:creator"); - if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:creator"); + if(!nodSujet.getNodes().isEmpty()) return null; + + String nameNodeSujet = nodSujet.getNomElt(); + + if(nodSujet.getNodes().size()>0) { + for(int i = 0; i < nodSujet.getNodes().size() ; i++) { + if(nodSujet.getNodes().get(i)!=null) { + node nodEnfantSujet = nodSujet.getNodes().get(i); + String nameNodeEnfantSujet = nodEnfantSujet.getNomElt(); + + if(nameNodeEnfantSujet.equals("text:user-defined")) { + String valueAttribut = outils.withoutCodeAndPoint(nodSujet.retourneFirstEnfantsByName("text:user-defined").getAttributs().get("text:name")); + if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue(nameNodeSujet,"text:user-defined", "text:name", valueAttribut); + if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue(nameNodeSujet,"text:user-defined", "text:name", valueAttribut); + if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue(nameNodeSujet,"text:user-defined", "text:name", valueAttribut); + } + + if(nameNodeEnfantSujet.equals("text:conditional-text")) { + String valueAttribut = outils.withoutCodeAndPoint(nodSujet.retourneFirstEnfantsByName("text:conditional-text").getAttributs().get("text:condition")); + if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue(nameNodeSujet,"text:conditional-text", "text:condition", valueAttribut); + if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue(nameNodeSujet,"text:conditional-text", "text:condition", valueAttribut); + if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue(nameNodeSujet,"text:conditional-text", "text:condition", valueAttribut); + } + + if(nameNodeEnfantSujet.equals("text:database-display")) { + String valueAttribut = outils.withoutCodeAndPoint(nodSujet.retourneFirstEnfantsByName("text:database-display").getAttributs().get("text:column-name")); + if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue(nameNodeSujet,"text:database-display", "text:column-name", valueAttribut); + if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue(nameNodeSujet,"text:database-display", "text:column-name", valueAttribut); + if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue(nameNodeSujet,"text:database-display", "text:column-name", valueAttribut); + } + + if(nameNodeEnfantSujet.equals("text:date")) { + String valueAttribut = outils.withoutCodeAndPoint(nodSujet.retourneFirstEnfantsByName("text:date").getAttributs().get("text:fixed")); + if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue(nameNodeSujet,"text:date", "text:fixed", valueAttribut); + if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue(nameNodeSujet,"text:date", "text:fixed", valueAttribut); + if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue(nameNodeSujet,"text:date", "text:fixed", valueAttribut); + } + + if(nameNodeEnfantSujet.equals("text:subject")) { + if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstEnfantsByNameNode1ContainNameNode2(nameNodeSujet,"text:subject"); + if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstEnfantsByNameNode1ContainNameNode2(nameNodeSujet,"text:subject"); + if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstEnfantsByNameNode1ContainNameNode2(nameNodeSujet,"text:subject"); + } + + if(nameNodeEnfantSujet.equals("text:title")) { + if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstEnfantsByNameNode1ContainNameNode2(nameNodeSujet,"text:title"); + if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstEnfantsByNameNode1ContainNameNode2(nameNodeSujet,"text:title"); + if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstEnfantsByNameNode1ContainNameNode2(nameNodeSujet,"text:title"); + } + + if(nameNodeEnfantSujet.equals("text:initial-creator")) { + if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstEnfantsByNameNode1ContainNameNode2(nameNodeSujet,"text:initial-creator"); + if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstEnfantsByNameNode1ContainNameNode2(nameNodeSujet,"text:initial-creator"); + if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstEnfantsByNameNode1ContainNameNode2(nameNodeSujet,"text:initial-creator"); + } + + if(nameNodeEnfantSujet.equals("text:creator")) { + if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstEnfantsByNameNode1ContainNameNode2(nameNodeSujet,"text:creator"); + if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstEnfantsByNameNode1ContainNameNode2(nameNodeSujet,"text:creator"); + if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstEnfantsByNameNode1ContainNameNode2(nameNodeSujet,"text:creator"); + } + + + if(nodStudent!=null) return nodStudent; + } + } } +// //si le node "text:p" contient un "text:user-defined" alors le recherche par le "text:name" de ce node "text:user-defined" +// if(nodSujet.containElementByName("text:user-defined")) { +// String valueAttribut = outils.withoutCodeAndPoint(nodSujet.retourneFirstEnfantsByName("text:user-defined").getAttributs().get("text:name")); +// if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:user-defined", "text:name", valueAttribut); +// if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:user-defined", "text:name", valueAttribut); +// if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:user-defined", "text:name", valueAttribut); +// } +// //si le node "text:p" contient un "text:conditional-text" alors le recherche par le "text:condition" de ce node "text:conditional-text" +// if(nodSujet.containElementByName("text:conditional-text")) { +// String valueAttribut = outils.withoutCodeAndPoint(nodSujet.retourneFirstEnfantsByName("text:conditional-text").getAttributs().get("text:condition")); +// if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:conditional-text", "text:condition", valueAttribut); +// if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:conditional-text", "text:condition", valueAttribut); +// if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:conditional-text", "text:condition", valueAttribut); +// } +// //si le node "text:p" contient un "text:database-display" alors le recherche par le "text:column-name" de ce node "text:database-display" +// if(nodSujet.containElementByName("text:database-display")) { +// String valueAttribut = outils.withoutCodeAndPoint(nodSujet.retourneFirstEnfantsByName("text:database-display").getAttributs().get("text:column-name")); +// if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:database-display", "text:column-name", valueAttribut); +// if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:database-display", "text:column-name", valueAttribut); +// if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:database-display", "text:column-name", valueAttribut); +// } +// //si le node "text:p" contient un "text:date" alors le recherche par le "text:fixed" de ce node "text:date" +// if(nodSujet.containElementByName("text:date")) { +// String valueAttribut = outils.withoutCodeAndPoint(nodSujet.retourneFirstEnfantsByName("text:date").getAttributs().get("text:fixed")); +// if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:date", "text:fixed", valueAttribut); +// if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:date", "text:fixed", valueAttribut); +// if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:date", "text:fixed", valueAttribut); +// } +// if(nodSujet.containElementByName("text:subject")) { +// if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:subject"); +// if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:subject"); +// if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:subject"); +// } +// if(nodSujet.containElementByName("text:title")) { +// if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:title"); +// if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:title"); +// if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:title"); +// } +// if(nodSujet.containElementByName("text:initial-creator")) { +// if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:initial-creator"); +// if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:initial-creator"); +// if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:initial-creator"); +// } +// if(nodSujet.containElementByName("text:creator")) { +// if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:creator"); +// if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:creator"); +// if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:creator"); +// } + //** Recherche par contenu if(!nodSujet.getContenu().isEmpty()) { @@ -243,7 +324,7 @@ public class rechercherUnNodeStudent { if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContentExact(nod0Student.getNodes(), valueAttribut, nodSujet.getNomElt()); } - //** Recherche le node par index uniquement. Si trouve pa retourne un null. + //** Recherche le node par index uniquement même si pas demandé. Si trouve pas retourne un null. if(nodSujet.getAttributs().get("index")!=null){ String valueAttribut = nodSujet.getAttributs().get("index"); if(nod2Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod2Student.getNodes(), nodSujet.getNomElt(),"index",valueAttribut); @@ -285,6 +366,26 @@ public class rechercherUnNodeStudent { return nodStudent; } + /** + * + * @param nameNode + * @param nodSujet + * @param nod0Student + * @param nod1Student + * @param nod2Student + * @param a + * @return + */ + private static node findTextConditional(String nameNode, node nodSujet,node nod0Student, node nod1Student, node nod2Student, Run a) { + node nodStudent = null; + String valueAttribut = outils.withoutCodeAndPoint(nodSujet.getAttributs().get("text:condition")); + if(nod2Student!=null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod2Student, nameNode, "text:condition", valueAttribut); + if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod1Student, nameNode, "text:condition", valueAttribut); + if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod0Student, nameNode, "text:condition", valueAttribut); + + return nodStudent; + } + /** * Recherche Le node text:section par l'attribut text:name;
* @param nameNode @@ -303,6 +404,26 @@ public class rechercherUnNodeStudent { return nodStudent; } + + /** + * + * @param nameNode + * @param nodSujet + * @param nod0Student + * @param nod1Student + * @param nod2Student + * @param a + * @return + */ + private static node findTextDate(String nameNode, node nodSujet,node nod0Student, node nod1Student, node nod2Student, Run a) { + node nodStudent = null; + String valueAttribut = outils.withoutCodeAndPoint(nodSujet.getAttributs().get("text:fixed")); + if(nod2Student!=null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod2Student, nameNode, "text:fixed", valueAttribut); + if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod1Student, nameNode, "text:fixed", valueAttribut); + if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod0Student, nameNode, "text:fixed", valueAttribut); + + return nodStudent; + } /** * Recherche le node par son nom. Retourne le premier node qui correspond au nom du node.
@@ -335,9 +456,10 @@ public class rechercherUnNodeStudent { */ private static node findDataBase(String nameNode, node nodSujet,node nod0Student, node nod1Student, node nod2Student, Run a) { node nodStudent = null; - if(nod2Student!=null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod2Student, nameNode, "text:column-name", outils.withoutCodeAndPoint(nodSujet.getAttributs().get("text:column-name"))); - if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod1Student, nameNode, "text:column-name", outils.withoutCodeAndPoint(nodSujet.getAttributs().get("text:column-name"))); - if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod0Student, nameNode, "text:column-name", outils.withoutCodeAndPoint(nodSujet.getAttributs().get("text:column-name"))); + String valueAttribut = outils.withoutCodeAndPoint(nodSujet.getAttributs().get("text:column-name")); + if(nod2Student!=null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod2Student, nameNode, "text:column-name", valueAttribut); + if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod1Student, nameNode, "text:column-name", valueAttribut); + if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod0Student, nameNode, "text:column-name", valueAttribut); return nodStudent; } diff --git a/src/MEPTL/verificationFichierAnalyse.java b/src/MEPTL/verificationFichierAnalyse.java index 2ba3644..5290f63 100644 --- a/src/MEPTL/verificationFichierAnalyse.java +++ b/src/MEPTL/verificationFichierAnalyse.java @@ -199,6 +199,89 @@ public class verificationFichierAnalyse { } + + /** + * Vérification du node sujet (premier node fichier et des paramètres.
+ *
+ * @param nodSujet + * @return + */ + public static node InitialisationAvantAnalyse(node nodSujet) { + node initSujet = new node(); + initSujet.setNomElt("init"); + + boolean erreur=false; + boolean erreurNomPremierNodeFichier=false; + boolean erreurManqueAttributEvaluerPremierNodeFichier=false; + boolean erreurValeurAttributEvaluerPremierNodeFichier=false; + boolean erreurPasNodesEnfantsAuPremierNodeFichier=false; + boolean erreurPasAttributMetaSujetAuPremierNodeFichier=false; + boolean erreurValeurVideAttributMetaSujetAuPremierNodeFichier=false; + boolean erreurValeurAttributProgressionNonConvertibleEnDouble=false; + boolean erreurValeurAttributNoteFromNonConvertibleEnDouble=false; + + if(!nodSujet.getNomElt().equals("fichier")) { + erreur=true; + erreurNomPremierNodeFichier = true; + } + if(nodSujet.getAttributs().get("evaluer")==null) { + erreur=true; + erreurManqueAttributEvaluerPremierNodeFichier = true; + } + if(nodSujet.getAttributs().get("evaluer")!=null) { + if(!nodSujet.getAttributs().get("evaluer").equals("true")) { + erreur=true; + erreurValeurAttributEvaluerPremierNodeFichier=true; + } + } + if(nodSujet.getNodes().isEmpty()) { + erreur=true; + erreurPasNodesEnfantsAuPremierNodeFichier=true; + } + if(nodSujet.getAttributs().get("metaSujet")==null) { + erreur=true; + erreurPasAttributMetaSujetAuPremierNodeFichier=true; + } + if(nodSujet.getAttributs().get("metaSujet")!=null) { + if(nodSujet.getAttributs().get("metaSujet").isEmpty()) { + erreur=true; + erreurValeurVideAttributMetaSujetAuPremierNodeFichier=true; + } + } + if(nodSujet.getAttributs().get("progression")!=null) { + String p = nodSujet.getAttributs().get("progression"); + try { + Double.valueOf(p); + } catch (Exception e) { + erreur=true; + erreurValeurAttributProgressionNonConvertibleEnDouble=true; + } + } + if(nodSujet.getAttributs().get("notefrom")!=null) { + String p = nodSujet.getAttributs().get("notefrom"); + try { + Double.valueOf(p); + } catch (Exception e) { + erreur=true; + erreurValeurAttributNoteFromNonConvertibleEnDouble=true; + } + } + + initSujet.getAttributs().put("erreur",String.valueOf(erreur)); + initSujet.getAttributs().put("erreurNomPremierNodeFichier",String.valueOf(erreurNomPremierNodeFichier)); + initSujet.getAttributs().put("erreurManqueAttributEvaluerPremierNodeFichier",String.valueOf(erreurManqueAttributEvaluerPremierNodeFichier)); + initSujet.getAttributs().put("erreurValeurAttributEvaluerPremierNodeFichier",String.valueOf(erreurValeurAttributEvaluerPremierNodeFichier)); + initSujet.getAttributs().put("erreurPasNodesEnfantsAuPremierNodeFichier",String.valueOf(erreurPasNodesEnfantsAuPremierNodeFichier)); + initSujet.getAttributs().put("erreurPasAttributMetaSujetAuPremierNodeFichier",String.valueOf(erreurPasAttributMetaSujetAuPremierNodeFichier)); + initSujet.getAttributs().put("erreurValeurVideAttributMetaSujetAuPremierNodeFichier",String.valueOf(erreurValeurVideAttributMetaSujetAuPremierNodeFichier)); + initSujet.getAttributs().put("erreurValeurAttributProgressionNonConvertibleEnDouble",String.valueOf(erreurValeurAttributProgressionNonConvertibleEnDouble)); + initSujet.getAttributs().put("erreurValeurAttributNoteFromNonConvertibleEnDouble",String.valueOf(erreurValeurAttributNoteFromNonConvertibleEnDouble)); + + return initSujet; + } + + + /** * Vérification de la présence de l'attribut addmenu=true lorsque l'attribut evaluer=true.
* Uniquement pour les nodes principaux.
@@ -648,7 +731,7 @@ public class verificationFichierAnalyse { System.out.println("\t\t│ │"); System.out.println("\t\t│ (')_(') │"); System.out.println("\t\t│ ( `.° ) │"); - System.out.println("\t\t│ (\")__(\") .. à bientôt, analyseWriter. │"); + System.out.println("\t\t│ (\")__(\") .. à bientôt, analyseWriter. │"); System.out.println("\t\t└───────────────────────────────────────────────────────────┘"); System.out.println(); System.exit(0);