package evaluer; import java.util.ArrayList; import java.util.Enumeration; import java.util.regex.Matcher; import java.util.regex.Pattern; import MEPTL.commandes; import MEPTL.rechercherUnNodeStudent; import cXML.node; import list.listMethodeEvaluationAnalyseWriter; import list.listeDesNodesAncrable; import list.listeDesNodesEvalPlacement; import list.listeDesNodesFormatageDirect; import list.listeDesNodesPourEvaluerPage; public class evaluationAttribut { //**************************************************************************** //**************************************************************************** //** LES DEUX POINTS D'ENTRES DES METHODES D'EVALUATION ** //**************************************************************************** //**************************************************************************** /** * POINT D'ENTREE DE LA METHODE ANALYSESTYLE;
*
* Analyse tous les attributs des nodes .
* Formatage direct des styles de paragraphe.
* Les attributs doivent contenir le code ‼.
*
* @param nodeStyleParagraphStudent : le node de l'étudiant. * @param nodeStyleParagraphSujet : le node du sujet * @param retour : le node à retourner avec les enfants nommés nameItem. * @param nameItem : le nom des nodes enfants. * @param nameElt : le nom de l'élément (node) analysé. L'information se trouve au début pour la traduction * @return le node retour avec tous les nodes enfants nameItem contenant les différentes analyses. */ public static node evalLesAttributAnalyseStyle(node nodeStyleParagraphStudent, node nodeStyleParagraphSujet, node retour, String nameItem, String nameElt) { if(nodeStyleParagraphSujet.getAttributs().get("evaluer")==null) return retour; if(!nodeStyleParagraphSujet.getAttributs().get("evaluer").equals("true")) return retour; if(nodeStyleParagraphSujet.getAttributs().get("EvaluerATraversAnalyseStyle")==null) return retour; if(nodeStyleParagraphSujet.getAttributs().get("EvaluerATraversAnalyseStyle").equals("false")) return retour; Enumeration key = nodeStyleParagraphSujet.getAttributs().keys(); while(key.hasMoreElements()) { String k = key.nextElement(); if(nodeStyleParagraphSujet.getAttributs().get(k).contains("‼") || nodeStyleParagraphSujet.getAttributs().get(k).contains("‽")){ if(nodeStyleParagraphStudent!=null) { String valueAttributStudent = nodeStyleParagraphStudent.getAttributs().get(k); String valueAttributSujet = nodeStyleParagraphSujet.getAttributs().get(k).replace("‼", "‽"); node item = retourneNoteAvecResultatsAnalyse(nameItem,k, valueAttributStudent, valueAttributSujet,nameElt); retour.getNodes().add(item); }else { String valueAttributStudent = "null"; String valueAttributSujet = nodeStyleParagraphSujet.getAttributs().get(k).replace("‼", "‽"); node item = retourneNoteAvecResultatsAnalyse(nameItem, k, valueAttributStudent, valueAttributSujet,nameElt); retour.getNodes().add(item); } } // évaluation des méthodes d'analyseWriter au travers de la méthode analyseStyle if(listMethodeEvaluationAnalyseWriter.isMethodeEvaluationAnalyseWriterAvecPoint(k)) { switch (k) { case "evalNameNode": { retour = evaluationAttribut.evaluationNameNode(retour, nodeStyleParagraphStudent, nodeStyleParagraphSujet.getNomElt(), nodeStyleParagraphSujet.getAttributs().get(k), nameElt); } case "evalLegacyStyleParentPresent":{ retour = evaluationAttribut.evalPresenceStyleParent(nodeStyleParagraphSujet, nodeStyleParagraphStudent, retour, nameElt); } } } } retour = evalLesNodesEnfantsDesAnalyseAuTraversAnalyseStyle(nodeStyleParagraphSujet, nodeStyleParagraphStudent, retour, nameItem, nameElt); return retour; } /** * Evalue tous les nodes enfants des nodes analysés au travers d'analyseStyle. * @param nodeStyleParagraphSujet * @param nodeStyleParagraphStudent * @param retour * @param nameItem * @param nameElt * @return */ private static node evalLesNodesEnfantsDesAnalyseAuTraversAnalyseStyle(node nodeStyleParagraphSujet, node nodeStyleParagraphStudent, node retour, String nameItem, String nameElt) { for(int i = 0 ; i < nodeStyleParagraphSujet.getNodes().size();i++) { String nameNodeSujet = nodeStyleParagraphSujet.getNodes().get(i).getNomElt(); if(nodeStyleParagraphStudent!=null) { if(nodeStyleParagraphSujet.retourneEnfantsByNameExist(nameNodeSujet) && nodeStyleParagraphStudent.retourneEnfantsByNameExist(nameNodeSujet) ) { node propertiesSujet = nodeStyleParagraphSujet.getNodes().get(i); if(propertiesSujet.getAttributs().get("evaluer")!=null) { if(propertiesSujet.getAttributs().get("evaluer").equals("true")) { node propertiesStudent = nodeStyleParagraphStudent.retourneFirstEnfantsByName(nameNodeSujet); if(nameNodeSujet.equals("style:tab-stop")) { propertiesStudent = rechercherUnNodeStudent.rechercheLeNodeEnCascade(nameNodeSujet, nodeStyleParagraphSujet.getNodes().get(i), null, null, nodeStyleParagraphStudent, null); } Enumeration key = propertiesSujet.getAttributs().keys(); while(key.hasMoreElements()) { String k = key.nextElement(); if(!listMethodeEvaluationAnalyseWriter.isMethodeEvaluationAnalyseWriterAvecPoint(k) && ( propertiesSujet.getAttributs().get(k).contains("‼") || propertiesSujet.getAttributs().get(k).contains("‽")) ){ if(propertiesStudent!=null) { String valueAttributStudent = propertiesStudent.getAttributs().get(k); String valueAttributSujet = propertiesSujet.getAttributs().get(k).replace("‼", "‽"); node item = retourneNoteAvecResultatsAnalyse(nameItem,k, valueAttributStudent, valueAttributSujet,nameNodeSujet); retour.getNodes().add(item); }else { String valueAttributStudent = "null"; String valueAttributSujet = propertiesSujet.getAttributs().get(k).replace("‼", "‽"); node item = retourneNoteAvecResultatsAnalyse(nameItem, k, valueAttributStudent, valueAttributSujet,nameNodeSujet); retour.getNodes().add(item); } } // évaluation des méthodes d'analyseWriter au travers de la méthode analyseStyle if(listMethodeEvaluationAnalyseWriter.isMethodeEvaluationAnalyseWriterAvecPoint(k)) { switch (k) { case "evalNameNode": { retour = evaluationAttribut.evaluationNameNode(retour, nodeStyleParagraphStudent, propertiesSujet.getNomElt(), propertiesSujet.getAttributs().get(k), propertiesSujet.getNomElt()); } case "evalLegacyStyleParentPresent":{ retour = evaluationAttribut.evalPresenceStyleParent(propertiesSujet, nodeStyleParagraphStudent, retour, nameElt); } } } } } } } }else { if(nodeStyleParagraphSujet.retourneEnfantsByNameExist(nameNodeSujet)) { node propertiesSujet = nodeStyleParagraphSujet.getNodes().get(i); if(propertiesSujet.getAttributs().get("evaluer")!=null) { if(propertiesSujet.getAttributs().get("evaluer").equals("true")) { Enumeration key = propertiesSujet.getAttributs().keys(); while(key.hasMoreElements()) { String k = key.nextElement(); if(propertiesSujet.getAttributs().get(k).contains("‼") || propertiesSujet.getAttributs().get(k).contains("‽")){ String valueAttributStudent = "null"; String valueAttributSujet = propertiesSujet.getAttributs().get(k).replace("‼", "‽"); node item = retourneNoteAvecResultatsAnalyse(nameItem, k, valueAttributStudent, valueAttributSujet,nameNodeSujet); retour.getNodes().add(item); } // évaluation des méthodes d'analyseWriter au travers de la méthode analyseStyle if(listMethodeEvaluationAnalyseWriter.isMethodeEvaluationAnalyseWriterAvecPoint(k)) { switch (k) { case "evalNameNode": { retour = evaluationAttribut.evaluationNameNode(retour, nodeStyleParagraphStudent, propertiesSujet.getNomElt(), propertiesSujet.getAttributs().get(k), propertiesSujet.getNomElt()); } case "evalLegacyStyleParentPresent":{ retour = evaluationAttribut.evalPresenceStyleParent(propertiesSujet, nodeStyleParagraphStudent, retour, nameElt); } } } } } } } } if(nodeStyleParagraphSujet.getNodes().get(i).getNodes().size()>0) { if(nodeStyleParagraphStudent!=null) { String nameNodeEnfantSujet = nodeStyleParagraphSujet.getNodes().get(i).getNomElt(); if(nodeStyleParagraphStudent!=null) { if(nodeStyleParagraphSujet.retourneEnfantsByNameExist(nameNodeEnfantSujet) && nodeStyleParagraphStudent.retourneEnfantsByNameExist(nameNodeEnfantSujet) ) { if(nameNodeEnfantSujet.equals("style:tab-stop")) { node propertiesStudent = rechercherUnNodeStudent.rechercheLeNodeEnCascade(nameNodeSujet, nodeStyleParagraphSujet.getNodes().get(i), null, null, nodeStyleParagraphStudent, null); retour = evalLesNodesEnfantsDesAnalyseAuTraversAnalyseStyle(nodeStyleParagraphSujet.getNodes().get(i),propertiesStudent, retour, nameItem, nodeStyleParagraphSujet.getNodes().get(i).getNomElt()); }else { retour = evalLesNodesEnfantsDesAnalyseAuTraversAnalyseStyle(nodeStyleParagraphSujet.getNodes().get(i), nodeStyleParagraphStudent.retourneFirstEnfantsByName(nameNodeEnfantSujet), retour, nameItem, nodeStyleParagraphSujet.getNodes().get(i).getNomElt()); } } } }else { retour = evalLesNodesEnfantsDesAnalyseAuTraversAnalyseStyle(nodeStyleParagraphSujet.getNodes().get(i), null, retour, nameItem, nameElt); } } } return retour; } /** * POINTS D'ENTREES DES METHODES D'EVALUATION
*
* Analyse tous les attributs et les contenus d'un node.
* Les attributs et les contenus doivent posséder la caractère ‽ ou ‼.
* Ou le node doit posséder des attributs d'analyseWriter comme allContent="1", etc...
*
* @param nodeStudent : le node de l'étudiant. * @param sujet : le node du sujet * @param retour : le node à retourner avec les enfants nommés nameItem. * @param nameItem : le nom des nodes enfants. * @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 evalLesAttributEtContenuDuNode(node nodeStudent, node sujet, node retour, String nameItem, String nameElt) { Enumeration key = sujet.getAttributs().keys(); while(key.hasMoreElements()) { String k = key.nextElement(); // evaluer les attributs de Writer avec l'évaluateur ‽ if( sujet.getAttributs().get(k).contains("‽")){ if(nodeStudent!=null) { String valueAttributStudent = nodeStudent.getAttributs().get(k); String valueAttributSujet = sujet.getAttributs().get(k); node item = retourneNoteAvecResultatsAnalyse(nameItem,k, valueAttributStudent, valueAttributSujet,nameElt); retour.getNodes().add(item); }else { String valueAttributStudent = "null"; String valueAttributSujet = sujet.getAttributs().get(k); node item = retourneNoteAvecResultatsAnalyse(nameItem, k, valueAttributStudent, valueAttributSujet,nameElt); retour.getNodes().add(item); } } // evaluer avec evalNameNode, evalNameCreator, evalNameInitialCreator, evalEntetePasActive, evalPiedPagePasActive // evalNameSequen, evalNamePage if(!sujet.getAttributs().get(k).equals("0")) { //évaluation du nom du node. //Uniquement si pas au travers d'analyseStyle. if(k.equals("evalNameNode") && !sujet.getAttributs().get(k).equals("0")) { if(sujet.retourneParentByNameNode("style:style")!=null) { node nodeStyleStyle = sujet.retourneParentByNameNode("style:style"); if(nodeStyleStyle.getAttributs().get("EvaluerATraversAnalyseStyle")!=null) { if(nodeStyleStyle.getAttributs().get("EvaluerATraversAnalyseStyle").equals("false")) { if(nodeStudent!=null) { retour = evaluationNameNode(retour,nodeStudent, sujet.getNomElt(), sujet.getAttributs().get("evalNameNode"),sujet.getNomElt()); }else { retour = evaluationNameNode(retour,null, sujet.getNomElt(), sujet.getAttributs().get("evalNameNode"),sujet.getNomElt()); } } } }else { if(nodeStudent!=null) { retour = evaluationNameNode(retour,nodeStudent, sujet.getNomElt(), sujet.getAttributs().get("evalNameNode"),sujet.getNomElt()); }else { retour = evaluationNameNode(retour,null, sujet.getNomElt(), sujet.getAttributs().get("evalNameNode"),sujet.getNomElt()); } } } //évaluation du nom du style héridé. if(k.equals("evalNameLegacyStyle") && !sujet.getAttributs().get(k).equals("0")) { retour = evalNameLegacyStyle(sujet,nodeStudent,retour,nameElt); } //évaluation du nom du créateur. if(k.equals("evalNameCreator") && sujet.getNomElt().equals("dc:creator")) { if(nodeStudent!=null) { retour = evaluationNameCreator(retour,nodeStudent, nodeStudent.getContenu().get(0), sujet.getAttributs().get("evalNameCreator"),"Editeur"); }else { retour = evaluationNameCreator(retour,null, "Pas trouvé l'auteur", sujet.getAttributs().get("evalNameCreator"),"Editeur"); } } //évaluation du créateur initial if(k.equals("evalNameInitialCreator") && sujet.getNomElt().equals("meta:initial-creator")) { if(nodeStudent!=null) { retour = evaluationNameInitialCreator(retour,nodeStudent, nodeStudent.getContenu().get(0), sujet.getAttributs().get("evalNameInitialCreator"),"Créateur"); }else { retour = evaluationNameInitialCreator(retour,null, "Pas trouvé le créateur", sujet.getAttributs().get("evalNameInitialCreator"),"Créateur"); } } // evaluer la non activation de l'entête. if(k.equals("evalEntetePasActive") && sujet.getNomElt().equals("style:header-style")) { retour=evalEntetePasActive(sujet, nodeStudent, retour, nameElt); } // evaluer l'activation de l'entête if(k.equals("evalEnteteActive") && sujet.getNomElt().equals("style:header-style")) { retour=evalEnteteActive(sujet, nodeStudent, retour, nameElt); } //evaluer la non activation du pied de page. if(k.equals("evalPiedPagePasActive") && sujet.getNomElt().equals("style:footer-style")) { retour=evalPiedDePagePasActive(sujet, nodeStudent, retour, nameElt); } // evaluer l'activation du pied de page if(k.equals("evalPiedPageActive") && sujet.getNomElt().equals("style:footer-style")) { retour=evalPiedDePageActive(sujet, nodeStudent, retour, nameElt); } // evaluation du nom de la séquence. if(k.equals("evalNameSequence") && sujet.getNomElt().equals("text:sequence-decl")) { if(nodeStudent!=null) { retour = evaluationNameSequence(retour,nodeStudent, sujet.getAttributs().get("text:name"), sujet.getAttributs().get("evalNameSequence"),"Séquence"); }else { retour = evaluationNameSequence(retour,null, "Pas trouvé la séquence", sujet.getAttributs().get("evalNameSequence"),"Séquence"); } } // evaluation du nom de la page if(k.equals("evalNamePage") && sujet.getNomElt().equals("page")) { if(nodeStudent!=null) { retour = evaluationNamePage(retour,nodeStudent, evaluation.withoutCodeAndPointPourRechercheContenuExact(sujet.getAttributs().get("style:master-page-name")), sujet.getAttributs().get("evalNamePage"),"Page"); }else { retour = evaluationNamePage(retour,null, evaluation.withoutCodeAndPointPourRechercheContenuExact(sujet.getAttributs().get("style:master-page-name")), sujet.getAttributs().get("evalNamePage"),"Page"); } } // evaluation de la propriété personnalisé dans la structure du document if(k.equals("evalTextUserDefined")) { if(nodeStudent!=null) { retour = evaluationTextUserDefined(retour,nodeStudent, sujet.getAttributs().get("text:name"), sujet.getAttributs().get("evalTextUserDefined"),"Propriété personnalisé"); }else { retour = evaluationTextUserDefined(retour,null, "Pas trouvé la valeur", sujet.getAttributs().get("evalTextUserDefined"),"Propriété personnalisé"); } } // evaluation du numéro de la page. if(k.equals("evalNumeroPage") && sujet.getNomElt().equals("page")) { if(nodeStudent!=null) { retour = evaluationNumeroPage(retour,nodeStudent, sujet.getAttributs().get("numero"), sujet.getAttributs().get("evalNumeroPage"),"numéro"); }else { retour = evaluationNumeroPage(retour,null, "Pas trouvé la page", sujet.getAttributs().get("evalNumeroPage"),"numéro"); } } // evaluation du numéro absolu de la page. if(k.equals("evalNumeroAbsoluePage") && sujet.getNomElt().equals("page")) { if(nodeStudent!=null) { retour = evaluationNumeroAbsoluePage(retour,nodeStudent, sujet.getAttributs().get("numeroabsolue"), sujet.getAttributs().get("evalNumeroAbsoluePage"),"numéro absolue"); }else { retour = evaluationNumeroAbsoluePage(retour,null, "Pas trouvé la page", sujet.getAttributs().get("evalNumeroAbsoluePage"),"numéro absolue"); } } // evaluation de l'ancrage au numéro absolu de la page. if(k.equals("evalAncrageNumeroAbsoluePage") && listeDesNodesAncrable.isAncrable(sujet)) { if(nodeStudent!=null) { retour = evaluationNumeroAbsoluePage(retour,nodeStudent.retourneNodePage(), sujet.retourneNodePage().getAttributs().get("numeroabsolue"), sujet.getAttributs().get("evalAncrageNumeroAbsoluePage"),"Ancrage"); }else { retour = evaluationNumeroAbsoluePage(retour,null, "Pas trouvé la page", sujet.retourneNodePage().getAttributs().get("numeroabsolue"),"Ancrage"); } } // evaluation du placement du paragraphe if(k.equals("evalPlacement") && listeDesNodesEvalPlacement.isPlacement(sujet)) { retour=evalPlacement(sujet, nodeStudent, retour, nameElt); } //evaluation du premier enfant if(k.equals("evalFirstChild") && listeDesNodesEvalPlacement.isPlacement(sujet)) { if(nodeStudent!=null) { String ReponseSujet = String.valueOf(sujet.isFirstChildNode()); retour = evaluationPremierEnfant(retour,nodeStudent, ReponseSujet, sujet.getAttributs().get("evalFirstChild"),"FirstChild"); }else { retour = evaluationPremierEnfant(retour,null, "true", sujet.getAttributs().get("evalFirstChild"),"FirstChild"); } } //evaluation du dernier enfant if(k.equals("evalLastChild") && listeDesNodesEvalPlacement.isPlacement(sujet)) { if(nodeStudent!=null) { String ReponseSujet = String.valueOf(sujet.isLastChildNode()); retour = evaluationDernierEnfant(retour,nodeStudent, ReponseSujet, sujet.getAttributs().get("evalLastChild"),"LastChild"); }else { retour = evaluationDernierEnfant(retour,null, "true", sujet.getAttributs().get("evalLastChild"),"LastChild"); } } //evaluation de l'absence ou de la présence du formatage direct if(k.equals("evalFormatageDirect") && listeDesNodesFormatageDirect.isFormatageDirect(sujet)) { retour = evalFormatageDirect(sujet,nodeStudent,retour,nameElt); } //evaluation de l'absence ou de la présence du saut de page ou de colonne if(k.equals("evalSautPageColonne") && listeDesNodesFormatageDirect.isFormatageDirect(sujet)) { retour = evalSautPageColonne(sujet,nodeStudent,retour,nameElt); } //evaluation de l'absence de paragraphe vide dans la page if(k.equals("evalPasParagrapheVide") && listeDesNodesPourEvaluerPage.isPage(sujet)) { retour = evalPasParagrapheVide(sujet,nodeStudent,retour,nameElt); } //evaluation du nombre de page maximal if(k.equals("evalNombreDePageMaxi") && sujet.getNomElt().equals("structurepage")) { retour = evalNombreDePageMaxi(sujet,nodeStudent,retour,nameElt); } //evaluation du nombre de page maximal if(k.equals("evalNombreDePageMini") && sujet.getNomElt().equals("structurepage")) { retour = evalNombreDePageMini(sujet,nodeStudent,retour,nameElt); } //evaluation de l'alignement à gauche d'une tabulation. if(k.equals("evalTAB_AlignementAGauche") && sujet.getNomElt().equals("style:tab-stop")) { retour = evalTabAlignGauche(sujet,nodeStudent,retour,nameElt); } //evaluation de la présence ou de l'absence d'un style Parent //uniquement si ce n'est pas au travers d'analyseStyle if(k.equals("evalLegacyStyleParentPresent") && sujet.getNomElt().equals("style:style")) { if(sujet.getAttributs().get("EvaluerATraversAnalyseStyle")==null) { retour = evalPresenceStyleParent(sujet,nodeStudent,retour,nameElt); }else { if(sujet.getAttributs().get("EvaluerATraversAnalyseStyle").equals("false")){ retour = evalPresenceStyleParent(sujet,nodeStudent,retour,nameElt); } } } } } //allContent if(sujet.getAttributs().get("allContent")!=null) if(!sujet.getAttributs().get("allContent").isEmpty()){ retour = allContent(sujet, nodeStudent, retour, nameElt, nameItem); } return retour; } //**************************************************************************** //**************************************************************************** //** LES METHODES LORSQU'ELLES SONT LONGUES ** //**************************************************************************** //**************************************************************************** /** * Méthode allContent.
* Evaluer le contenu textuel d'un node.
* @param sujet : le node sujet. * @param nodeStudent : le node du student. * @param retour : le node contenant les points et les informations de l'évaluation. * @param nameElt : le mon de l'élément évalué. * @return le node retour */ private static node allContent(node sujet, node nodeStudent, node retour, String nameElt, String nameItem) { String points ="‽0"; if(sujet.getAttributs().get("allContent").contains("strict")) points = sujet.getAttributs().get("allContent").replace("strict", "‽"); if(sujet.getAttributs().get("allContent").contains("strictSansEspace")) points = sujet.getAttributs().get("allContent").replace("strictSansEspace", "≡‽"); if(sujet.getAttributs().get("allContent").contains("environ")) points = sujet.getAttributs().get("allContent").replace("environ", "¢‽"); String testPoint = points.substring(points.indexOf("‽")+1, points.length()); boolean pasDeProblem = true; boolean pointSupAUn = false; try { if(Integer.valueOf(testPoint)>=1) pointSupAUn=true; }catch (Exception e) { commandes.message.append("

** ERREUR : "+"Dans le node " + sujet.getNomElt() + ".\nIl y a un problème avec la valeur de l'attribut allContent=\"" + sujet.getAttributs().get("allContent") + "\"" +"

"); System.out.println("Dans le node " + sujet.getNomElt() + ".\nIl y a un problème avec la valeur de l'attribut allContent=\"" + sujet.getAttributs().get("allContent") + "\""); System.out.println(e.toString()); pasDeProblem=false; } if(pasDeProblem && pointSupAUn) { String allContentSujet = evaluation.withoutCodeAndPointPourRechercheContenuExact(sujet.retourneLesContenusEnfants("")) + points; String allContentStudent = "null"; if( nodeStudent!=null) allContentStudent = nodeStudent.retourneLesContenusEnfants(""); node item = retourneNoteAvecResultatsAnalyse(nameItem,"Contenu textuel", allContentStudent, allContentSujet, nameElt); retour.getNodes().add(item); } return retour; } /** * Méthode evalNameLegacyStyle.
* Evaluer le nom du style hérité.
* @param sujet : le node sujet. * @param nodeStudent : le node du student. * @param retour : le node contenant les points et les informations de l'évaluation. * @param nameElt : le mon de l'élément évalué. * @return le node retour */ private static node evalNameLegacyStyle(node sujet, node nodeStudent, node retour, String nameElt) { String nameLegacyStyleSujet = sujet.getAttributs().get("text:style-name"); String point = sujet.getAttributs().get("evalNameLegacyStyle"); Pattern p = Pattern.compile("^P[0-9]{1,}|^T[0-9]{1,}|^L[0-9]{1,}"); if(nameLegacyStyleSujet!=null) { Matcher m = p.matcher(nameLegacyStyleSujet); if(m.find()) { node fichier = sujet.racineDuNode(); node styleParagraphs = fichier.retourneFirstEnfantsByName("style:paragraph").retourneFirstNodeByNameAndAttributValueExactStrict("style:style", "style:name", nameLegacyStyleSujet); if(styleParagraphs!=null) { if(styleParagraphs.getAttributs().get("style:parent-style-name")!=null) { nameLegacyStyleSujet = styleParagraphs.getAttributs().get("style:parent-style-name"); } } } } String nameLegacyStyleStudent=""; if(nodeStudent!=null) { nameLegacyStyleStudent = nodeStudent.getAttributs().get("text:style-name"); if(nameLegacyStyleStudent!=null) { Matcher m = p.matcher(nameLegacyStyleStudent); if(m.find()) { if(nodeStudent.getAttributs().get("text:style-name")!=null) { String nameStyle1 = nodeStudent.getAttributs().get("text:style-name"); node fichier = nodeStudent.racineDuNode(); node styleParagraphs = fichier.retourneFirstEnfantsByName("style:paragraph").retourneFirstNodeByNameAndAttributValueExactStrict("style:style", "style:name", nameStyle1); if(styleParagraphs!=null) { if(styleParagraphs.getAttributs().get("style:parent-style-name")!=null) { nameLegacyStyleStudent = styleParagraphs.getAttributs().get("style:parent-style-name"); } } } } } } if(nodeStudent!=null) { retour = evaluationNameLegacyStyle(retour,nodeStudent, sujet.getNomElt(), point, nameElt, nameLegacyStyleStudent, nameLegacyStyleSujet) ; }else { retour = evaluationNameLegacyStyle(retour,null, sujet.getNomElt(), point, nameElt, nameLegacyStyleStudent, nameLegacyStyleSujet) ; } return retour; } /** * Méthode evalEntetePasActive.
* Evaluer l'absence de node dans le node style:header-style.
* @param sujet : le node sujet. * @param nodeStudent : le node du student. * @param retour : le node contenant les points et les informations de l'évaluation. * @param nameElt : le mon de l'élément évalué. * @return le node retour */ private static node evalEntetePasActive(node sujet, node nodeStudent, node retour, String nameElt) { if(nodeStudent!=null) { String reponseSujet = "non"; String reponseStudent = "non"; if(sujet.getNodes().size()==0) reponseSujet="oui"; if(nodeStudent.getNodes().size()==0) reponseStudent="oui"; retour = evaluationEntetePasActive(retour,reponseStudent,reponseSujet,sujet.getAttributs().get("evalEntetePasActive"),"Entete"); }else { String reponseSujet = "non"; if(sujet.getNodes().size()==0) reponseSujet="oui"; retour = evaluationEntetePasActive(retour,null, reponseSujet, sujet.getAttributs().get("evalEntetePasActive"),"Entete"); } return retour; } /** * Méthode evalEnteteActive.
* Evaluer la présence de node dans style:header-style.
* @param sujet : le node sujet. * @param nodeStudent : le node du student. * @param retour : le node contenant les points et les informations de l'évaluation. * @param nameElt : le mon de l'élément évalué. * @return le node retour */ private static node evalEnteteActive(node sujet, node nodeStudent, node retour, String nameElt) { if(nodeStudent!=null) { String reponseSujet = "non"; String reponseStudent = "non"; if(sujet.getNodes().size()>0) reponseSujet="oui"; if(nodeStudent.getNodes().size()>0) reponseStudent="oui"; retour = evaluationEnteteActive(retour,reponseStudent,reponseSujet,sujet.getAttributs().get("evalEnteteActive"),"Entete"); }else { String reponseSujet = "non"; if(sujet.getNodes().size()>0) reponseSujet="oui"; retour = evaluationEnteteActive(retour,null, reponseSujet, sujet.getAttributs().get("evalEnteteActive"),"Entete"); } return retour; } /** * Méthode evalPiedDePagePasActive.
* Evaluer l'absence de node dans le node style:footer-style.
* @param sujet : le node sujet. * @param nodeStudent : le node du student. * @param retour : le node contenant les points et les informations de l'évaluation. * @param nameElt : le mon de l'élément évalué. * @return le node retour */ private static node evalPiedDePagePasActive(node sujet, node nodeStudent, node retour, String nameElt) { if(nodeStudent!=null) { String reponseSujet = "non"; String reponseStudent = "non"; if(sujet.getNodes().size()==0) reponseSujet="oui"; if(nodeStudent.getNodes().size()==0) reponseStudent="oui"; retour = evaluationPiedPagePasActive(retour,reponseStudent,reponseSujet , sujet.getAttributs().get("evalPiedPagePasActive"),"Pied page"); }else { String reponseSujet = "non"; if(sujet.getNodes().size()==0) reponseSujet="oui"; retour = evaluationPiedPagePasActive(retour,null, reponseSujet, sujet.getAttributs().get("evalPiedPagePasActive"),"Pied page"); } return retour; } /** * Méthode evalPiedDePageActive.
* Evaluer la présence de node dans le node style:header-style.
* @param sujet : le node sujet. * @param nodeStudent : le node du student. * @param retour : le node contenant les points et les informations de l'évaluation. * @param nameElt : le mon de l'élément évalué. * @return le node retour */ private static node evalPiedDePageActive(node sujet, node nodeStudent, node retour, String nameElt) { if(nodeStudent!=null) { String reponseSujet = "non"; String reponseStudent = "non"; if(sujet.getNodes().size()>0) reponseSujet="oui"; if(nodeStudent.getNodes().size()>0) reponseStudent="oui"; retour = evaluationPiedPageActive(retour,reponseStudent,reponseSujet , sujet.getAttributs().get("evalPiedPageActive"),"Pied page"); }else { String reponseSujet = "non"; if(sujet.getNodes().size()>0) reponseSujet="oui"; retour = evaluationPiedPageActive(retour,null, reponseSujet, sujet.getAttributs().get("evalPiedPageActive"),"Pied page"); } return retour; } /** * Méthode Placement;
* Evaluer si le node placé juste avant est le même que dans le sujet.
* @param sujet : le node sujet. * @param nodeStudent : le node du student. * @param retour : le node contenant les points et les informations de l'évaluation. * @param nameElt : le mon de l'élément évalué. * @return le node retour */ private static node evalPlacement(node sujet,node nodeStudent, node retour, String nameElt) { if(nodeStudent!=null) { int calcul = 0; node nodeSujetfrereAvant = sujet.retourneLeNodeFrereAvant(); node nodParentSujet = sujet.getParent(); if(nodParentSujet!=null)if(nodParentSujet.getNomElt().equals("OU")) { nodeSujetfrereAvant = nodParentSujet.retourneLeNodeFrereAvant(); } if(nodeSujetfrereAvant!=null)if(nodeSujetfrereAvant.getNomElt().equals("OU")) { nodeSujetfrereAvant = nodeSujetfrereAvant.getNodes().get(0); } while(nodParentSujet.getNomElt().equals("text:span")) { nodParentSujet = nodParentSujet.getParent(); sujet = sujet.getParent(); } node nodeStudentfereAvant = nodeStudent.retourneLeNodeFrereAvant(); //si le node frère avant est null alors traitement des nodes text:span (formatage local des caractères) if(nodeStudentfereAvant==null) { while(nodeStudent.getParent().getNomElt().equals("text:span")){ nodeStudentfereAvant = nodeStudent.getParent().retourneLeNodeFrereAvant(); nodeStudent = nodeStudent.getParent(); } } if(nodeSujetfrereAvant==null) nodeSujetfrereAvant = new node(); if(nodeStudentfereAvant==null) nodeStudentfereAvant = new node(); String A = nodeSujetfrereAvant.retourneLesContenusEnfants(""); String B = nodeStudentfereAvant.retourneLesContenusEnfants(""); if(A.isEmpty()) A = "Paragraphe vide"; if(B.isEmpty()) B = "Paragraphe vide"; if(!A.isEmpty() && !B.isEmpty()) if(cXML.StringSimilarity.similarity(A, B)>0.92) calcul++; if(calcul==1) { retour = evaluationPlacement(retour,B, A , sujet.getAttributs().get("evalPlacement"),"Placement"); }else { retour = evaluationPlacement(retour,B, A , sujet.getAttributs().get("evalPlacement"),"Placement"); } }else { node nodeSujetAvant = sujet.retourneLeNodeFrereAvant(); if(nodeSujetAvant!=null) { retour = evaluationPlacement(retour,null, nodeSujetAvant.retourneLesContenusEnfants(""), sujet.getAttributs().get("evalPlacement"),"Placement"); }else { retour = evaluationPlacement(retour,null, "", sujet.getAttributs().get("evalPlacement"),"Placement"); } } return retour; } /** * Méthode evalFormatgeDirect.
* Evaluer la présence ou l'absence d'un formatage direct d'un style.
* @param sujet * @param nodeStudent * @param retour * @param nameElt * @return */ private static node evalFormatageDirect(node sujet,node nodeStudent, node retour, String nameElt) { if(nodeStudent!=null) { String nameStyleStudent = "nonStudent"; boolean formatageStudent = false; String nameStyleSujet = "nonSujet"; boolean formatageSujet = false; if(nodeStudent.getAttributs().get("text:style-name")!=null) { nameStyleStudent=nodeStudent.getAttributs().get("text:style-name"); } if(sujet.getAttributs().get("text:style-name")!=null) { nameStyleSujet = sujet.getAttributs().get("text:style-name"); nameStyleSujet = evaluation.withoutCodeAndPointPourRechercheContenuExact(nameStyleSujet); } Pattern p = Pattern.compile("^P[0-9]{1,}$"); Matcher m = p.matcher(nameStyleStudent); if(m.find()) formatageStudent=true; m = p.matcher(nameStyleSujet); if(m.find()) formatageSujet=true; if((formatageSujet && formatageStudent)) { retour = evaluationFormatageDirect(retour,"Présence formatage direct", "Présence formatage direct", sujet.getAttributs().get("evalFormatageDirect"),"Formatage"); } if((!formatageSujet && !formatageStudent)){ retour = evaluationFormatageDirect(retour,"Absence formatage direct", "Absence formatage direct" , sujet.getAttributs().get("evalFormatageDirect"),"Formatage"); } if((formatageSujet && !formatageStudent)){ retour = evaluationFormatageDirect(retour,"Présence formatage direct", "Absence formatage direct" , sujet.getAttributs().get("evalFormatageDirect"),"Formatage"); } if((!formatageSujet && formatageStudent)){ retour = evaluationFormatageDirect(retour,"Absence formatage direct", "Présence formatage direct" , sujet.getAttributs().get("evalFormatageDirect"),"Formatage"); } }else { String nameStyleSujet = "nonSujet"; boolean formatageSujet = false; if(sujet.getAttributs().get("text:style-name")!=null) { nameStyleSujet = sujet.getAttributs().get("text:style-name"); } Pattern p = Pattern.compile("^P[0-9]{1,}$"); Matcher m = p.matcher(nameStyleSujet); if(m.find()) formatageSujet=true; if((formatageSujet)){ retour = evaluationFormatageDirect(retour,null, "Présence formatage direct" , sujet.getAttributs().get("evalFormatageDirect"),"Formatage"); }else { retour = evaluationFormatageDirect(retour,null, "Absence formatage direct" , sujet.getAttributs().get("evalFormatageDirect"),"Formatage"); } } return retour; } /** * Méthode evalSautPageColonne.
* Evaluer la présence ou l'absence d'un saut de page ou de colonne.
* @param sujet * @param nodeStudent * @param retour * @param nameElt * @return */ private static node evalSautPageColonne(node sujet,node nodeStudent, node retour, String nameElt) { if(nodeStudent!=null) { String typeSautStudent = "pas de saut"; String typeSautSujet = "pas de saut"; if(nodeStudent.getAttributs().get("text:style-name")!=null) { String styleName = nodeStudent.getAttributs().get("text:style-name"); node styleStudent = nodeStudent.racineDuNode().retourneFirstEnfantsByName("style:paragraph").retourneFirstNodeByNameAndAttributValueExactStrict("style:style", "style:name", styleName); if(styleStudent!=null) { styleStudent = styleStudent.retourneFirstEnfantsByName("style:paragraph-properties"); if(styleStudent!=null) { if(styleStudent.getAttributs().get("fo:break-before")!=null) { if(styleStudent.getAttributs().get("fo:break-before")!="none") { typeSautStudent = styleStudent.getAttributs().get("fo:break-before"); } } if(styleStudent.getAttributs().get("fo:break-after")!=null) { if(styleStudent.getAttributs().get("fo:break-after")!="none") { typeSautStudent = styleStudent.getAttributs().get("fo:break-after"); } } } } } if(sujet.getAttributs().get("text:style-name")!=null) { String styleName = sujet.getAttributs().get("text:style-name"); node styleSujet = sujet.racineDuNode().retourneFirstEnfantsByName("style:paragraph"); if(styleSujet!=null) { styleSujet = styleSujet.retourneFirstNodeByNameAndAttributValueExactStrict("style:style", "style:name", styleName); if(styleSujet!=null) { styleSujet = styleSujet.retourneFirstEnfantsByName("style:paragraph-properties"); if(styleSujet!=null) { if(styleSujet.getAttributs().get("fo:break-before")!=null) { if(styleSujet.getAttributs().get("fo:break-before")!="none") { typeSautSujet = styleSujet.getAttributs().get("fo:break-before"); } } if(typeSautSujet.equals("pas de saut")) { if(styleSujet.getAttributs().get("fo:break-after")!=null) { if(styleSujet.getAttributs().get("fo:break-after")!="none") { typeSautSujet = styleSujet.getAttributs().get("fo:break-after"); } } } } } } } typeSautSujet = evaluation.withoutCodeAndPointPourRechercheContenuExact(typeSautSujet); if(typeSautSujet.equals("auto")) typeSautSujet="page"; if(typeSautStudent.equals("auto")) typeSautStudent="page"; retour = evaluationSautPageColonne(retour,typeSautStudent, typeSautSujet, sujet.getAttributs().get("evalSautPageColonne"),"Saut"); }else { String typeSautStudent = "pas de saut"; String typeSautSujet = "pas de saut"; if(sujet.getAttributs().get("text:style-name")!=null) { String styleName = sujet.getAttributs().get("text:style-name"); node styleSujet = sujet.racineDuNode().retourneFirstEnfantsByName("style:paragraph"); if(styleSujet!=null) { styleSujet = styleSujet.retourneFirstNodeByNameAndAttributValueExactStrict("style:style", "style:name", styleName); if(styleSujet!=null) { styleSujet = styleSujet.retourneFirstEnfantsByName("style:paragraph-properties"); if(styleSujet!=null) { if(styleSujet.getAttributs().get("fo:break-before")!=null) { typeSautSujet = styleSujet.getAttributs().get("fo:break-before"); typeSautSujet = evaluation.withoutCodeAndPointPourRechercheContenuExact(typeSautSujet); } if(styleSujet.getAttributs().get("fo:break-after")!=null) { typeSautSujet = styleSujet.getAttributs().get("fo:break-after"); typeSautStudent = styleSujet.getAttributs().get("fo:break-after"); } } } } } if(typeSautSujet.equals("auto")) typeSautSujet="page"; retour = evaluationSautPageColonne(retour,typeSautStudent, typeSautSujet, sujet.getAttributs().get("evalSautPageColonne"),"Saut"); } return retour; } /** * * @param sujet * @param nodeStudent * @param retour * @param nameElt * @return */ private static node evalTabAlignGauche(node sujet,node nodeStudent, node retour, String nameElt) { String reponseSujet = "Alignement gauche"; String reponseStudent = "Null"; if(nodeStudent!=null) { if(nodeStudent.getAttributs().get("style:type")==null) { reponseStudent = "Alignement gauche"; }else { reponseStudent = nodeStudent.getAttributs().get("style:type"); } retour = evaluationTabAlignGauche(retour,reponseStudent,reponseSujet , sujet.getAttributs().get("evalTAB_AlignementAGauche"),"Tab alignement gauche"); }else { retour = evaluationTabAlignGauche(retour,null, reponseSujet, sujet.getAttributs().get("evalTAB_AlignementAGauche"),"Tab alignement gauche"); } return retour; } /** * * @param sujet * @param nodeStudent * @param retour * @param nameElt * @return */ private static node evalNombreDePageMaxi(node sujet,node nodeStudent, node retour, String nameElt) { int point = 0; int nombrePage = 1; if(sujet.getAttributs().get("evalNombreDePageMaxi")!=null) { String valeur = sujet.getAttributs().get("evalNombreDePageMaxi"); String A = valeur.substring(0, valeur.lastIndexOf("page")); nombrePage = Integer.valueOf(A); A = valeur.substring(valeur.lastIndexOf("page")+4, valeur.length()); point = Integer.valueOf(A); } String reponseSujet = "Nombre page inférieur ou égal à " +String.valueOf(nombrePage); String reponseStudent = "Nombre page n'est pas inférieur ou égal à " +String.valueOf(nombrePage); if(nodeStudent!=null) { if(nodeStudent.getNodes().size()<=nombrePage) { reponseStudent = "Nombre page inférieur ou égal à " +String.valueOf(nombrePage); } retour = evaluationNombreDePageMaxi(retour,reponseStudent, reponseSujet, String.valueOf(point),"Nombre de page maxi"); }else { retour = evaluationNombreDePageMaxi(retour,reponseStudent, reponseSujet, String.valueOf(point),"Nombre de page maxi"); } return retour; } /** * * @param sujet * @param nodeStudent * @param retour * @param nameElt * @return */ private static node evalNombreDePageMini(node sujet,node nodeStudent, node retour, String nameElt) { int point = 0; int nombrePage = 1; if(sujet.getAttributs().get("evalNombreDePageMini")!=null) { String valeur = sujet.getAttributs().get("evalNombreDePageMini"); String A = valeur.substring(0, valeur.lastIndexOf("page")); nombrePage = Integer.valueOf(A); A = valeur.substring(valeur.lastIndexOf("page")+4, valeur.length()); point = Integer.valueOf(A); } String reponseSujet = "Nombre page supérieur ou égal à " +String.valueOf(nombrePage); String reponseStudent = "Nombre page n'est pas supérieur ou égal à " +String.valueOf(nombrePage); if(nodeStudent!=null) { if(nodeStudent.getNodes().size()>=nombrePage) { reponseStudent = "Nombre page supérieur ou égal à " +String.valueOf(nombrePage); } retour = evaluationNombreDePageMaxi(retour,reponseStudent, reponseSujet, String.valueOf(point),"Nombre de page mini"); }else { retour = evaluationNombreDePageMaxi(retour,reponseStudent, reponseSujet, String.valueOf(point),"Nombre de page mini"); } return retour; } /** * évaluation de la présence d'un style parent hérité. * Présence d'un héritage. * @param sujet * @param nodeStudent * @param retour * @param nameElt * @return */ private static node evalPresenceStyleParent(node sujet,node nodeStudent, node retour, String nameElt) { boolean presentSujet = false; boolean presentStudent = false; int point = 0; if(sujet.getAttributs().get("evalLegacyStyleParentPresent")!=null) { String valeur = sujet.getAttributs().get("evalLegacyStyleParentPresent"); point = Integer.valueOf(valeur); } if(sujet.getAttributs().get("style:parent-style-name")!=null) { presentSujet=true; } if(nodeStudent!=null) { if(nodeStudent.getAttributs().get("style:parent-style-name")!=null) { presentStudent=true; } retour = evaluationLegacyStyleParentPresent(retour,String.valueOf(presentStudent), String.valueOf(presentSujet), String.valueOf(point),"Présence style Parent"); }else { retour = evaluationLegacyStyleParentPresent(retour,"null", String.valueOf(presentSujet), String.valueOf(point),"Présence style Parent"); } return retour; } /** * Méthode evalPasParagrapheVide.
* Evaluer l'absence de paragraphe vide dans la page.
* @param sujet * @param nodeStudent * @param retour * @param nameElt * @return */ private static node evalPasParagrapheVide(node sujet,node nodeStudent, node retour, String nameElt) { if(nodeStudent!=null) { boolean pasParagrapheVideSujet = true; boolean pasParagrapheVideStudent = true; ArrayList LesParagraphes = nodeStudent.retourneEnfantsByName("text:p", new ArrayList()); LesParagraphes = nodeStudent.retourneEnfantsByName("text:h", LesParagraphes); LesParagraphes = nodeStudent.retourneEnfantsByName("text:list", LesParagraphes); LesParagraphes = nodeStudent.retourneEnfantsByName("text:list-item", LesParagraphes); for(int i = 0 ; i < LesParagraphes.size();i++) { if(pasParagrapheVideStudent) { String Texte = LesParagraphes.get(i).retourneLesContenusEnfants(""); Texte = Texte.replace(" ", ""); Texte = Texte.replace("[tab]", ""); Texte = Texte.replace("[text:line-break]", ""); Texte = Texte.replace("[text:s]", ""); if(Texte.isEmpty()) pasParagrapheVideStudent=false; } } LesParagraphes = sujet.retourneEnfantsByName("text:p", new ArrayList()); LesParagraphes = sujet.retourneEnfantsByName("text:h", LesParagraphes); LesParagraphes = sujet.retourneEnfantsByName("text:list", LesParagraphes); LesParagraphes = sujet.retourneEnfantsByName("text:list-item", LesParagraphes); for(int i = 0 ; i < LesParagraphes.size();i++) { if(pasParagrapheVideSujet) { String Texte = LesParagraphes.get(i).retourneLesContenusEnfants(""); Texte = Texte.replace(" ", ""); Texte = Texte.replace("[tab]", ""); Texte = Texte.replace("[text:line-break]", ""); Texte = Texte.replace("[text:s]", ""); if(Texte.isEmpty()) pasParagrapheVideSujet=false; } } String reponsepasVide= "Il n'y a pas de paragraphe vide dans la page."; String reponseVide= "Il y a au moins un paragraphe vide dans la page."; String reponseStudent = ""; String reponseSujet = ""; if(pasParagrapheVideStudent) reponseStudent = reponsepasVide; else reponseStudent = reponseVide; if(pasParagrapheVideSujet) reponseSujet = reponsepasVide; else reponseSujet = reponseVide; retour = evaluationPasParagrapheVide(retour,reponseStudent, reponseSujet, sujet.getAttributs().get("evalPasParagrapheVide"),"Absence paragraphe vide"); }else { boolean pasParagrapheVideSujet = true; ArrayList LesParagraphes = sujet.retourneEnfantsByName("text:p", new ArrayList()); LesParagraphes = sujet.retourneEnfantsByName("text:h", LesParagraphes); LesParagraphes = sujet.retourneEnfantsByName("text:list", LesParagraphes); LesParagraphes = sujet.retourneEnfantsByName("text:list-item", LesParagraphes); for(int i = 0 ; i < LesParagraphes.size();i++) { if(pasParagrapheVideSujet) { String Texte = LesParagraphes.get(i).retourneLesContenusEnfants(""); Texte = Texte.replace(" ", ""); Texte = Texte.replace("[tab]", ""); Texte = Texte.replace("[text:line-break]", ""); Texte = Texte.replace("[text:s]", ""); if(Texte.isEmpty()) pasParagrapheVideSujet=false; } } String reponsepasVide= "Il n'y a pas de paragraphe vide dans la page."; String reponseVide= "Il y a au moins un paragraphe vide dans la page."; String reponseSujet = ""; if(pasParagrapheVideSujet) reponseSujet = reponsepasVide; else reponseSujet = reponseVide; retour = evaluationPasParagrapheVide(retour,null, reponseSujet, sujet.getAttributs().get("evalPasParagrapheVide"),"Absence paragraphe vide"); } return retour; } //*********************************************************************************** //*********************************************************************************** //** Les procédures suivantes sont les évaluations par comparaison avec le sujet ** //*********************************************************************************** //*********************************************************************************** /** * Evaluation le nom du node.
* @param retour : le node retour qui contient l'item ajouté * @param nodStudent : le node Student qui peut être null * @param nameNode : le nom du node * @param point : les points * @param nameElt : le nom de l'élément * @return */ private static node evaluationNameNode(node retour, node nodStudent, String nameNode, String point, String nameElt) { node item = null; if(nodStudent!=null) { item = retourneNoteAvecResultatsAnalyse(nameNode,"name", nodStudent.getNomElt(),nameNode + "‽" +point, nameElt ); }else { evaluation.IncrementPointTotal(Integer.valueOf(point)); item = new node(nameNode, "Erreur : -"+evaluation.getPointEnJeu()+" pt", "Nom du node" , "null", nameNode, 2, evaluation.getPointEnJeu(),nameElt); } retour.getNodes().add(item); return retour; } /** * Evaluation du nom du style hérité.
*
* @param retour : node retour pour le node d'analyse ana:xxx * @param nodStudent : node Student * @param nameNode : nom du node * @param point : point mise en jeu. * @param nameElt : nom de l'élément pour le feedback (attribut) * @param nameStyleLegacyStudent : Contenu textuel (le nom du style hérité de l'étudiant) * @param nameStyleLegacySujet : Contenu textuel (le nom du style hérité du sujet) * @return */ private static node evaluationNameLegacyStyle(node retour,node nodStudent, String nameNode, String point, String nameElt, String nameStyleLegacyStudent, String nameStyleLegacySujet) { node item = null; if(nodStudent!=null) { item = retourneNoteAvecResultatsAnalyse(nameNode,"style heritage", nameStyleLegacyStudent, nameStyleLegacySujet + "‽" + point, nameElt); }else { evaluation.IncrementPointTotal(Integer.valueOf(point)); item = new node(nameNode, "Erreur : -"+evaluation.getPointEnJeu()+" pt", "style heritage" , "null", nameStyleLegacySujet, 2, evaluation.getPointEnJeu(),nameElt); } retour.getNodes().add(item); return retour; } /** * Evaluation. Si le node style:header-style ne possède pas d'attribut alors l'entete n'est pas activé.
* Le nombre d'attribut est null. * @param retour * @param nodStudent * @param nameNode * @param point * @param nameElt * @return */ private static node evaluationEntetePasActive(node retour, String nbAttributStudent, String nbAttribut, String point, String nameElt) { node item = null; if(nbAttributStudent!=null) { item = retourneNoteAvecResultatsAnalyse(nbAttribut,"pas active", nbAttributStudent,nbAttribut + "‽" +point, nameElt ); }else { evaluation.IncrementPointTotal(Integer.valueOf(point)); item = new node(nbAttribut, "Erreur", "pas active" , "null", nbAttribut, 2, evaluation.getPointEnJeu(),nameElt); } retour.getNodes().add(item); return retour; } /** * Evaluation. Si le node style:header-style possède des ou un attribut alors l'entete est activé.
* @param retour * @param nbAttributStudent * @param nbAttribut * @param point * @param nameElt * @return */ private static node evaluationEnteteActive(node retour, String nbAttributStudent, String nbAttribut, String point, String nameElt) { node item = null; if(nbAttributStudent!=null) { item = retourneNoteAvecResultatsAnalyse(nbAttribut,"active", nbAttributStudent,nbAttribut + "‽" +point, nameElt ); }else { evaluation.IncrementPointTotal(Integer.valueOf(point)); item = new node(nbAttribut, "Erreur", "active" , "null", nbAttribut, 2, evaluation.getPointEnJeu(),nameElt); } retour.getNodes().add(item); return retour; } /** * Evaluation. Si le node style:footer-style ne possède pas d'attribut alors l'entete n'est pas activé.
* @param retour * @param nbAttributStudent * @param nbAttribut * @param point * @param nameElt * @return */ private static node evaluationPiedPagePasActive(node retour, String nbAttributStudent, String nbAttribut, String point, String nameElt) { node item = null; if(nbAttributStudent!=null) { item = retourneNoteAvecResultatsAnalyse(nbAttribut,"pas active", nbAttributStudent,nbAttribut + "‽" +point, nameElt ); }else { evaluation.IncrementPointTotal(Integer.valueOf(point)); item = new node(nbAttribut, "Erreur", "pas active" , "null", nbAttribut, 2, evaluation.getPointEnJeu(),nameElt); } retour.getNodes().add(item); return retour; } /** * Evaluation. Si le node style:footer-style possède des ou un attribut alors l'entete est activé.
* @param retour * @param nbAttributStudent * @param nbAttribut * @param point * @param nameElt * @return */ private static node evaluationPiedPageActive(node retour, String nbAttributStudent, String nbAttribut, String point, String nameElt) { node item = null; if(nbAttributStudent!=null) { item = retourneNoteAvecResultatsAnalyse(nbAttribut,"active", nbAttributStudent,nbAttribut + "‽" +point, nameElt ); }else { evaluation.IncrementPointTotal(Integer.valueOf(point)); item = new node(nbAttribut, "Erreur", "active" , "null", nbAttribut, 2, evaluation.getPointEnJeu(),nameElt); } retour.getNodes().add(item); return retour; } /** * * @param retour * @param nbAttributStudent * @param nbAttribut * @param point * @param nameElt * @return */ private static node evaluationTabAlignGauche(node retour, String AttributStudent, String AttributSujet, String point, String nameElt) { node item = null; if(AttributStudent!=null) { item = retourneNoteAvecResultatsAnalyse(AttributSujet,"Gauche", AttributStudent,AttributSujet + "‽" +point, nameElt ); }else { evaluation.IncrementPointTotal(Integer.valueOf(point)); item = new node(AttributSujet, "Erreur", "Gauche" , "null", AttributSujet, 2, evaluation.getPointEnJeu(),nameElt); } retour.getNodes().add(item); return retour; } /** * Evaluation le champ auteur (éditeur). * @param retour * @param nodStudent * @param nameCreator * @param point * @param nameElt * @return */ private static node evaluationNameCreator(node retour, node nodStudent, String nameCreator, String point, String nameElt) { node item = null; if(nodStudent!=null) { String reponseSujet = nameCreator; String reponseStudent = nodStudent.getAttributs().get("creator"); if(reponseStudent!=null) if(!reponseStudent.isEmpty()) { reponseStudent = reponseStudent.replace(".odt", ""); reponseStudent = reponseStudent.toLowerCase(); } nameCreator = nameCreator.toLowerCase(); if(reponseStudent.contains(nameCreator)) { reponseStudent = "auteur créateur "+ nameCreator + " identifié dans le nom du fichier."; reponseSujet = "auteur créateur "+ nameCreator + " identifié dans le nom du fichier."; }else { reponseStudent = "auteur créateur "+ nameCreator + " n'est pas identifié dans le nom du fichier."; } item = retourneNoteAvecResultatsAnalyse(nameCreator,"name", reponseStudent,reponseSujet+ "‽" +point, nameElt ); }else { evaluation.IncrementPointTotal(Integer.valueOf(point)); item = new node(nameCreator, "Erreur", "Nom du l'éditeur" , "null", nameCreator, 2, evaluation.getPointEnJeu(),nameElt); } retour.getNodes().add(item); return retour; } /** * Evaluation le nom de l'auteur (créateur ou premier auteur).
* @param retour * @param nodStudent * @param nameCreator * @param point * @param nameElt * @return */ private static node evaluationNameInitialCreator(node retour, node nodStudent, String nameCreator, String point, String nameElt) { node item = null; if(nodStudent!=null) { item = retourneNoteAvecResultatsAnalyse(nameCreator,"name", nodStudent.getContenu().get(0),nameCreator + "↑‽" +point, nameElt ); }else { evaluation.IncrementPointTotal(Integer.valueOf(point)); item = new node(nameCreator, "Erreur", "Nom du créateur" , "null", nameCreator, 2, evaluation.getPointEnJeu(),nameElt); } retour.getNodes().add(item); return retour; } /** * Evaluation du nom de la séquence.
* @param retour * @param nodStudent * @param nameSequence * @param point * @param nameElt * @return */ private static node evaluationNameSequence(node retour, node nodStudent, String nameSequence, String point, String nameElt) { node item = null; if(nodStudent!=null) { item = retourneNoteAvecResultatsAnalyse(nameSequence,"name", nodStudent.getAttributs().get("text:name"),nameSequence + "↑‽" +point, nameElt ); }else { evaluation.IncrementPointTotal(Integer.valueOf(point)); item = new node(nameSequence, "Erreur", "Nom de la séquence" , "null", nameSequence, 2, evaluation.getPointEnJeu(),nameElt); } retour.getNodes().add(item); return retour; } /** * evaluation du nom de la page.
* @param retour * @param nodStudent * @param namePage * @param point * @param nameElt * @return */ private static node evaluationNamePage(node retour, node nodStudent, String namePage, String point, String nameElt) { node item = null; if(nodStudent!=null) { item = retourneNoteAvecResultatsAnalyse(namePage,"name", nodStudent.getAttributs().get("style:master-page-name"),namePage + "↑‽" +point, nameElt ); }else { evaluation.IncrementPointTotal(Integer.valueOf(point)); item = new node(namePage, "Erreur", "Nom de la page" , "null", namePage, 2, evaluation.getPointEnJeu(),nameElt); } retour.getNodes().add(item); return retour; } /** * Evaluation de la valeur de la propriété personalisée dans la structure ("text:name") de text:user-defined.
* @param retour * @param nodStudent * @param textUserDefined * @param point * @param nameElt * @return */ private static node evaluationTextUserDefined(node retour, node nodStudent, String textUserDefined, String point, String nameElt) { node item = null; if(nodStudent!=null) { item = retourneNoteAvecResultatsAnalyse(textUserDefined,"valeur", nodStudent.getAttributs().get("text:name"),textUserDefined + "╬‽" +point, nameElt ); }else { evaluation.IncrementPointTotal(Integer.valueOf(point)); item = new node(textUserDefined, "Erreur", "valeur de la propriété" , "null", textUserDefined, 2, evaluation.getPointEnJeu(),nameElt); } retour.getNodes().add(item); return retour; } /** * Evaluation du numéro de la page.
*
* @param retour * @param nodStudent * @param numeroPage * @param point * @param nameElt * @return */ private static node evaluationNumeroPage(node retour, node nodStudent, String numeroPage, String point, String nameElt) { node item = null; if(nodStudent!=null) { item = retourneNoteAvecResultatsAnalyse(numeroPage,"numéro", nodStudent.getAttributs().get("numero"),numeroPage + "‽" +point, nameElt ); }else { evaluation.IncrementPointTotal(Integer.valueOf(point)); item = new node(numeroPage, "Erreur", "Numéro de la page" , "null", numeroPage, 2, evaluation.getPointEnJeu(),nameElt); } retour.getNodes().add(item); return retour; } /** * Evaluation du numéro absolu de la page.
*
* @param retour * @param nodStudent * @param numeroAbsoluePage * @param point * @param nameElt * @return */ private static node evaluationNumeroAbsoluePage(node retour, node nodStudent, String numeroAbsoluePage, String point, String nameElt) { node item = null; if(nodStudent!=null) { item = retourneNoteAvecResultatsAnalyse(numeroAbsoluePage,"numéro absolue", "page "+nodStudent.getAttributs().get("numeroabsolue"),"page "+numeroAbsoluePage + "‽" +point, nameElt ); }else { evaluation.IncrementPointTotal(Integer.valueOf(point)); item = new node(numeroAbsoluePage, "Erreur", "Numéro de la page absolue" , "null", "page "+numeroAbsoluePage, 2, evaluation.getPointEnJeu(),nameElt); } retour.getNodes().add(item); return retour; } /** * Evaluation du placement du node par rapport au précédent.
* @param retour * @param nodStudent * @param contenuParagraph * @param point * @param nameElt * @return */ private static node evaluationPlacement(node retour, String contenuParagraphStudentAvant, String contenuParagraphSujetAvant, String point, String nameElt) { node item = null; if(contenuParagraphStudentAvant!=null) { //compare la même valeur "contenuParagraph" pour obtenir les points mais si un voisinage du contenu. item = retourneNoteAvecResultatsAnalyse("Placement","avant", contenuParagraphStudentAvant , contenuParagraphSujetAvant + "╬‽" +point, nameElt ); }else { evaluation.IncrementPointTotal(Integer.valueOf(point)); item = new node("Placement", "Erreur : -"+ point, "avant" , "null", contenuParagraphSujetAvant , 2, evaluation.getPointEnJeu(),nameElt); } retour.getNodes().add(item); return retour; } /** * * @param retour * @param contenuParagraphStudentAvant * @param contenuParagraphSujetAvant * @param point * @param nameElt * @return */ private static node evaluationFormatageDirect(node retour, String formatStudent, String FormatSujet, String point, String nameElt) { node item = null; if(formatStudent!=null) { //compare la même valeur "contenuParagraph" pour obtenir les points mais si un voisinage du contenu. item = retourneNoteAvecResultatsAnalyse("Formatage","paragraphe", formatStudent , FormatSujet + "‽" +point, nameElt ); }else { evaluation.IncrementPointTotal(Integer.valueOf(point)); item = new node("Formatage", "Erreur : -"+ point, "paragraphe" , "null", FormatSujet , 2, evaluation.getPointEnJeu(),nameElt); } retour.getNodes().add(item); return retour; } /** * * @param retour * @param formatStudent * @param FormatSujet * @param point * @param nameElt * @return */ private static node evaluationSautPageColonne(node retour, String sautStudent, String sautSujet, String point, String nameElt) { node item = null; if(sautStudent!=null) { //compare la même valeur "contenuParagraph" pour obtenir les points mais si un voisinage du contenu. item = retourneNoteAvecResultatsAnalyse("Saut","", sautStudent , sautSujet + "‽" +point, nameElt ); }else { evaluation.IncrementPointTotal(Integer.valueOf(point)); item = new node("Saut", "Erreur : -"+ point, "" , "null", sautSujet , 2, evaluation.getPointEnJeu(),nameElt); } retour.getNodes().add(item); return retour; } /** * * @param retour * @param reponseStudent * @param reponseSujet * @param point * @param nameElt * @return */ private static node evaluationNombreDePageMaxi(node retour, String reponseStudent, String reponseSujet, String point, String nameElt) { node item = null; if(reponseStudent!=null) { //compare la même valeur "contenuParagraph" pour obtenir les points mais si un voisinage du contenu. item = retourneNoteAvecResultatsAnalyse("Absence","", reponseStudent , reponseSujet + "‽" +point, nameElt ); }else { evaluation.IncrementPointTotal(Integer.valueOf(point)); item = new node("Absence", "Erreur : -"+ point, "" , "null", reponseSujet , 2, evaluation.getPointEnJeu(),nameElt); } retour.getNodes().add(item); return retour; } /** * * @param retour * @param reponseStudent * @param reponseSujet * @param point * @param nameElt * @return */ private static node evaluationLegacyStyleParentPresent(node retour, String reponseStudent, String reponseSujet, String point, String nameElt) { node item = null; if(reponseStudent!=null) { //compare la même valeur "contenuParagraph" pour obtenir les points mais si un voisinage du contenu. item = retourneNoteAvecResultatsAnalyse("Présence Style Parent","", reponseStudent , reponseSujet + "‽" +point, nameElt ); }else { evaluation.IncrementPointTotal(Integer.valueOf(point)); item = new node("Présence Style Parent", "Erreur : -"+ point, "" , "null", reponseSujet , 2, evaluation.getPointEnJeu(),nameElt); } retour.getNodes().add(item); return retour; } /** * * @param retour * @param sautStudent * @param sautSujet * @param point * @param nameElt * @return */ private static node evaluationPasParagrapheVide(node retour, String reponseStudent, String reponseSujet, String point, String nameElt) { node item = null; if(reponseStudent!=null) { //compare la même valeur "contenuParagraph" pour obtenir les points mais si un voisinage du contenu. item = retourneNoteAvecResultatsAnalyse("Absence","", reponseStudent , reponseSujet + "‽" +point, nameElt ); }else { evaluation.IncrementPointTotal(Integer.valueOf(point)); item = new node("Absence", "Erreur : -"+ point, "" , "null", reponseSujet , 2, evaluation.getPointEnJeu(),nameElt); } retour.getNodes().add(item); return retour; } /** * Evaluation du dernier enfant.
* @param retour * @param nodStudent * @param contenuParagraph * @param point * @param nameElt * @return */ private static node evaluationDernierEnfant(node retour, node nodStudent, String reponseSujet, String point, String nameElt) { node item = null; if(nodStudent!=null) { item = retourneNoteAvecResultatsAnalyse("LastChild","", String.valueOf(nodStudent.isLastChildNode()),reponseSujet + "‽" +point, nameElt ); }else { evaluation.IncrementPointTotal(Integer.valueOf(point)); item = new node("LastChild", "Erreur : -"+ point, "" , "null", reponseSujet, 2, evaluation.getPointEnJeu(),nameElt); } retour.getNodes().add(item); return retour; } /** * Evaluation du premier enfant.
* @param retour * @param nodStudent * @param reponseSujet * @param point * @param nameElt * @return */ private static node evaluationPremierEnfant(node retour, node nodStudent, String reponseSujet, String point, String nameElt) { node item = null; if(nodStudent!=null) { item = retourneNoteAvecResultatsAnalyse("FirstChild","", String.valueOf(nodStudent.isFirstChildNode()),reponseSujet + "‽" +point, nameElt ); }else { evaluation.IncrementPointTotal(Integer.valueOf(point)); item = new node("FirstChild", "Erreur : -"+ point, "" , "null", reponseSujet, 2, evaluation.getPointEnJeu(),nameElt); } retour.getNodes().add(item); return retour; } //************************************************************************ //************************************************************************ //** LA COMPARISON ** //************************************************************************ //************************************************************************ /** * Retourne le node avec les résultats de la comparaison entre les deux valeurs (étudiant et sujet).
*
* @param nameNode : nom du node de retour. * @param Tst (résultat de la comparaison) * @param property : le nom de l'attribut. * @param valueAttributStudent : la valeur de l'attribut de student. * @param valueAttributSujet : la valeur de l'attribut du sujet. * @return */ public static node retourneNoteAvecResultatsAnalyse(String nameNode, String property, String valueStudent, String valueSujet, String nameElt) { String Tst = evaluation.Compare(valueStudent, valueSujet); int niveau = 3; if(Tst.contains("Correct")) niveau = 1; if(Tst.contains("Erreur")) niveau = 2; valueStudent = evaluation.remplaceCaracteresCodageAttribut(valueStudent); valueSujet = evaluation.remplaceCaracteresCodageAttribut(valueSujet); node item = new node(nameNode, Tst, property , valueStudent, valueSujet, niveau, evaluation.getPointEnJeu(),nameElt); return item; } }