package evaluer; import java.util.Enumeration; import java.util.regex.Matcher; import java.util.regex.Pattern; import cXML.node; import list.listeAttributsAnalyseWriter; import list.listeDesNodesEvalPlacement; public class evaluationAttribut { /** * 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é. * @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; 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); } } } if(nodeStyleParagraphStudent!=null) { if(nodeStyleParagraphSujet.retourneEnfantsByNameExist("style:paragraph-properties") && nodeStyleParagraphStudent.retourneEnfantsByNameExist("style:paragraph-properties") ) { node propertiesSujet = nodeStyleParagraphSujet.retourneFirstEnfantsByName("style:paragraph-properties"); if(propertiesSujet.getAttributs().get("evaluer")!=null) { if(propertiesSujet.getAttributs().get("evaluer").equals("true")) { node propertiesStudent = nodeStyleParagraphStudent.retourneFirstEnfantsByName("style:paragraph-properties"); key = propertiesSujet.getAttributs().keys(); while(key.hasMoreElements()) { String k = key.nextElement(); if(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,"style:paragraph-properties"); retour.getNodes().add(item); }else { String valueAttributStudent = "null"; String valueAttributSujet = propertiesSujet.getAttributs().get(k).replace("‼", "‽"); node item = retourneNoteAvecResultatsAnalyse(nameItem, k, valueAttributStudent, valueAttributSujet,"style:paragraph-properties"); retour.getNodes().add(item); } } } } } } }else { node propertiesSujet = nodeStyleParagraphSujet.retourneFirstEnfantsByName("style:paragraph-properties"); if(propertiesSujet.getAttributs().get("evaluer")!=null) { if(propertiesSujet.getAttributs().get("evaluer").equals("true")) { 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,"style:paragraph-properties"); retour.getNodes().add(item); } } } } } if(nodeStyleParagraphStudent!=null) { if(nodeStyleParagraphSujet.retourneEnfantsByNameExist("style:text-properties") && nodeStyleParagraphStudent.retourneEnfantsByNameExist("style:text-properties") ) { node propertiesSujet = nodeStyleParagraphSujet.retourneFirstEnfantsByName("style:text-properties"); if(propertiesSujet.getAttributs().get("evaluer")!=null) { if(propertiesSujet.getAttributs().get("evaluer").equals("true")) { node propertiesStudent = nodeStyleParagraphStudent.retourneFirstEnfantsByName("style:text-properties"); key = propertiesSujet.getAttributs().keys(); while(key.hasMoreElements()) { String k = key.nextElement(); if(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,"style:text-properties"); retour.getNodes().add(item); }else { String valueAttributStudent = "null"; String valueAttributSujet = propertiesSujet.getAttributs().get(k).replace("‼", "‽"); node item = retourneNoteAvecResultatsAnalyse(nameItem, k, valueAttributStudent, valueAttributSujet,"style:text-properties"); retour.getNodes().add(item); } } } } } } }else { node propertiesSujet = nodeStyleParagraphSujet.retourneFirstEnfantsByName("style:text-properties"); if(propertiesSujet.getAttributs().get("evaluer")!=null) { if(propertiesSujet.getAttributs().get("evaluer").equals("true")) { 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,"style:text-properties"); retour.getNodes().add(item); } } } } } return retour; } /** * 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")) { if(k.equals("evalNameNode") && !sujet.getAttributs().get(k).equals("0")) { if(nodeStudent!=null) { retour = evaluNameNode(retour,nodeStudent, sujet.getNomElt(), sujet.getAttributs().get("evalNameNode"),sujet.getNomElt()); }else { retour = evaluNameNode(retour,null, sujet.getNomElt(), sujet.getAttributs().get("evalNameNode"),sujet.getNomElt()); } } if(k.equals("evalNameLegacyStyle") && !sujet.getAttributs().get(k).equals("0")) { String nameLegacyStyleSujet = sujet.getAttributs().get("text:style-name"); String point = sujet.getAttributs().get(k); 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 = evaluNameLegacyStyle(retour,nodeStudent, sujet.getNomElt(), point, nameElt, nameLegacyStyleStudent, nameLegacyStyleSujet) ; }else { retour = evaluNameLegacyStyle(retour,null, sujet.getNomElt(), point, nameElt, nameLegacyStyleStudent, nameLegacyStyleSujet) ; } } if(k.equals("evalNameCreator") && sujet.getNomElt().equals("dc:creator")) { if(nodeStudent!=null) { retour = evaluNameCreator(retour,nodeStudent, nodeStudent.getContenu().get(0), sujet.getAttributs().get("evalNameCreator"),"Editeur"); }else { retour = evaluNameCreator(retour,null, "Pas trouvé l'auteur", sujet.getAttributs().get("evalNameCreator"),"Editeur"); } } if(k.equals("evalNameInitialCreator") && sujet.getNomElt().equals("meta:initial-creator")) { if(nodeStudent!=null) { retour = evaluNameInitialCreator(retour,nodeStudent, nodeStudent.getContenu().get(0), sujet.getAttributs().get("evalNameInitialCreator"),"Créateur"); }else { retour = evaluNameInitialCreator(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")) { if(nodeStudent!=null) { int nbA=0; int nbAs=0; String reponseSujet = "oui"; String reponseStudent = "oui"; Enumeration key1 = sujet.getAttributs().keys(); while(key1.hasMoreElements()) { String k1 = key1.nextElement(); if(listeAttributsAnalyseWriter.isAttributAnalyseWriter(k1)) nbA++; } if(nbA<=0) reponseSujet = "non"; key1 = nodeStudent.getAttributs().keys(); while(key1.hasMoreElements()) { String k1 = key1.nextElement(); if(listeAttributsAnalyseWriter.isAttributAnalyseWriter(k1)) nbAs++; } if(nbAs<=0)reponseStudent = "non"; retour = evaluEntetePasActive(retour,reponseStudent,reponseSujet,sujet.getAttributs().get("evalEntetePasActive"),"Entete"); }else { retour = evaluEntetePasActive(retour,null, "Pas trouvé le node de l'étudiant", sujet.getAttributs().get("evalEntetePasActive"),"Entete"); } } // evaluer l'activation de l'entête if(k.equals("evalEnteteActive") && sujet.getNomElt().equals("style:header-style")) { if(nodeStudent!=null) { int nbAs=0; String reponseSujet = "oui"; String reponseStudent = "oui"; Enumeration key1 = sujet.getAttributs().keys(); key1 = nodeStudent.getAttributs().keys(); while(key1.hasMoreElements()) { String k1 = key1.nextElement(); if(listeAttributsAnalyseWriter.isAttributAnalyseWriter(k1)) nbAs++; } if(nbAs<=0)reponseStudent = "non"; retour = evaluEnteteActive(retour,reponseStudent,reponseSujet,sujet.getAttributs().get("evalEnteteActive"),"Entete"); }else { retour = evaluEnteteActive(retour,null, "Pas trouvé le node de l'étudiant", sujet.getAttributs().get("evalEnteteActive"),"Entete"); } } //evaluer la non activation du pied de page. if(k.equals("evalPiedPagePasActive") && sujet.getNomElt().equals("style:footer-style")) { if(nodeStudent!=null) { int nbA=0; int nbAs=0; String reponseSujet = "oui"; String reponseStudent = "oui"; Enumeration key1 = sujet.getAttributs().keys(); while(key1.hasMoreElements()) { String k1 = key1.nextElement(); if(listeAttributsAnalyseWriter.isAttributAnalyseWriter(k1)) nbA++; } if(nbA==0) reponseSujet = "non"; key1 = nodeStudent.getAttributs().keys(); while(key1.hasMoreElements()) { String k1 = key1.nextElement(); if(listeAttributsAnalyseWriter.isAttributAnalyseWriter(k1)) nbAs++; } if(nbAs==0)reponseStudent = "non"; retour = evaluPiedPagePasActive(retour,reponseStudent,reponseSujet , sujet.getAttributs().get("evalPiedPagePasActive"),"Pied page"); }else { retour = evaluPiedPagePasActive(retour,null, "Pas trouvé le node de l'étudiant", sujet.getAttributs().get("evalPiedPagePasActive"),"Pied page"); } } // evaluer l'activation du pied de page if(k.equals("evalPiedPageActive") && sujet.getNomElt().equals("style:footer-style")) { if(nodeStudent!=null) { int nbAs=0; String reponseSujet = "oui"; String reponseStudent = "oui"; Enumeration key1 = sujet.getAttributs().keys(); key1 = nodeStudent.getAttributs().keys(); while(key1.hasMoreElements()) { String k1 = key1.nextElement(); if(listeAttributsAnalyseWriter.isAttributAnalyseWriter(k1)) nbAs++; } if(nbAs<=0)reponseStudent = "non"; retour = evaluPiedPageActive(retour,reponseStudent,reponseSujet , sujet.getAttributs().get("evalPiedPageActive"),"Pied page"); }else { retour = evaluPiedPageActive(retour,null, "Pas trouvé le node de l'étudiant", sujet.getAttributs().get("evalPiedPageActive"),"Pied page"); } } // evaluation du nom de la séquence. if(k.equals("evalNameSequence") && sujet.getNomElt().equals("text:sequence-decl")) { if(nodeStudent!=null) { retour = evaluNameSequence(retour,nodeStudent, sujet.getAttributs().get("text:name"), sujet.getAttributs().get("evalNameSequence"),"Séquence"); }else { retour = evaluNameSequence(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 = evaluNamePage(retour,nodeStudent, sujet.getAttributs().get("style:master-page-name"), sujet.getAttributs().get("evalNamePage"),"Page"); }else { retour = evaluNamePage(retour,null, "Pas trouvé la page", sujet.getAttributs().get("evalNamePage"),"Page"); } } // evaluation de la propriété personnalisé dans la structure du document if(k.equals("evalTextUserDefined") && sujet.getNomElt().equals("text:user-defined") && sujet.chemin().contains("structurepage")) { if(nodeStudent!=null) { retour = evaluTextUserDefined(retour,nodeStudent, sujet.getAttributs().get("text:name"), sujet.getAttributs().get("evalTextUserDefined"),"Propriété personnalisé"); }else { retour = evaluTextUserDefined(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 = evaluNumeroPage(retour,nodeStudent, sujet.getAttributs().get("numero"), sujet.getAttributs().get("evalNumeroPage"),"numéro"); }else { retour = evaluNumeroPage(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 = evaluNumeroAbsoluePage(retour,nodeStudent, sujet.getAttributs().get("numeroabsolue"), sujet.getAttributs().get("evalNumeroAbsoluePage"),"numéro absolue"); }else { retour = evaluNumeroAbsoluePage(retour,null, "Pas trouvé la page", sujet.getAttributs().get("evalNumeroAbsoluePage"),"numéro absolue"); } } // evaluation du placement du paragraphe if(k.equals("evalPlacement") && listeDesNodesEvalPlacement.isPlacement(sujet)) { if(nodeStudent!=null) { int calcul = 0; node nodeSujetfrereAvant = sujet.retourneLeNodeFrereAvant(); node nodeStudentfereAvant = nodeStudent.retourneLeNodeFrereAvant(); if(nodeSujetfrereAvant==null) nodeSujetfrereAvant = new node(); if(nodeStudentfereAvant==null) nodeStudentfereAvant = new node(); String A = nodeSujetfrereAvant.retourneLesContenusEnfants(""); String B = nodeStudentfereAvant.retourneLesContenusEnfants(""); if(A.isEmpty() && B.isEmpty()) calcul++; if(!A.isEmpty() && !B.isEmpty()) if(cXML.StringSimilarity.similarity(A, B)>0.92) calcul++; if(calcul==1) { retour = evaluPlacement(retour,nodeStudent, sujet.retourneLesContenusEnfants(""), sujet.getAttributs().get("evalPlacement"),"Placement"); }else { retour = evaluPlacement(retour,null, sujet.retourneLesContenusEnfants(""), sujet.getAttributs().get("evalPlacement"),"Placement"); } }else { node nodeSujetAvant = sujet.retourneLeNodeFrereAvant(); retour = evaluPlacement(retour,null, nodeSujetAvant.retourneLesContenusEnfants(""), sujet.getAttributs().get("evalPlacement"),"Placement"); } } } } //avec l'attribut allContent="strict1", allContent="strictSansEspace1" et allContent="environ1" // il faut ajouter une méthode pour ignorer la casse if(sujet.getAttributs().get("allContent")!=null) if(!sujet.getAttributs().get("allContent").isEmpty()){ 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) { 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; } /** * Evalue 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 evaluNameNode(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 dy style hérité de l'étudiant) * @param nameStyleLegacySujet : Contenu textuel (le nom dy style hérité du sujet) * @return */ private static node evaluNameLegacyStyle(node retour,node nodStudent, String nameNode, String point, String nameElt, String nameStyleLegacyStudent, String nameStyleLegacySujet) { node item = null; if(nodStudent!=null) { item = retourneNoteAvecResultatsAnalyse(nameNode,"style hérité", nameStyleLegacyStudent, nameStyleLegacySujet + "‽" + point, nameElt); }else { evaluation.IncrementPointTotal(Integer.valueOf(point)); item = new node(nameNode, "Erreur : -"+evaluation.getPointEnJeu()+" pt", "style hérité" , "null", nameStyleLegacySujet, 2, evaluation.getPointEnJeu(),nameElt); } retour.getNodes().add(item); return retour; } /** * 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 evaluEntetePasActive(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; } /** * 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 evaluEnteteActive(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; } /** * 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 evaluPiedPagePasActive(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; } /** * 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 evaluPiedPageActive(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; } /** * Evalue le champ auteur (éditeur). * @param retour * @param nodStudent * @param nameCreator * @param point * @param nameElt * @return */ private static node evaluNameCreator(node retour, node nodStudent, String nameCreator, String point, String nameElt) { node item = null; if(nodStudent!=null) { item = retourneNoteAvecResultatsAnalyse(nameCreator,"name", nodStudent.getAttributs().get("creator"),nameCreator + "↑‽" +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; } /** * Evalue le nom de l'auteur (créateur ou premier auteur) * @param retour * @param nodStudent * @param nameCreator * @param point * @param nameElt * @return */ private static node evaluNameInitialCreator(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; } /** * Evalue le nom de la séquence. * @param retour * @param nodStudent * @param nameSequence * @param point * @param nameElt * @return */ private static node evaluNameSequence(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; } /** * evalue le nom de la page. * @param retour * @param nodStudent * @param namePage * @param point * @param nameElt * @return */ private static node evaluNamePage(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; } /** * Evaluer 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 evaluTextUserDefined(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; } /** * Méthode permettant d'évaluer le numéro de la page.
*
* @param retour * @param nodStudent * @param numeroPage * @param point * @param nameElt * @return */ private static node evaluNumeroPage(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; } /** * Méthode permettant d'évaluer le numéro absolu de la page.
*
* @param retour * @param nodStudent * @param numeroAbsoluePage * @param point * @param nameElt * @return */ private static node evaluNumeroAbsoluePage(node retour, node nodStudent, String numeroAbsoluePage, String point, String nameElt) { node item = null; if(nodStudent!=null) { item = retourneNoteAvecResultatsAnalyse(numeroAbsoluePage,"numéro absolue", nodStudent.getAttributs().get("numeroabsolue"),numeroAbsoluePage + "‽" +point, nameElt ); }else { evaluation.IncrementPointTotal(Integer.valueOf(point)); item = new node(numeroAbsoluePage, "Erreur", "Numéro de la page absolue" , "null", numeroAbsoluePage, 2, evaluation.getPointEnJeu(),nameElt); } retour.getNodes().add(item); return retour; } /** * * @param retour * @param nodStudent * @param contenuParagraph * @param point * @param nameElt * @return */ private static node evaluPlacement(node retour, node nodStudent, String contenuParagraph, String point, String nameElt) { node item = null; if(nodStudent!=null) { //compare la même valeur "contenuParagraph" pour obtenir les points mais si un vosinage du contenu. item = retourneNoteAvecResultatsAnalyse("Placement","avant", contenuParagraph,contenuParagraph + "‽" +point, nameElt ); }else { evaluation.IncrementPointTotal(Integer.valueOf(point)); item = new node("Placement", "Erreur : -"+ point, "avant" , "null", contenuParagraph, 2, evaluation.getPointEnJeu(),nameElt); } retour.getNodes().add(item); return retour; } /** * 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; } }