297 lines
12 KiB
Java
297 lines
12 KiB
Java
package evaluer;
|
|
|
|
import cXML.node;
|
|
import MEPTL.meptl;
|
|
import MEPTL.rechercherUnNodeStudent;
|
|
import cXML.Run;
|
|
|
|
public class analyseLesNodesEnfants {
|
|
|
|
/**
|
|
* Cette méthode récursive permet d'analyser et d'évaluer les nodes enfants.</br>
|
|
*
|
|
* @param PourAnalyse : Le node pour écrire le node d'analyse contenant tous les résultats
|
|
* @param nomDuNodePourAnalyse : Le nom du node de l'analyse pour cette partie (exemple ana:page)
|
|
* @param nod2Student : Le node de l'étudiant le plus bas niveau (le dernier node trouvé)
|
|
* @param nod1Student : Le node de l'étudiant de niveau intermédiaire contenant le node nod2Student
|
|
* @param nodStudent : Le node de l'étudiant le plus haut niveau contenant les nodes nod1Student & nod2Student
|
|
* @param nodSujet : le node sujet.
|
|
* @param nodSujetParagraphs : node contenant l'ensemble des nodes styles de paragraphes du sujet.
|
|
* @param nodStudentParagraphes : node contenant l'ensemble des nodes styles de paragraphes de l'étudiant.
|
|
* @param a : Objet de cXML.Run
|
|
* @return le node pour analyse PourAnalyse
|
|
* @throws
|
|
*/
|
|
static public node nodeNext(node PourAnalyse, String nomDuNodePourAnalyse, node nod2Student, node nod1Student, node nodStudent, node nodSujet, node nodSujetParagraphs, node nodStudentParagraphes, node nodmenu,Run a) {
|
|
node nodEnfantSujet = null;
|
|
node nodStudentCorrespondantAuNodSujet = null;
|
|
|
|
for(int j = 0 ; j < nodSujet.getNodes().size();j++ ) {
|
|
|
|
|
|
nodEnfantSujet = nodSujet.getNodes().get(j);
|
|
String nameNode = nodEnfantSujet.getNomElt();
|
|
|
|
if(nodEnfantSujet.getAttributs().get("evaluer")!=null) {
|
|
if(!nodEnfantSujet.getAttributs().get("evaluer").equals("true")) {
|
|
continue;
|
|
}
|
|
}else {
|
|
continue;
|
|
}
|
|
|
|
|
|
//*****************************
|
|
//** Ajoute un saut de ligne **
|
|
//*****************************
|
|
PourAnalyse = meptl.addSaut(nodEnfantSujet, PourAnalyse);
|
|
|
|
//********************************
|
|
//** Ajoute des sauts et titres **
|
|
//********************************
|
|
PourAnalyse = meptl.addNodeSautTitre(nodEnfantSujet, PourAnalyse,nodmenu,a);
|
|
|
|
//*******************
|
|
//** Le node <OU/> **
|
|
//*******************
|
|
if(nameNode.equals("OU")) {
|
|
if(nodEnfantSujet.getNodes().size()>1) {
|
|
try {
|
|
PourAnalyse = NodeOu(PourAnalyse, nomDuNodePourAnalyse,nod2Student,nod1Student,nodStudent, nodEnfantSujet,nodSujetParagraphs,nodStudentParagraphes,nodmenu,a);
|
|
} catch (CloneNotSupportedException e) {
|
|
e.printStackTrace();
|
|
continue;
|
|
}
|
|
}
|
|
continue;
|
|
}
|
|
|
|
//***************************************************
|
|
//** Recherche le node correspondant de l'étudiant **
|
|
//***************************************************
|
|
if(nodEnfantSujet.getAttributs().get("evaluer")!=null) {
|
|
if(nodEnfantSujet.getAttributs().get("evaluer").equals("true")) {
|
|
if(nod2Student!=null) {
|
|
nodStudentCorrespondantAuNodSujet = rechercherUnNodeStudent.rechercheLeNodeEnCascade(nameNode,nodEnfantSujet,nodStudent,nod1Student,nod2Student,a);
|
|
}
|
|
if(nodStudentCorrespondantAuNodSujet==null && nod1Student!=null ) {
|
|
nodStudentCorrespondantAuNodSujet = rechercherUnNodeStudent.rechercheLeNodeEnCascade(nameNode,nodEnfantSujet,nodStudent,nod1Student,nod2Student,a);
|
|
}
|
|
if(nodStudentCorrespondantAuNodSujet==null && nodStudent!=null) {
|
|
nodStudentCorrespondantAuNodSujet = rechercherUnNodeStudent.rechercheLeNodeEnCascade(nameNode,nodEnfantSujet,nodStudent,nod1Student,nod2Student,a);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
//**************************************************************
|
|
//** Analyse attribut et contenu du node enfant de l'étudiant **
|
|
//**************************************************************
|
|
PourAnalyse = evaluationAttribut.evalLesAttributEtContenuDuNode(nodStudentCorrespondantAuNodSujet, nodEnfantSujet, PourAnalyse, nomDuNodePourAnalyse,nameNode);
|
|
|
|
//*******************************
|
|
//** méthode analyseStyle=true **
|
|
//*******************************
|
|
if(nameNode.contains("text:") && nodEnfantSujet.getAttributs().get("analyseStyle")!=null && nodSujetParagraphs!=null) {
|
|
if(nodEnfantSujet.getAttributs().get("analyseStyle").equals("true")) {
|
|
PourAnalyse = analyseStyle(PourAnalyse, nomDuNodePourAnalyse, nodEnfantSujet,nodStudentCorrespondantAuNodSujet, nodSujetParagraphs,nodStudentParagraphes, nodmenu, a);
|
|
}
|
|
}
|
|
|
|
//************************************************************
|
|
//** Analyse les nodes enfants du node enfant - Récursivité **
|
|
//************************************************************
|
|
if(nodEnfantSujet!=null) {
|
|
PourAnalyse = nodeNext(PourAnalyse, nomDuNodePourAnalyse, nodStudentCorrespondantAuNodSujet, nod2Student, nod1Student, nodEnfantSujet, nodSujetParagraphs, nodStudentParagraphes, nodmenu,a);
|
|
}
|
|
|
|
}
|
|
|
|
return PourAnalyse;
|
|
}
|
|
|
|
|
|
/**
|
|
* Permet d'analyser les styles depuis l'attribut <b>analyseStyle</b>.</br>
|
|
* @param PourAnalyse : node pour le node analyse
|
|
* @param : Le nom du node de l'analyse pour cette partie de l'analyse(exemple ana:page)
|
|
* @param nodSujet : le node du sujet (consignes).
|
|
* @param nodStudent : le node de l'étudiant.
|
|
* @param nodSujetParagraphs : le node contenant l'ensemble des styles du sujet.
|
|
* @param nodStudentParagraphs : le node contenant l'ensemble des style de l'étudiant.
|
|
* @return
|
|
*/
|
|
public static node analyseStyle(node PourAnalyse, String nomDuNodePourAnalyse, node nodSujet, node nodStudent, node nodSujetParagraphs, node nodStudentParagraphs, node nodmenu, Run a ) {
|
|
node StyleParagraphSujet = null;
|
|
node StyleParagraphStudent = null;
|
|
|
|
if(nodSujet.getAttributs().get("analyseStyle")!=null) {
|
|
|
|
if(nodSujet.getAttributs().get("analyseStyle").equals("true") && nodSujet.getAttributs().get("text:style-name")!=null) {
|
|
String NameStyleParagrapheSujet = nodSujet.getAttributs().get("text:style-name");
|
|
StyleParagraphSujet = nodSujetParagraphs.retourneFirstNodeStyleByValueAttribut("style:style", "style:name", NameStyleParagrapheSujet);
|
|
}
|
|
|
|
if(nodStudent!=null && StyleParagraphSujet!=null) {
|
|
if(StyleParagraphSujet.getAttributs().get("evaluer")!=null) {
|
|
if(StyleParagraphSujet.getAttributs().get("evaluer").equals("true")) {
|
|
if(nodStudent.getAttributs().get("text:style-name")!=null && StyleParagraphSujet!=null) {
|
|
String NameStyleParagrapheStudent = nodStudent.getAttributs().get("text:style-name");
|
|
StyleParagraphStudent = nodStudentParagraphs.retourneFirstNodeStyleByValueAttribut("style:style", "style:name",NameStyleParagrapheStudent);
|
|
}
|
|
}else {
|
|
return PourAnalyse;
|
|
}
|
|
}else {
|
|
return PourAnalyse;
|
|
}
|
|
|
|
}
|
|
|
|
// ajoute les valeurs par héritage.
|
|
if(StyleParagraphSujet!=null) {
|
|
// if(StyleParagraphStudent!=null) StyleParagraphStudent = meptl.ajouteValeurLesValeursDuStyleParagraphParent(nodStudentParagraphs , StyleParagraphStudent);
|
|
|
|
//ajoute les valeurs par défaut.
|
|
// if(StyleParagraphStudent!=null) StyleParagraphStudent = meptl.ajouteValeurParDefautAuStyleParagraph(nodStudentParagraphs , StyleParagraphStudent);
|
|
|
|
//*****************************
|
|
//** Ajoute un saut de ligne **
|
|
//*****************************
|
|
PourAnalyse = meptl.addSaut(StyleParagraphSujet, PourAnalyse);
|
|
|
|
//********************************
|
|
//** Ajoute des sauts et titres **
|
|
//********************************
|
|
PourAnalyse = meptl.addNodeSautTitre(StyleParagraphSujet, PourAnalyse, nodmenu, a);
|
|
|
|
|
|
//**************************************************************
|
|
//** Analyse attribut et contenu du node enfant de l'étudiant **
|
|
//**************************************************************
|
|
PourAnalyse = evaluationAttribut.evalLesAttributAnalyseStyle(StyleParagraphStudent, StyleParagraphSujet, PourAnalyse, nomDuNodePourAnalyse,"style:style");
|
|
}
|
|
|
|
}
|
|
return PourAnalyse;
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @param j
|
|
* @param nodEnfantSujet
|
|
* @param PourAnalyse
|
|
* @param nomDuNodePourAnalyse
|
|
* @param nod2Student
|
|
* @param nod1Student
|
|
* @param nodStudent
|
|
* @param nodeOU
|
|
* @param nodSujetParagraphs
|
|
* @param nodStudentParagraphes
|
|
* @param nodmenu
|
|
* @param a
|
|
* @return
|
|
* @throws CloneNotSupportedException
|
|
*/
|
|
public static node NodeOu( node PourAnalyse, String nomDuNodePourAnalyse, node nod2Student, node nod1Student, node nodStudent, node nodeOU, node nodSujetParagraphs, node nodStudentParagraphes, node nodmenu,Run a) throws CloneNotSupportedException {
|
|
|
|
node nodStudentCorrespondantAuNodSujet = null;
|
|
|
|
int Pointgagner = 0;
|
|
int pointOu = 0;
|
|
int pointDebutInitialAvantOU = evaluation.getPointsClass();
|
|
int pointTotalDebutInitialAvantOU = evaluation.getPointTotal();
|
|
int PointTotalNouveau = evaluation.getPointTotal();
|
|
|
|
|
|
node nodeFinalARetourner = PourAnalyse.clone();
|
|
|
|
// Le node OU est au rang j donc j+1
|
|
for(int k = 0 ; k < nodeOU.getNodes().size();k++ ) {
|
|
|
|
node RetourOU = PourAnalyse.clone();
|
|
|
|
node nodEnfantSujet = nodeOU.getNodes().get(k);
|
|
String nameNode = nodEnfantSujet.getNomElt();
|
|
|
|
//***************************************************
|
|
//** Recherche le node correspondant de l'étudiant **
|
|
//***************************************************
|
|
if(nodEnfantSujet.getAttributs().get("evaluer")!=null) {
|
|
if(nodEnfantSujet.getAttributs().get("evaluer").equals("true")) {
|
|
if(nod2Student!=null) {
|
|
if(nod2Student.containElementByName(nameNode)) {
|
|
nodStudentCorrespondantAuNodSujet = rechercherUnNodeStudent.rechercheLeNodeEnCascade(nameNode,nodEnfantSujet,nodStudent,nod1Student,nod2Student,a);
|
|
}
|
|
}
|
|
if(nodStudentCorrespondantAuNodSujet==null && nod1Student!=null) {
|
|
if(nod1Student.containElementByName(nameNode)) {
|
|
nodStudentCorrespondantAuNodSujet = rechercherUnNodeStudent.rechercheLeNodeEnCascade(nameNode,nodEnfantSujet,nodStudent,nod1Student,nod2Student,a);
|
|
}
|
|
}
|
|
if(nodStudentCorrespondantAuNodSujet==null && nodStudent!=null) {
|
|
if(nodStudent.containElementByName(nameNode)) {
|
|
nodStudentCorrespondantAuNodSujet = rechercherUnNodeStudent.rechercheLeNodeEnCascade(nameNode,nodEnfantSujet,nodStudent,nod1Student,nod2Student,a);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
//**************************************************************
|
|
//** Analyse attribut et contenu du node enfant de l'étudiant **
|
|
//**************************************************************
|
|
RetourOU = evaluationAttribut.evalLesAttributEtContenuDuNode(nodStudentCorrespondantAuNodSujet, nodEnfantSujet, RetourOU, nomDuNodePourAnalyse,nameNode);
|
|
|
|
//*******************************
|
|
//** méthode analyseStyle=true **
|
|
//*******************************
|
|
if(nameNode.contains("text:") && nodEnfantSujet.getAttributs().get("analyseStyle")!=null && nodSujetParagraphs!=null) {
|
|
if(nodEnfantSujet.getAttributs().get("analyseStyle").equalsIgnoreCase("true")) {
|
|
RetourOU = analyseStyle(RetourOU, nomDuNodePourAnalyse, nodEnfantSujet,nodStudentCorrespondantAuNodSujet, nodSujetParagraphs,nodStudentParagraphes, nodmenu, a);
|
|
}
|
|
}
|
|
|
|
//************************************************************
|
|
//** Analyse les nodes enfants du node enfant - Récursivité **
|
|
//************************************************************
|
|
if(nodEnfantSujet!=null) {
|
|
RetourOU = nodeNext(RetourOU, nomDuNodePourAnalyse, nodStudentCorrespondantAuNodSujet, nod2Student, nod1Student, nodEnfantSujet, nodSujetParagraphs, nodStudentParagraphes, nodmenu,a);
|
|
}
|
|
|
|
|
|
Pointgagner = evaluation.getPointsClass();
|
|
|
|
if(Pointgagner>pointOu) {
|
|
pointOu = Pointgagner;
|
|
PointTotalNouveau = evaluation.getPointTotal();
|
|
try {
|
|
nodeFinalARetourner = RetourOU.clone();
|
|
} catch (CloneNotSupportedException e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
if(pointOu==0) {
|
|
nodeFinalARetourner = RetourOU.clone();
|
|
}
|
|
|
|
//RAZ des points
|
|
evaluation.setPointsClass(pointDebutInitialAvantOU);
|
|
evaluation.setPointTotal(pointTotalDebutInitialAvantOU);
|
|
|
|
}
|
|
|
|
// Place les points du OU qui correspond au node retour
|
|
evaluation.setPointsClass(pointOu);
|
|
evaluation.setPointTotal(PointTotalNouveau);
|
|
|
|
// Retourne le node maximum de point gagné
|
|
return nodeFinalARetourner;
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|