2022-06-16 16:45:48 +02:00
package evaluer ;
2022-12-26 10:30:23 +01:00
import java.util.ArrayList ;
2022-06-16 16:45:48 +02:00
import java.util.Enumeration ;
2022-12-12 19:25:53 +01:00
import java.util.regex.Matcher ;
import java.util.regex.Pattern ;
2022-06-16 16:45:48 +02:00
2022-12-16 17:50:51 +01:00
import MEPTL.commandes ;
2022-06-16 16:45:48 +02:00
import cXML.node ;
2022-12-22 13:24:04 +01:00
import list.listeDesNodesAncrable ;
2022-12-10 16:12:36 +01:00
import list.listeDesNodesEvalPlacement ;
2022-12-23 19:24:59 +01:00
import list.listeDesNodesFormatageDirect ;
2022-12-26 10:30:23 +01:00
import list.listeDesNodesPourEvaluerPage ;
2022-06-16 16:45:48 +02:00
public class evaluationAttribut {
2022-12-16 17:50:51 +01:00
//****************************************************************************
//****************************************************************************
//** LES DEUX POINTS D'ENTRES DES METHODES D'EVALUATION **
//****************************************************************************
//****************************************************************************
2022-06-16 16:45:48 +02:00
/ * *
2022-12-16 17:50:51 +01:00
* POINT D ' ENTREE DE LA METHODE ANALYSESTYLE ; < / br >
* < / br >
2022-06-16 16:45:48 +02:00
* Analyse tous les attributs des nodes < style : style > . < br >
* Formatage direct des styles de paragraphe . < / br >
* Les attributs doivent contenir le code ‼ . < br >
* < br >
2022-12-02 10:17:36 +01:00
* @param nodeStyleParagraphStudent : le node de l ' étudiant .
* @param nodeStyleParagraphSujet : le node du sujet
2022-06-16 16:45:48 +02:00
* @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é .
2022-12-02 10:17:36 +01:00
* @return le node < b > retour < / b > avec tous les nodes enfants < b > nameItem < / b > contenant les différentes analyses .
2022-06-16 16:45:48 +02:00
* /
public static node evalLesAttributAnalyseStyle ( node nodeStyleParagraphStudent , node nodeStyleParagraphSujet , node retour , String nameItem , String nameElt ) {
2022-12-02 10:17:36 +01:00
if ( nodeStyleParagraphSujet . getAttributs ( ) . get ( " evaluer " ) = = null ) return retour ;
if ( ! nodeStyleParagraphSujet . getAttributs ( ) . get ( " evaluer " ) . equals ( " true " ) ) return retour ;
2022-06-16 16:45:48 +02:00
Enumeration < String > 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 ) ;
}
}
}
2023-01-01 12:43:53 +01:00
// 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);
// }
// }
//
// }
// }
//
// }
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 . retourneFirstEnfantsByName ( nameNodeSujet ) ;
if ( propertiesSujet . getAttributs ( ) . get ( " evaluer " ) ! = null ) {
if ( propertiesSujet . getAttributs ( ) . get ( " evaluer " ) . equals ( " true " ) ) {
node propertiesStudent = nodeStyleParagraphStudent . retourneFirstEnfantsByName ( nameNodeSujet ) ;
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 , 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 ) ;
}
2022-12-02 10:17:36 +01:00
}
}
2023-01-01 12:43:53 +01:00
2022-06-16 16:45:48 +02:00
}
}
}
2023-01-01 12:43:53 +01:00
} else {
if ( nodeStyleParagraphSujet . retourneEnfantsByNameExist ( nameNodeSujet ) ) {
node propertiesSujet = nodeStyleParagraphSujet . retourneFirstEnfantsByName ( nameNodeSujet ) ;
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 ( " ‽ " ) ) {
2022-12-02 10:17:36 +01:00
String valueAttributStudent = " null " ;
String valueAttributSujet = propertiesSujet . getAttributs ( ) . get ( k ) . replace ( " ‼ " , " ‽ " ) ;
2023-01-01 12:43:53 +01:00
node item = retourneNoteAvecResultatsAnalyse ( nameItem , k , valueAttributStudent , valueAttributSujet , nameNodeSujet ) ;
2022-12-02 10:17:36 +01:00
retour . getNodes ( ) . add ( item ) ;
}
}
2023-01-01 12:43:53 +01:00
2022-06-16 16:45:48 +02:00
}
}
}
}
2022-12-02 10:17:36 +01:00
}
2023-01-01 12:43:53 +01:00
2022-06-16 16:45:48 +02:00
return retour ;
}
/ * *
2022-12-16 17:50:51 +01:00
* POINTS ENTREES DES METHODES D ' EVALUATION < / br >
* < / br >
2022-06-16 16:45:48 +02:00
* Analyse tous les attributs et les contenus d ' un node . < br >
2022-12-02 10:17:36 +01:00
* Les attributs et les contenus doivent posséder la caractère ‽ ou ‼ . < br >
2022-12-10 16:12:36 +01:00
* Ou le node doit posséder des attributs d ' analyseWriter comme allContent = " 1 " , etc . . . < / br >
2022-06-16 16:45:48 +02:00
* < br >
* @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 < b > retour < / b > avec tous les nodes enfants < b > nameItem < / b > contenant les différentes analyse .
* /
public static node evalLesAttributEtContenuDuNode ( node nodeStudent , node sujet , node retour , String nameItem , String nameElt ) {
Enumeration < String > key = sujet . getAttributs ( ) . keys ( ) ;
while ( key . hasMoreElements ( ) ) {
String k = key . nextElement ( ) ;
2022-12-10 16:12:36 +01:00
// evaluer les attributs de Writer avec l'évaluateur ‽
2022-06-16 16:45:48 +02:00
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
2022-06-16 17:41:16 +02:00
// evalNameSequen, evalNamePage
2022-06-16 16:45:48 +02:00
if ( ! sujet . getAttributs ( ) . get ( k ) . equals ( " 0 " ) ) {
2022-06-16 17:41:16 +02:00
2022-12-16 17:50:51 +01:00
//évaluation du nom du node.
2022-06-16 16:45:48 +02:00
if ( k . equals ( " evalNameNode " ) & & ! sujet . getAttributs ( ) . get ( k ) . equals ( " 0 " ) ) {
if ( nodeStudent ! = null ) {
2022-12-16 17:50:51 +01:00
retour = evaluationNameNode ( retour , nodeStudent , sujet . getNomElt ( ) , sujet . getAttributs ( ) . get ( " evalNameNode " ) , sujet . getNomElt ( ) ) ;
2022-06-16 16:45:48 +02:00
} else {
2022-12-16 17:50:51 +01:00
retour = evaluationNameNode ( retour , null , sujet . getNomElt ( ) , sujet . getAttributs ( ) . get ( " evalNameNode " ) , sujet . getNomElt ( ) ) ;
2022-06-16 16:45:48 +02:00
}
}
2022-12-16 17:50:51 +01:00
//évaluation du nom du style héridé.
2022-12-12 19:25:53 +01:00
if ( k . equals ( " evalNameLegacyStyle " ) & & ! sujet . getAttributs ( ) . get ( k ) . equals ( " 0 " ) ) {
2022-12-16 17:50:51 +01:00
retour = evalNameLegacyStyle ( sujet , nodeStudent , retour , nameElt ) ;
2022-12-12 19:25:53 +01:00
}
2022-12-16 17:50:51 +01:00
//évaluation du nom du créateur.
2022-06-16 16:45:48 +02:00
if ( k . equals ( " evalNameCreator " ) & & sujet . getNomElt ( ) . equals ( " dc:creator " ) ) {
if ( nodeStudent ! = null ) {
2022-12-16 17:50:51 +01:00
retour = evaluationNameCreator ( retour , nodeStudent , nodeStudent . getContenu ( ) . get ( 0 ) , sujet . getAttributs ( ) . get ( " evalNameCreator " ) , " Editeur " ) ;
2022-06-16 16:45:48 +02:00
} else {
2022-12-16 17:50:51 +01:00
retour = evaluationNameCreator ( retour , null , " Pas trouvé l'auteur " , sujet . getAttributs ( ) . get ( " evalNameCreator " ) , " Editeur " ) ;
2022-06-16 16:45:48 +02:00
}
}
2022-12-16 17:50:51 +01:00
//évaluation du créateur initial
2022-06-16 16:45:48 +02:00
if ( k . equals ( " evalNameInitialCreator " ) & & sujet . getNomElt ( ) . equals ( " meta:initial-creator " ) ) {
if ( nodeStudent ! = null ) {
2022-12-16 17:50:51 +01:00
retour = evaluationNameInitialCreator ( retour , nodeStudent , nodeStudent . getContenu ( ) . get ( 0 ) , sujet . getAttributs ( ) . get ( " evalNameInitialCreator " ) , " Créateur " ) ;
2022-06-16 16:45:48 +02:00
} else {
2022-12-16 17:50:51 +01:00
retour = evaluationNameInitialCreator ( retour , null , " Pas trouvé le créateur " , sujet . getAttributs ( ) . get ( " evalNameInitialCreator " ) , " Créateur " ) ;
2022-06-16 16:45:48 +02:00
}
}
2022-12-10 16:12:36 +01:00
// evaluer la non activation de l'entête.
2022-06-16 16:45:48 +02:00
if ( k . equals ( " evalEntetePasActive " ) & & sujet . getNomElt ( ) . equals ( " style:header-style " ) ) {
2022-12-16 17:50:51 +01:00
retour = evalEntetePasActive ( sujet , nodeStudent , retour , nameElt ) ;
2022-06-16 16:45:48 +02:00
}
2022-12-10 16:12:36 +01:00
// evaluer l'activation de l'entête
2022-06-27 11:51:38 +02:00
if ( k . equals ( " evalEnteteActive " ) & & sujet . getNomElt ( ) . equals ( " style:header-style " ) ) {
2022-12-16 17:50:51 +01:00
retour = evalEnteteActive ( sujet , nodeStudent , retour , nameElt ) ;
2022-06-27 11:51:38 +02:00
}
2022-12-10 16:12:36 +01:00
//evaluer la non activation du pied de page.
2022-06-16 16:45:48 +02:00
if ( k . equals ( " evalPiedPagePasActive " ) & & sujet . getNomElt ( ) . equals ( " style:footer-style " ) ) {
2022-12-16 17:50:51 +01:00
retour = evalPiedDePagePasActive ( sujet , nodeStudent , retour , nameElt ) ;
2022-06-16 16:45:48 +02:00
}
2022-12-10 16:12:36 +01:00
// evaluer l'activation du pied de page
2022-06-27 11:51:38 +02:00
if ( k . equals ( " evalPiedPageActive " ) & & sujet . getNomElt ( ) . equals ( " style:footer-style " ) ) {
2022-12-16 17:50:51 +01:00
retour = evalPiedDePageActive ( sujet , nodeStudent , retour , nameElt ) ;
2022-06-27 11:51:38 +02:00
}
2022-12-10 16:12:36 +01:00
// evaluation du nom de la séquence.
2022-06-16 16:45:48 +02:00
if ( k . equals ( " evalNameSequence " ) & & sujet . getNomElt ( ) . equals ( " text:sequence-decl " ) ) {
if ( nodeStudent ! = null ) {
2022-12-16 17:50:51 +01:00
retour = evaluationNameSequence ( retour , nodeStudent , sujet . getAttributs ( ) . get ( " text:name " ) , sujet . getAttributs ( ) . get ( " evalNameSequence " ) , " Séquence " ) ;
2022-06-16 17:41:16 +02:00
} else {
2022-12-16 17:50:51 +01:00
retour = evaluationNameSequence ( retour , null , " Pas trouvé la séquence " , sujet . getAttributs ( ) . get ( " evalNameSequence " ) , " Séquence " ) ;
2022-06-16 17:41:16 +02:00
}
}
2022-12-10 16:12:36 +01:00
// evaluation du nom de la page
2022-06-16 17:41:16 +02:00
if ( k . equals ( " evalNamePage " ) & & sujet . getNomElt ( ) . equals ( " page " ) ) {
if ( nodeStudent ! = null ) {
2022-12-25 20:00:08 +01:00
retour = evaluationNamePage ( retour , nodeStudent , evaluation . withoutCodeAndPointPourRechercheContenuExact ( sujet . getAttributs ( ) . get ( " style:master-page-name " ) ) , sujet . getAttributs ( ) . get ( " evalNamePage " ) , " Page " ) ;
2022-06-16 16:45:48 +02:00
} else {
2022-12-25 20:00:08 +01:00
retour = evaluationNamePage ( retour , null , evaluation . withoutCodeAndPointPourRechercheContenuExact ( sujet . getAttributs ( ) . get ( " style:master-page-name " ) ) , sujet . getAttributs ( ) . get ( " evalNamePage " ) , " Page " ) ;
2022-06-16 16:45:48 +02:00
}
}
2022-12-10 16:12:36 +01:00
// evaluation de la propriété personnalisé dans la structure du document
2022-06-23 10:14:21 +02:00
if ( k . equals ( " evalTextUserDefined " ) & & sujet . getNomElt ( ) . equals ( " text:user-defined " ) & & sujet . chemin ( ) . contains ( " structurepage " ) ) {
if ( nodeStudent ! = null ) {
2022-12-16 17:50:51 +01:00
retour = evaluationTextUserDefined ( retour , nodeStudent , sujet . getAttributs ( ) . get ( " text:name " ) , sujet . getAttributs ( ) . get ( " evalTextUserDefined " ) , " Propriété personnalisé " ) ;
2022-06-23 10:14:21 +02:00
} else {
2022-12-16 17:50:51 +01:00
retour = evaluationTextUserDefined ( retour , null , " Pas trouvé la valeur " , sujet . getAttributs ( ) . get ( " evalTextUserDefined " ) , " Propriété personnalisé " ) ;
2022-06-23 10:14:21 +02:00
}
}
2022-12-10 16:12:36 +01:00
// evaluation du numéro de la page.
2022-06-20 09:45:00 +02:00
if ( k . equals ( " evalNumeroPage " ) & & sujet . getNomElt ( ) . equals ( " page " ) ) {
if ( nodeStudent ! = null ) {
2022-12-16 17:50:51 +01:00
retour = evaluationNumeroPage ( retour , nodeStudent , sujet . getAttributs ( ) . get ( " numero " ) , sujet . getAttributs ( ) . get ( " evalNumeroPage " ) , " numéro " ) ;
2022-06-20 09:45:00 +02:00
} else {
2022-12-16 17:50:51 +01:00
retour = evaluationNumeroPage ( retour , null , " Pas trouvé la page " , sujet . getAttributs ( ) . get ( " evalNumeroPage " ) , " numéro " ) ;
2022-06-20 09:45:00 +02:00
}
}
2022-12-10 16:12:36 +01:00
// evaluation du numéro absolu de la page.
2022-06-20 09:45:00 +02:00
if ( k . equals ( " evalNumeroAbsoluePage " ) & & sujet . getNomElt ( ) . equals ( " page " ) ) {
if ( nodeStudent ! = null ) {
2022-12-16 17:50:51 +01:00
retour = evaluationNumeroAbsoluePage ( retour , nodeStudent , sujet . getAttributs ( ) . get ( " numeroabsolue " ) , sujet . getAttributs ( ) . get ( " evalNumeroAbsoluePage " ) , " numéro absolue " ) ;
2022-06-20 09:45:00 +02:00
} else {
2022-12-16 17:50:51 +01:00
retour = evaluationNumeroAbsoluePage ( retour , null , " Pas trouvé la page " , sujet . getAttributs ( ) . get ( " evalNumeroAbsoluePage " ) , " numéro absolue " ) ;
2022-06-20 09:45:00 +02:00
}
}
2022-12-22 13:24:04 +01:00
// 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 " ) ;
}
}
2022-12-10 16:12:36 +01:00
// evaluation du placement du paragraphe
if ( k . equals ( " evalPlacement " ) & & listeDesNodesEvalPlacement . isPlacement ( sujet ) ) {
2022-12-16 17:50:51 +01:00
retour = evalPlacement ( sujet , nodeStudent , retour , nameElt ) ;
2022-12-10 16:12:36 +01:00
}
2022-12-24 11:57:29 +01:00
//evaluation du premier enfant
2022-12-14 10:33:48 +01:00
if ( k . equals ( " evalFirstChild " ) & & listeDesNodesEvalPlacement . isPlacement ( sujet ) ) {
if ( nodeStudent ! = null ) {
2022-12-24 11:57:29 +01:00
String ReponseSujet = String . valueOf ( sujet . isFirstChildNode ( ) ) ;
retour = evaluationPremierEnfant ( retour , nodeStudent , ReponseSujet , sujet . getAttributs ( ) . get ( " evalFirstChild " ) , " FirstChild " ) ;
2022-12-14 10:33:48 +01:00
} else {
2022-12-24 11:57:29 +01:00
retour = evaluationPremierEnfant ( retour , null , " true " , sujet . getAttributs ( ) . get ( " evalFirstChild " ) , " FirstChild " ) ;
2022-12-14 10:33:48 +01:00
}
}
2022-12-24 11:57:29 +01:00
//evaluation du dernier enfant
2022-12-14 10:33:48 +01:00
if ( k . equals ( " evalLastChild " ) & & listeDesNodesEvalPlacement . isPlacement ( sujet ) ) {
if ( nodeStudent ! = null ) {
2022-12-24 11:57:29 +01:00
String ReponseSujet = String . valueOf ( sujet . isLastChildNode ( ) ) ;
retour = evaluationDernierEnfant ( retour , nodeStudent , ReponseSujet , sujet . getAttributs ( ) . get ( " evalLastChild " ) , " LastChild " ) ;
2022-12-14 10:33:48 +01:00
} else {
2022-12-24 11:57:29 +01:00
retour = evaluationDernierEnfant ( retour , null , " true " , sujet . getAttributs ( ) . get ( " evalLastChild " ) , " LastChild " ) ;
2022-12-14 10:33:48 +01:00
}
}
2022-12-23 19:24:59 +01:00
//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 ) ;
}
2022-12-25 18:00:02 +01:00
//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 ) ;
}
2022-12-26 10:30:23 +01:00
//evaluation de l'absence de paragraphe vide dans la page
if ( k . equals ( " evalPasParagrapheVide " ) & & listeDesNodesPourEvaluerPage . isPage ( sujet ) ) {
retour = evalPasParagrapheVide ( sujet , nodeStudent , retour , nameElt ) ;
}
2022-12-25 18:00:02 +01:00
2023-01-01 18:42:29 +01:00
//evaluation du nombre de page maximal
if ( k . equals ( " evalNombreDePageMaxi " ) & & sujet . getNomElt ( ) . equals ( " structurepage " ) ) {
retour = evalNombreDePageMaxi ( sujet , nodeStudent , retour , nameElt ) ;
}
2023-01-01 21:07:07 +01:00
//evaluation du nombre de page maximal
if ( k . equals ( " evalNombreDePageMini " ) & & sujet . getNomElt ( ) . equals ( " structurepage " ) ) {
retour = evalNombreDePageMini ( sujet , nodeStudent , retour , nameElt ) ;
}
2023-01-01 18:42:29 +01:00
2022-06-16 16:45:48 +02:00
}
}
2022-06-20 09:45:00 +02:00
2022-12-16 17:50:51 +01:00
//allContent
2022-06-16 16:45:48 +02:00
if ( sujet . getAttributs ( ) . get ( " allContent " ) ! = null ) if ( ! sujet . getAttributs ( ) . get ( " allContent " ) . isEmpty ( ) ) {
2022-12-16 17:50:51 +01:00
retour = allContent ( sujet , nodeStudent , retour , nameElt , nameItem ) ;
2022-06-16 16:45:48 +02:00
}
2022-12-16 17:50:51 +01:00
2022-06-16 16:45:48 +02:00
return retour ;
}
2022-11-27 20:45:41 +01:00
2022-06-16 16:45:48 +02:00
2022-12-16 17:50:51 +01:00
//****************************************************************************
//****************************************************************************
//** LES METHODES LORSQU'ELLES SONT LONGUES **
//****************************************************************************
//****************************************************************************
/ * *
* Méthode allContent . < / br >
* Evaluer le contenu textuel d ' un node . < / br >
* @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 ( " <p>** ERREUR : " + " Dans le node " + sujet . getNomElt ( ) + " . \ nIl y a un problème avec la valeur de l'attribut allContent= \" " + sujet . getAttributs ( ) . get ( " allContent " ) + " \" "
+ " </p> " ) ;
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 evalNameLegacyStyme . < / br >
* Evaluer le nom du style hérité . < / br >
* @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 . < / br >
* Evaluer l ' absence de node dans le node style : header - style . < / br >
* @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 ) {
2022-12-25 20:00:08 +01:00
String reponseSujet = " non " ;
String reponseStudent = " non " ;
if ( sujet . getNodes ( ) . size ( ) = = 0 ) reponseSujet = " oui " ;
if ( nodeStudent . getNodes ( ) . size ( ) = = 0 ) reponseStudent = " oui " ;
2022-12-16 17:50:51 +01:00
retour = evaluationEntetePasActive ( retour , reponseStudent , reponseSujet , sujet . getAttributs ( ) . get ( " evalEntetePasActive " ) , " Entete " ) ;
} else {
2022-12-25 20:00:08 +01:00
String reponseSujet = " non " ;
if ( sujet . getNodes ( ) . size ( ) = = 0 ) reponseSujet = " oui " ;
retour = evaluationEntetePasActive ( retour , null , reponseSujet , sujet . getAttributs ( ) . get ( " evalEntetePasActive " ) , " Entete " ) ;
2022-12-16 17:50:51 +01:00
}
return retour ;
}
/ * *
* Méthode evalEnteteActive . < / br >
* Evaluer la présence de node dans style : header - style . < / br >
* @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 ) {
2022-12-25 20:00:08 +01:00
String reponseSujet = " non " ;
String reponseStudent = " non " ;
if ( sujet . getNodes ( ) . size ( ) > 0 ) reponseSujet = " oui " ;
if ( nodeStudent . getNodes ( ) . size ( ) > 0 ) reponseStudent = " oui " ;
2022-12-16 17:50:51 +01:00
retour = evaluationEnteteActive ( retour , reponseStudent , reponseSujet , sujet . getAttributs ( ) . get ( " evalEnteteActive " ) , " Entete " ) ;
} else {
2022-12-25 20:00:08 +01:00
String reponseSujet = " non " ;
if ( sujet . getNodes ( ) . size ( ) > 0 ) reponseSujet = " oui " ;
retour = evaluationEnteteActive ( retour , null , reponseSujet , sujet . getAttributs ( ) . get ( " evalEnteteActive " ) , " Entete " ) ;
2022-12-16 17:50:51 +01:00
}
return retour ;
}
/ * *
* Méthode evalPiedDePagePasActive . < / br >
* Evaluer l ' absence de node dans le node style : footer - style . < / br >
* @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 ) {
2022-12-25 20:00:08 +01:00
String reponseSujet = " non " ;
String reponseStudent = " non " ;
if ( sujet . getNodes ( ) . size ( ) = = 0 ) reponseSujet = " oui " ;
if ( nodeStudent . getNodes ( ) . size ( ) = = 0 ) reponseStudent = " oui " ;
2022-12-16 17:50:51 +01:00
retour = evaluationPiedPagePasActive ( retour , reponseStudent , reponseSujet , sujet . getAttributs ( ) . get ( " evalPiedPagePasActive " ) , " Pied page " ) ;
} else {
2022-12-25 20:00:08 +01:00
String reponseSujet = " non " ;
if ( sujet . getNodes ( ) . size ( ) = = 0 ) reponseSujet = " oui " ;
retour = evaluationPiedPagePasActive ( retour , null , reponseSujet , sujet . getAttributs ( ) . get ( " evalPiedPagePasActive " ) , " Pied page " ) ;
2022-12-16 17:50:51 +01:00
}
return retour ;
}
/ * *
* Méthode evalPiedDePageActive . < / br >
* Evaluer la présence de node dans le node style : header - style . < / br >
* @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 ) {
2022-12-25 20:00:08 +01:00
String reponseSujet = " non " ;
String reponseStudent = " non " ;
if ( sujet . getNodes ( ) . size ( ) > 0 ) reponseSujet = " oui " ;
if ( nodeStudent . getNodes ( ) . size ( ) > 0 ) reponseStudent = " oui " ;
2022-12-16 17:50:51 +01:00
retour = evaluationPiedPageActive ( retour , reponseStudent , reponseSujet , sujet . getAttributs ( ) . get ( " evalPiedPageActive " ) , " Pied page " ) ;
} else {
2022-12-25 20:00:08 +01:00
String reponseSujet = " non " ;
if ( sujet . getNodes ( ) . size ( ) > 0 ) reponseSujet = " oui " ;
retour = evaluationPiedPageActive ( retour , null , reponseSujet , sujet . getAttributs ( ) . get ( " evalPiedPageActive " ) , " Pied page " ) ;
2022-12-16 17:50:51 +01:00
}
return retour ;
}
/ * *
* Méthode Placement ; < / br >
* Evaluer si le node placé juste avant est le même que dans le sujet . < / br >
* @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 ( ) ;
2023-01-17 21:08:16 +01:00
node nodParentSujet = sujet . getParent ( ) ;
if ( nodParentSujet ! = null ) if ( sujet . getParent ( ) . getNomElt ( ) . equals ( " OU " ) ) {
nodeSujetfrereAvant = nodParentSujet . retourneLeNodeFrereAvant ( ) ;
}
if ( nodeSujetfrereAvant ! = null ) if ( nodeSujetfrereAvant . getNomElt ( ) . equals ( " OU " ) ) {
nodeSujetfrereAvant = nodeSujetfrereAvant . getNodes ( ) . get ( 0 ) ;
}
2022-12-16 17:50:51 +01:00
node nodeStudentfereAvant = nodeStudent . retourneLeNodeFrereAvant ( ) ;
if ( nodeSujetfrereAvant = = null ) nodeSujetfrereAvant = new node ( ) ;
if ( nodeStudentfereAvant = = null ) nodeStudentfereAvant = new node ( ) ;
String A = nodeSujetfrereAvant . retourneLesContenusEnfants ( " " ) ;
String B = nodeStudentfereAvant . retourneLesContenusEnfants ( " " ) ;
2023-01-18 08:25:08 +01:00
if ( A . isEmpty ( ) ) A = " Paragraphe vide " ;
if ( B . isEmpty ( ) ) B = " Paragraphe vide " ;
2022-12-16 17:50:51 +01:00
if ( ! A . isEmpty ( ) & & ! B . isEmpty ( ) ) if ( cXML . StringSimilarity . similarity ( A , B ) > 0 . 92 ) calcul + + ;
if ( calcul = = 1 ) {
2022-12-21 17:54:28 +01:00
retour = evaluationPlacement ( retour , B , A , sujet . getAttributs ( ) . get ( " evalPlacement " ) , " Placement " ) ;
2022-12-16 17:50:51 +01:00
} else {
2023-01-17 21:08:16 +01:00
retour = evaluationPlacement ( retour , B , A , sujet . getAttributs ( ) . get ( " evalPlacement " ) , " Placement " ) ;
2022-12-16 17:50:51 +01:00
}
} else {
node nodeSujetAvant = sujet . retourneLeNodeFrereAvant ( ) ;
2022-12-30 17:55:33 +01:00
if ( nodeSujetAvant ! = null ) {
retour = evaluationPlacement ( retour , null , nodeSujetAvant . retourneLesContenusEnfants ( " " ) , sujet . getAttributs ( ) . get ( " evalPlacement " ) , " Placement " ) ;
} else {
retour = evaluationPlacement ( retour , null , " " , sujet . getAttributs ( ) . get ( " evalPlacement " ) , " Placement " ) ;
}
2022-12-16 17:50:51 +01:00
}
return retour ;
}
2022-12-25 18:00:02 +01:00
/ * *
* Méthode evalFormatgeDirect . < / br >
* Evaluer la présence ou l ' absence d ' un formatage direct d ' un style . < / br >
* @param sujet
* @param nodeStudent
* @param retour
* @param nameElt
* @return
* /
2022-12-23 19:24:59 +01:00
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 " ) ;
2022-12-25 18:00:02 +01:00
nameStyleSujet = evaluation . withoutCodeAndPointPourRechercheContenuExact ( nameStyleSujet ) ;
2022-12-23 19:24:59 +01:00
}
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 ;
}
2022-12-25 18:00:02 +01:00
/ * *
* Méthode evalSautPageColonne . < / br >
* Evaluer la présence ou l ' absence d ' un saut de page ou de colonne . < / br >
* @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 ) {
typeSautStudent = styleStudent . getAttributs ( ) . get ( " fo:break-before " ) ;
}
2022-12-26 12:04:34 +01:00
if ( styleStudent . getAttributs ( ) . get ( " fo:break-after " ) ! = null ) {
typeSautStudent = styleStudent . getAttributs ( ) . get ( " fo:break-after " ) ;
}
2022-12-25 18:00:02 +01:00
}
}
}
if ( sujet . getAttributs ( ) . get ( " text:style-name " ) ! = null ) {
String styleName = sujet . getAttributs ( ) . get ( " text:style-name " ) ;
2022-12-26 14:03:43 +01:00
node styleSujet = sujet . racineDuNode ( ) . retourneFirstEnfantsByName ( " style:paragraph " ) ;
2022-12-25 18:00:02 +01:00
if ( styleSujet ! = null ) {
2022-12-26 14:03:43 +01:00
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 " ) ;
}
}
}
2022-12-25 18:00:02 +01:00
}
}
2023-01-25 10:16:52 +01:00
if ( typeSautSujet . equals ( " auto " ) ) typeSautSujet = " page " ;
if ( typeSautStudent . equals ( " auto " ) ) typeSautSujet = " page " ;
2022-12-25 18:00:02 +01:00
retour = evaluationSautPageColonne ( retour , typeSautStudent , typeSautSujet , sujet . getAttributs ( ) . get ( " evalSautPageColonne " ) , " Saut " ) ;
} else {
String typeSautStudent = " pas de saut " ;
String typeSautSujet = " pas de saut " ;
2022-12-26 14:03:43 +01:00
if ( sujet . getAttributs ( ) . get ( " text:style-name " ) ! = null ) {
2022-12-25 18:00:02 +01:00
String styleName = sujet . getAttributs ( ) . get ( " text:style-name " ) ;
2022-12-26 14:03:43 +01:00
node styleSujet = sujet . racineDuNode ( ) . retourneFirstEnfantsByName ( " style:paragraph " ) ;
2022-12-25 18:00:02 +01:00
if ( styleSujet ! = null ) {
2022-12-26 14:03:43 +01:00
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 " ) ;
}
}
}
2022-12-25 18:00:02 +01:00
}
}
2023-01-25 10:16:52 +01:00
if ( typeSautSujet . equals ( " auto " ) ) typeSautSujet = " page " ;
2022-12-25 18:00:02 +01:00
retour = evaluationSautPageColonne ( retour , typeSautStudent , typeSautSujet , sujet . getAttributs ( ) . get ( " evalSautPageColonne " ) , " Saut " ) ;
}
return retour ;
}
2023-01-01 18:42:29 +01:00
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 ;
}
2023-01-01 21:07:07 +01:00
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 ;
}
2023-01-01 18:42:29 +01:00
2022-12-26 10:30:23 +01:00
/ * *
* Méthode evalPasParagrapheVide . < / br >
* Evaluer l ' absence de paragraphe vide dans la page . < / br >
* @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 < node > LesParagraphes = nodeStudent . retourneEnfantsByName ( " text:p " , new ArrayList < node > ( ) ) ;
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 < node > ( ) ) ;
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 < node > LesParagraphes = sujet . retourneEnfantsByName ( " text:p " , new ArrayList < node > ( ) ) ;
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 ;
}
2022-12-16 17:50:51 +01:00
//***********************************************************************************
//***********************************************************************************
//** Les procédures suivantes sont les évaluations par comparaison avec le sujet **
//***********************************************************************************
//***********************************************************************************
2022-06-16 16:45:48 +02:00
/ * *
2022-12-16 17:50:51 +01:00
* Evaluation le nom du node . < / br >
2022-06-16 16:45:48 +02:00
* @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
* /
2022-12-16 17:50:51 +01:00
private static node evaluationNameNode ( node retour , node nodStudent , String nameNode , String point , String nameElt ) {
2022-06-16 16:45:48 +02:00
node item = null ;
if ( nodStudent ! = null ) {
item = retourneNoteAvecResultatsAnalyse ( nameNode , " name " , nodStudent . getNomElt ( ) , nameNode + " ‽ " + point , nameElt ) ;
} else {
evaluation . IncrementPointTotal ( Integer . valueOf ( point ) ) ;
2022-11-27 20:45:41 +01:00
item = new node ( nameNode , " Erreur : - " + evaluation . getPointEnJeu ( ) + " pt " , " Nom du node " , " null " , nameNode , 2 , evaluation . getPointEnJeu ( ) , nameElt ) ;
2022-06-16 16:45:48 +02:00
}
retour . getNodes ( ) . add ( item ) ;
return retour ;
}
2022-12-12 19:25:53 +01:00
/ * *
* Evaluation du nom du style hérité . < / br >
* < / br >
* @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
* /
2022-12-16 17:50:51 +01:00
private static node evaluationNameLegacyStyle ( node retour , node nodStudent , String nameNode , String point , String nameElt , String nameStyleLegacyStudent , String nameStyleLegacySujet ) {
2022-12-12 19:25:53 +01:00
node item = null ;
if ( nodStudent ! = null ) {
2022-12-16 17:50:51 +01:00
item = retourneNoteAvecResultatsAnalyse ( nameNode , " style heritage " , nameStyleLegacyStudent , nameStyleLegacySujet + " ‽ " + point , nameElt ) ;
2022-12-12 19:25:53 +01:00
} else {
evaluation . IncrementPointTotal ( Integer . valueOf ( point ) ) ;
2022-12-16 17:50:51 +01:00
item = new node ( nameNode , " Erreur : - " + evaluation . getPointEnJeu ( ) + " pt " , " style heritage " , " null " , nameStyleLegacySujet , 2 , evaluation . getPointEnJeu ( ) , nameElt ) ;
2022-12-12 19:25:53 +01:00
}
retour . getNodes ( ) . add ( item ) ;
return retour ;
}
2022-06-16 16:45:48 +02:00
/ * *
2022-12-16 17:50:51 +01:00
* Evaluation . Si le node style : header - style ne possède pas d ' attribut alors l ' entete n ' est pas activé . < br >
2022-06-16 16:45:48 +02:00
* Le nombre d ' attribut est null .
* @param retour
* @param nodStudent
* @param nameNode
* @param point
* @param nameElt
* @return
* /
2022-12-16 17:50:51 +01:00
private static node evaluationEntetePasActive ( node retour , String nbAttributStudent , String nbAttribut , String point , String nameElt ) {
2022-06-16 16:45:48 +02:00
node item = null ;
if ( nbAttributStudent ! = null ) {
2022-06-27 11:59:12 +02:00
item = retourneNoteAvecResultatsAnalyse ( nbAttribut , " pas active " , nbAttributStudent , nbAttribut + " ‽ " + point , nameElt ) ;
2022-06-16 16:45:48 +02:00
} else {
evaluation . IncrementPointTotal ( Integer . valueOf ( point ) ) ;
2022-06-27 11:59:12 +02:00
item = new node ( nbAttribut , " Erreur " , " pas active " , " null " , nbAttribut , 2 , evaluation . getPointEnJeu ( ) , nameElt ) ;
2022-06-16 16:45:48 +02:00
}
retour . getNodes ( ) . add ( item ) ;
return retour ;
}
2022-06-27 11:51:38 +02:00
/ * *
2022-12-16 17:50:51 +01:00
* Evaluation . Si le node style : header - style possède des ou un attribut alors l ' entete est activé . < br >
2022-06-27 11:51:38 +02:00
* @param retour
* @param nbAttributStudent
* @param nbAttribut
* @param point
* @param nameElt
* @return
* /
2022-12-16 17:50:51 +01:00
private static node evaluationEnteteActive ( node retour , String nbAttributStudent , String nbAttribut , String point , String nameElt ) {
2022-06-27 11:51:38 +02:00
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 ;
}
2022-06-16 16:45:48 +02:00
/ * *
2022-12-16 17:50:51 +01:00
* Evaluation . Si le node style : footer - style ne possède pas d ' attribut alors l ' entete n ' est pas activé . < br >
2022-06-16 16:45:48 +02:00
* @param retour
* @param nbAttributStudent
* @param nbAttribut
* @param point
* @param nameElt
* @return
* /
2022-12-16 17:50:51 +01:00
private static node evaluationPiedPagePasActive ( node retour , String nbAttributStudent , String nbAttribut , String point , String nameElt ) {
2022-06-16 16:45:48 +02:00
node item = null ;
if ( nbAttributStudent ! = null ) {
2022-06-27 11:59:12 +02:00
item = retourneNoteAvecResultatsAnalyse ( nbAttribut , " pas active " , nbAttributStudent , nbAttribut + " ‽ " + point , nameElt ) ;
2022-06-16 16:45:48 +02:00
} else {
evaluation . IncrementPointTotal ( Integer . valueOf ( point ) ) ;
2022-06-27 11:59:12 +02:00
item = new node ( nbAttribut , " Erreur " , " pas active " , " null " , nbAttribut , 2 , evaluation . getPointEnJeu ( ) , nameElt ) ;
2022-06-16 16:45:48 +02:00
}
retour . getNodes ( ) . add ( item ) ;
return retour ;
}
2022-06-27 11:51:38 +02:00
/ * *
2022-12-16 17:50:51 +01:00
* Evaluation . Si le node style : footer - style possède des ou un attribut alors l ' entete est activé . < br >
2022-06-27 11:51:38 +02:00
* @param retour
* @param nbAttributStudent
* @param nbAttribut
* @param point
* @param nameElt
* @return
* /
2022-12-16 17:50:51 +01:00
private static node evaluationPiedPageActive ( node retour , String nbAttributStudent , String nbAttribut , String point , String nameElt ) {
2022-06-27 11:51:38 +02:00
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 ;
}
2022-06-16 16:45:48 +02:00
/ * *
2022-12-16 17:50:51 +01:00
* Evaluation le champ auteur ( éditeur ) .
2022-06-16 16:45:48 +02:00
* @param retour
* @param nodStudent
* @param nameCreator
* @param point
* @param nameElt
* @return
* /
2022-12-16 17:50:51 +01:00
private static node evaluationNameCreator ( node retour , node nodStudent , String nameCreator , String point , String nameElt ) {
2022-06-16 16:45:48 +02:00
node item = null ;
if ( nodStudent ! = null ) {
2022-12-29 20:58:04 +01:00
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 ) ;
2022-06-16 16:45:48 +02:00
} 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 ;
}
/ * *
2022-12-16 17:50:51 +01:00
* Evaluation le nom de l ' auteur ( créateur ou premier auteur ) . < / br >
2022-06-16 16:45:48 +02:00
* @param retour
* @param nodStudent
* @param nameCreator
* @param point
* @param nameElt
* @return
* /
2022-12-16 17:50:51 +01:00
private static node evaluationNameInitialCreator ( node retour , node nodStudent , String nameCreator , String point , String nameElt ) {
2022-06-16 16:45:48 +02:00
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 ;
}
/ * *
2022-12-16 17:50:51 +01:00
* Evaluation du nom de la séquence . < / br >
2022-06-16 16:45:48 +02:00
* @param retour
* @param nodStudent
2022-06-16 17:41:16 +02:00
* @param nameSequence
2022-06-16 16:45:48 +02:00
* @param point
* @param nameElt
* @return
* /
2022-12-16 17:50:51 +01:00
private static node evaluationNameSequence ( node retour , node nodStudent , String nameSequence , String point , String nameElt ) {
2022-06-16 16:45:48 +02:00
node item = null ;
if ( nodStudent ! = null ) {
2022-06-16 17:41:16 +02:00
item = retourneNoteAvecResultatsAnalyse ( nameSequence , " name " , nodStudent . getAttributs ( ) . get ( " text:name " ) , nameSequence + " ↑‽ " + point , nameElt ) ;
2022-06-16 16:45:48 +02:00
} else {
evaluation . IncrementPointTotal ( Integer . valueOf ( point ) ) ;
2022-06-16 17:41:16 +02:00
item = new node ( nameSequence , " Erreur " , " Nom de la séquence " , " null " , nameSequence , 2 , evaluation . getPointEnJeu ( ) , nameElt ) ;
2022-06-16 16:45:48 +02:00
}
retour . getNodes ( ) . add ( item ) ;
return retour ;
}
2022-06-16 17:41:16 +02:00
/ * *
2022-12-16 17:50:51 +01:00
* evaluation du nom de la page . < / br >
2022-06-16 17:41:16 +02:00
* @param retour
* @param nodStudent
* @param namePage
* @param point
* @param nameElt
* @return
* /
2022-12-16 17:50:51 +01:00
private static node evaluationNamePage ( node retour , node nodStudent , String namePage , String point , String nameElt ) {
2022-06-16 17:41:16 +02:00
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 ) ) ;
2022-06-20 09:45:00 +02:00
item = new node ( namePage , " Erreur " , " Nom de la page " , " null " , namePage , 2 , evaluation . getPointEnJeu ( ) , nameElt ) ;
2022-06-16 17:41:16 +02:00
}
retour . getNodes ( ) . add ( item ) ;
return retour ;
}
2022-06-16 16:45:48 +02:00
2022-06-23 10:14:21 +02:00
/ * *
2022-12-16 17:50:51 +01:00
* Evaluation de la valeur de la propriété personalisée dans la structure ( " text:name " ) de text : user - defined . < / br >
2022-06-23 10:14:21 +02:00
* @param retour
* @param nodStudent
* @param textUserDefined
* @param point
* @param nameElt
* @return
* /
2022-12-16 17:50:51 +01:00
private static node evaluationTextUserDefined ( node retour , node nodStudent , String textUserDefined , String point , String nameElt ) {
2022-06-23 10:14:21 +02:00
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 ;
}
2022-06-20 09:45:00 +02:00
/ * *
2022-12-16 17:50:51 +01:00
* Evaluation du numéro de la page . < / br >
2022-12-10 16:12:36 +01:00
* < br >
2022-06-20 09:45:00 +02:00
* @param retour
* @param nodStudent
* @param numeroPage
* @param point
* @param nameElt
* @return
* /
2022-12-16 17:50:51 +01:00
private static node evaluationNumeroPage ( node retour , node nodStudent , String numeroPage , String point , String nameElt ) {
2022-06-20 09:45:00 +02:00
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 ;
}
/ * *
2022-12-16 17:50:51 +01:00
* Evaluation du numéro absolu de la page . < / br >
2022-12-10 16:12:36 +01:00
* < br >
2022-06-20 09:45:00 +02:00
* @param retour
* @param nodStudent
* @param numeroAbsoluePage
* @param point
* @param nameElt
* @return
* /
2022-12-16 17:50:51 +01:00
private static node evaluationNumeroAbsoluePage ( node retour , node nodStudent , String numeroAbsoluePage , String point , String nameElt ) {
2022-06-20 09:45:00 +02:00
node item = null ;
if ( nodStudent ! = null ) {
2022-12-22 13:24:04 +01:00
item = retourneNoteAvecResultatsAnalyse ( numeroAbsoluePage , " numéro absolue " , " page " + nodStudent . getAttributs ( ) . get ( " numeroabsolue " ) , " page " + numeroAbsoluePage + " ‽ " + point , nameElt ) ;
2022-06-20 09:45:00 +02:00
} else {
evaluation . IncrementPointTotal ( Integer . valueOf ( point ) ) ;
2022-12-22 13:24:04 +01:00
item = new node ( numeroAbsoluePage , " Erreur " , " Numéro de la page absolue " , " null " , " page " + numeroAbsoluePage , 2 , evaluation . getPointEnJeu ( ) , nameElt ) ;
2022-06-20 09:45:00 +02:00
}
retour . getNodes ( ) . add ( item ) ;
return retour ;
}
2022-12-10 16:12:36 +01:00
/ * *
2022-12-16 17:50:51 +01:00
* Evaluation du placement du node par rapport au précédent . < / br >
2022-12-10 16:12:36 +01:00
* @param retour
* @param nodStudent
* @param contenuParagraph
* @param point
* @param nameElt
* @return
* /
2022-12-21 17:54:28 +01:00
private static node evaluationPlacement ( node retour , String contenuParagraphStudentAvant , String contenuParagraphSujetAvant , String point , String nameElt ) {
2022-12-10 16:12:36 +01:00
node item = null ;
2022-12-21 17:54:28 +01:00
if ( contenuParagraphStudentAvant ! = null ) {
2022-12-14 10:33:48 +01:00
//compare la même valeur "contenuParagraph" pour obtenir les points mais si un voisinage du contenu.
2022-12-21 17:54:28 +01:00
item = retourneNoteAvecResultatsAnalyse ( " Placement " , " avant " , contenuParagraphStudentAvant , contenuParagraphSujetAvant + " ╬‽ " + point , nameElt ) ;
2022-12-10 16:12:36 +01:00
} else {
evaluation . IncrementPointTotal ( Integer . valueOf ( point ) ) ;
2022-12-21 17:54:28 +01:00
item = new node ( " Placement " , " Erreur : - " + point , " avant " , " null " , contenuParagraphSujetAvant , 2 , evaluation . getPointEnJeu ( ) , nameElt ) ;
2022-12-10 16:12:36 +01:00
}
retour . getNodes ( ) . add ( item ) ;
return retour ;
}
2022-12-23 19:24:59 +01:00
/ * *
*
* @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 ;
}
2022-12-25 18:00:02 +01:00
/ * *
*
* @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 ;
}
2023-01-01 18:42:29 +01:00
/ * *
*
* @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 ;
}
2022-12-26 10:30:23 +01:00
/ * *
*
* @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 ;
}
2022-12-25 18:00:02 +01:00
2022-12-23 19:24:59 +01:00
2022-12-14 10:33:48 +01:00
/ * *
2022-12-16 17:50:51 +01:00
* Evaluation du dernier enfant . < / br >
2022-12-14 10:33:48 +01:00
* @param retour
* @param nodStudent
* @param contenuParagraph
* @param point
* @param nameElt
* @return
* /
2022-12-16 17:50:51 +01:00
private static node evaluationDernierEnfant ( node retour , node nodStudent , String reponseSujet , String point , String nameElt ) {
2022-12-14 10:33:48 +01:00
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 ;
}
/ * *
2022-12-16 17:50:51 +01:00
* Evaluation du premier enfant . < / br >
2022-12-14 10:33:48 +01:00
* @param retour
* @param nodStudent
* @param reponseSujet
* @param point
* @param nameElt
* @return
* /
2022-12-16 17:50:51 +01:00
private static node evaluationPremierEnfant ( node retour , node nodStudent , String reponseSujet , String point , String nameElt ) {
2022-12-14 10:33:48 +01:00
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 ;
}
2022-12-16 17:50:51 +01:00
//************************************************************************
//************************************************************************
//** LA COMPARISON **
//************************************************************************
//************************************************************************
2022-06-16 16:45:48 +02:00
/ * *
* Retourne le node avec les résultats de la comparaison entre les deux valeurs ( étudiant et sujet ) . < br >
* < br >
2022-12-10 20:23:53 +01:00
* @param nameNode : nom du node de retour .
2022-06-16 16:45:48 +02:00
* @param Tst ( résultat de la comparaison )
2022-12-10 20:23:53 +01:00
* @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 .
2022-06-16 16:45:48 +02:00
* @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 ;
}
2022-12-16 17:50:51 +01:00
2022-06-16 16:45:48 +02:00
}