analyseWriter/src/MEPTL/rechercherUnNodeStudent.java

857 lines
48 KiB
Java
Raw Normal View History

2022-04-29 19:17:58 +02:00
package MEPTL;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.JOptionPane;
2022-04-29 19:17:58 +02:00
import cXML.Run;
import cXML.node;
2022-06-16 16:45:48 +02:00
import evaluer.evaluation;
2022-04-29 19:17:58 +02:00
/**
*
* @author pablo rodriguez
*
*/
public class rechercherUnNodeStudent {
/**
* Recherche en cascade des nodes en fonction de leur contenu.</br>
* Elargie sa recherche dans les nodes parents.</br>
* Permet de rechercher par l'index, le contenu ou le nom des objets.</br></br>
* @param nameNode : nom du node
* @param nodSujet : nod sujet
* @param nod0Student : node étudiant contenant le node nod1Student. Si pas trouvé dans le node nod1Student
* @param nod1Student : node étudiant contenant le node nod2Student. Si pas trouvé dans le node Nod2Student.
* @param nod2Student : node étudiant de niveau le plus haut. La recherche commence par ce node.
* @param a : Run cXML
* @return : le node recherché
*/
public static node rechercheLeNodeEnCascade(String nameNode, node nodSujet,node nod0Student, node nod1Student, node nod2Student, Run a ) {
node nodStudent =null;
//************************************************************************************************
//** Recherche le node par le contenu exact du node en intégrant les contenus des nodes enfants **
//** Le contenu exact supprime dans le texte les espaces au début et à la fin et ignore la case **
//************************************************************************************************
if(nodSujet.getAttributs().get("recherche_contenu_exact")!=null){
if(nodSujet.getAttributs().get("recherche_contenu_exact").contentEquals("true")) {
nodStudent = findNodeParContenuEXACT(nameNode, nodSujet, nod0Student, nod1Student, nod2Student, a);
if(nodStudent!=null) return nodStudent;
}
}
//************************************************************************************************
2022-06-19 21:01:30 +02:00
//** Recherche le node par le contenu ayant la distance Levenshtein la plus proche de 1 **
//************************************************************************************************
if(nodSujet.getAttributs().get("recherche_contenu_plus_proche_voisin")!=null && nodSujet.retourneLesContenusEnfants("").length()>2){
if(nodSujet.getAttributs().get("recherche_contenu_plus_proche_voisin").equals("true")){
nodStudent = findNodeParContenuPlusProcheVoisin(nameNode, nodSujet, nod0Student, nod1Student, nod2Student, a);
if(nodStudent != null) {
// System.out.println("A trouvé le node "+ nameNode + " par le plus proche voisin avec le contenu =" + nodSujet.retourneLesContenusEnfants(""));
return nodStudent;
}else {
// System.out.println("N'a pas trouvé le node "+ nameNode + " par le plus proche voisin avec le contenu =" + nodSujet.retourneLesContenusEnfants(""));
}
}
}
//***********************************
//** Recherche le node par l'index **
//***********************************
if(nodSujet.getAttributs().get("recherche_index")!=null){
if(nodSujet.getAttributs().get("recherche_index").equals("true")) {
nodStudent = findNodeParIndex(nameNode, nodSujet, nod0Student, nod1Student, nod2Student, a);
return nodStudent;
}
}
//*************************************************************************************
//** Recherche les nodes text:p, text:h, text:span, text:list par le contenu textuel **
//*************************************************************************************
if(nodSujet.getNomElt().contains("text:")) {
nodStudent = findNodeByContenuTextuel(nameNode, nodSujet, nod0Student, nod1Student, nod2Student, a);
if(nodStudent!=null) return nodStudent;
2022-04-29 19:17:58 +02:00
}
2022-04-29 19:17:58 +02:00
//*****************************************************************
2022-05-07 20:43:07 +02:00
//** Recherche le node text:p par les différents contenu du node **
//*****************************************************************
if(nameNode.equals("text:p")||nameNode.equals("text:span")||nameNode.equals("text:list")) {
nodStudent = findLeNodeTextpParDesNodesEnfantsSpecifique(nameNode, nodSujet,nod0Student, nod1Student, nod2Student, a );
2022-04-29 19:17:58 +02:00
}
2022-05-07 20:43:07 +02:00
//********************************************************************************
//** Recherche le node draw:frame par draw:name ou recherche_anchor-page-number **
//********************************************************************************
if(nameNode.equals("draw:frame")) {
nodStudent = findDrawFrame(nameNode, nodSujet, nod0Student, nod1Student, nod2Student, a);
2022-04-29 19:17:58 +02:00
}
//************************************************
//** Recherche le node text:date par text:fixed **
//************************************************
2022-05-09 21:22:50 +02:00
if(nameNode.equals("text:date")) {
nodStudent = findTextDate(nameNode, nodSujet, nod0Student, nod1Student, nod2Student, a);
}
//**********************************************
//** Recherche le node text:xxx par text:name **
//**********************************************
2022-05-07 20:43:07 +02:00
if(nameNode.equals("text:section") || nameNode.equals("text:user-defined") || nameNode.equals("text:table-of-content")) {
nodStudent = findByTextName(nameNode, nodSujet, nod0Student, nod1Student, nod2Student, a);
2022-04-29 19:17:58 +02:00
}
2022-05-07 20:43:07 +02:00
//******************************************************************
//** Recherche le node text:database-display par text:column-name **
//******************************************************************
if(nameNode.equals("text:database-display")) {
nodStudent = findDataBase(nameNode, nodSujet, nod0Student, nod1Student, nod2Student, a);
2022-04-29 19:17:58 +02:00
}
2022-05-07 20:43:07 +02:00
//**************************************************
//** Recherche le node table:table par table:name **
//**************************************************
if(nameNode.equals("table:table")) {
nodStudent = findTable(nameNode, nodSujet, nod0Student, nod1Student, nod2Student, a);
2022-04-29 19:17:58 +02:00
}
2022-05-07 20:43:07 +02:00
//*************************************************************************
//** Recherche le node text:h par le contenu avec tolérance de carcatère **
//*************************************************************************
2022-04-29 19:17:58 +02:00
if(nameNode.equals("text:h")) {
2022-05-07 20:43:07 +02:00
nodStudent = findByContentWithTolerance(nameNode, nodSujet, nod0Student, nod1Student, nod2Student, a);
2022-04-29 19:17:58 +02:00
}
2022-05-09 21:22:50 +02:00
2022-05-07 20:43:07 +02:00
//*******************************************************
//** Recherche le node par l'index mais si pas demandé **
//*******************************************************
if(nameNode.equals("table:table-row") || nameNode.equals("table:table-cell") || nameNode.equals("text:tab") || nameNode.equals("text:span")) {
nodStudent = findByIndexEvenIsFalse(nameNode, nodSujet, nod0Student, nod1Student, nod2Student, a);
2022-04-29 19:17:58 +02:00
}
2022-05-09 21:22:50 +02:00
//****************************************************************
//** Recherche le node text:conditional-text par text:condition **
//****************************************************************
if(nameNode.equals("text:conditional-text") ) {
nodStudent = findTextConditional(nameNode, nodSujet, nod0Student, nod1Student, nod2Student, a);
}
2022-04-29 19:17:58 +02:00
2022-05-07 20:43:07 +02:00
//***************************************************************
//** Recherche le node table:table-column par table:style-name **
//***************************************************************
if(nameNode.equals("table:table-column")) {
nodStudent = findTableByStyleName(nameNode, nodSujet, nod0Student, nod1Student, nod2Student, a);
2022-04-29 19:17:58 +02:00
}
2022-05-07 20:43:07 +02:00
//*********************************************
//** Recherche le node par le contenu simple **
//*********************************************
if(nameNode.equals("text:tab") || nameNode.equals("style:graphic-properties")) {
nodStudent = findByContentZero(nameNode, nodSujet, nod0Student, nod1Student, nod2Student, a);
2022-04-29 19:17:58 +02:00
}
//*************************************************************
//** Recherche le node style:tab-stop par son style:position **
//*************************************************************
if(nameNode.equals("style:tab-stop")) {
nodStudent = findBystylePosition(nameNode, nodSujet, nod0Student, nod1Student, nod2Student, a);
}
//***********************************
//** Recherche le node par son nom **
//***********************************
if(nameNode.equals("text:editing-cycles")) {
nodStudent = findByNameNode(nameNode, nodSujet, nod0Student, nod1Student, nod2Student, a);
return nodStudent;
}
2022-05-07 20:43:07 +02:00
//***********************************************
//** Recherche le node par son nom **
//** sauf pour draw:frame **
//***********************************************
2022-05-07 20:43:07 +02:00
if(nodStudent==null) {
nodStudent = findByNameNode(nameNode, nodSujet, nod0Student, nod1Student, nod2Student, a);
2022-04-29 19:17:58 +02:00
}
2022-05-07 20:43:07 +02:00
//*********************************************
//** Recherche le node par le contenu simple **
//*********************************************
if(nodStudent==null){
nodStudent = findByContentZero(nameNode, nodSujet, nod0Student, nod1Student, nod2Student, a);
2022-04-29 19:17:58 +02:00
}
return nodStudent;
}
2022-05-07 20:43:07 +02:00
/**
* Recherche par le contenu exact du node. Englobe les contenus des nodes enfants.</br>
* Le contenu exact supprime dans le texte les espaces au début et à la fin et ignore la case.</br>
2022-05-07 20:43:07 +02:00
* @param nameNode
* @param nodSujet
* @param nod0Student
* @param nod1Student
* @param nod2Student
* @param a
* @return
*/
private static node findNodeParContenuEXACT(String nameNode, node nodSujet,node nod0Student, node nod1Student, node nod2Student, Run a ) {
node nodStudent = null;
if(nodSujet.getAttributs().get("recherche_contenu_exact")!=null) {
if(nodSujet.getAttributs().get("recherche_contenu_exact").equals("true")) {
if(!nodSujet.retourneLesContenusEnfants("").isEmpty()) {
String valueAttribut = evaluation.withoutCodeAndPointPourRechercheContenuExact(nodSujet.retourneLesContenusEnfants(""));
if(nod2Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContentExact(nod2Student.getNodes(), valueAttribut, nodSujet.getNomElt());
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContentExact(nod1Student.getNodes(), valueAttribut, nodSujet.getNomElt());
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContentExact(nod0Student.getNodes(), valueAttribut, nodSujet.getNomElt());
}
}
}
return nodStudent;
}
/**
* Retourne le node Student en recherchant par le contenu textuel.</br>
* @param nameNode
* @param nodSujet
* @param nod0Student
* @param nod1Student
* @param nod2Student
* @param a
* @return
*/
private static node findNodeByContenuTextuel(String nameNode, node nodSujet,node nod0Student, node nod1Student, node nod2Student, Run a) {
node nodStudent = null;
if(nodSujet.retourneLesContenusEnfants("").length()<1) return null;
String valueAttribut = evaluation.withoutCodeAndPointPourRechercheContenuExact(nodSujet.retourneLesContenusEnfants(""));
Pattern p = Pattern.compile("^text:p|^text:h|^text:span|^text:list");
Matcher m = p.matcher(nameNode);
if(m.find()) {
if(nod2Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNameNodeByFindContentExactly(nod2Student.getNodes(), valueAttribut, nameNode);
if(nod2Student!=null) if(nodStudent==null) {
ArrayList<node> tousLesfreres = nod2Student.retourneTousLesFreres();
for(int i = 0 ; i < tousLesfreres.size();i++) {
if(nod2Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNameNodeByFindContentExactly(tousLesfreres.get(i).getNodes(), valueAttribut, nameNode);
}
}
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNameNodeByFindContentExactly(nod1Student.getNodes(), valueAttribut, nameNode);
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNameNodeByFindContentExactly(nod0Student.getNodes(), valueAttribut, nameNode);
if(nodStudent!=null) return nodStudent;
if(nod2Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContentExact(nod2Student.getNodes(), valueAttribut, nameNode);
if(nod2Student!=null) if(nodStudent==null) {
ArrayList<node> tousLesfreres = nod2Student.retourneTousLesFreres();
for(int i = 0 ; i < tousLesfreres.size();i++) {
if(nod2Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContentExact(tousLesfreres.get(i).getNodes(), valueAttribut, nameNode);
}
}
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContentExact(nod1Student.getNodes(), valueAttribut, nameNode);
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContentExact(nod0Student.getNodes(), valueAttribut, nameNode);
if(nodStudent!=null) return nodStudent;
if(nod2Student!=null) if(nodStudent==null) nodStudent = a.retourneLeNodeByContentPlusProche(nod2Student.getNodes(), valueAttribut, nameNode,0.75,null);
if(nod2Student!=null) if(nodStudent==null) {
ArrayList<node> tousLesfreres = nod2Student.retourneTousLesFreres();
for(int i = 0 ; i < tousLesfreres.size();i++) {
if(tousLesfreres.get(i)!=null) if(nodStudent==null) nodStudent = a.retourneLeNodeByContentPlusProche(tousLesfreres.get(i).getNodes(), nameNode,valueAttribut,0.75,null);
}
2022-05-07 20:43:07 +02:00
}
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneLeNodeByContentPlusProche(nod1Student.getNodes(), valueAttribut, nameNode,0.75,null);
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneLeNodeByContentPlusProche(nod0Student.getNodes(), valueAttribut, nameNode,0.75,null);
}
return nodStudent;
}
/**
* Recherche par le contenu par le plus proche voisin. Englobe les contenus des nodes enfants.</br>
* La distance maximale est de 0.8.</br>
* @param nameNode
* @param nodSujet
* @param nod0Student
* @param nod1Student
* @param nod2Student
* @param a
* @return
*/
@SuppressWarnings("unused")
private static node findNodeParContenuPlusProcheVoisinSim(String nameNode, node nodSujet,node nod0Student, node nod1Student, node nod2Student, Run a , double sim) {
node nodStudent = null;
if(!nodSujet.retourneLesContenusEnfants("").isEmpty()) {
String valueAttribut = evaluation.withoutCodeAndPointPourRechercheContenuExact(nodSujet.retourneLesContenusEnfants(""));
if(nod2Student!=null) if(nodStudent==null) nodStudent = a.retourneLeNodeByContentPlusProche(nod2Student.getNodes(), valueAttribut, nodSujet.getNomElt(),sim,null);
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneLeNodeByContentPlusProche(nod1Student.getNodes(), valueAttribut, nodSujet.getNomElt(),sim,null);
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneLeNodeByContentPlusProche(nod0Student.getNodes(), valueAttribut, nodSujet.getNomElt(),sim,null);
}
return nodStudent;
}
/**
* Recherche par le contenu par le plus proche voisin. Englobe les contenus des nodes enfants.</br>
* @param nameNode
* @param nodSujet
* @param nod0Student
* @param nod1Student
* @param nod2Student
* @param a
* @return
*/
private static node findNodeParContenuPlusProcheVoisin(String nameNode, node nodSujet,node nod0Student, node nod1Student, node nod2Student, Run a ) {
node nodStudent = null;
if(nodSujet.getAttributs().get("recherche_contenu_plus_proche_voisin").equals("true")) {
if(!nodSujet.retourneLesContenusEnfants("").isEmpty()) {
2022-06-16 16:45:48 +02:00
String valueAttribut = evaluation.withoutCodeAndPointPourRechercheContenuExact(nodSujet.retourneLesContenusEnfants(""));
if(nod2Student!=null) if(nodStudent==null) nodStudent = a.retourneLeNodeByContentPlusProche(nod2Student.getNodes(), valueAttribut, nodSujet.getNomElt(),0.5,null);
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneLeNodeByContentPlusProche(nod1Student.getNodes(), valueAttribut, nodSujet.getNomElt(),0.5,null);
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneLeNodeByContentPlusProche(nod0Student.getNodes(), valueAttribut, nodSujet.getNomElt(),0.5,null);
}
}
return nodStudent;
}
2022-05-07 20:43:07 +02:00
/**
* Recherche par l'attribut index.</br>
* @param nameNode
* @param nodSujet
* @param nod0Student
* @param nod1Student
* @param nod2Student
* @param a
* @return
*/
private static node findNodeParIndex(String nameNode, node nodSujet,node nod0Student, node nod1Student, node nod2Student, Run a ) {
node nodStudent = null;
if(nodSujet.getAttributs().get("recherche_index").equals("true")) {
String valueAttribut = nodSujet.getAttributs().get("index");
if(nod2Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod2Student.getNodes(), nodSujet.getNomElt(),"index",valueAttribut);
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod1Student.getNodes(), nodSujet.getNomElt(),"index",valueAttribut);
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod0Student.getNodes(), nodSujet.getNomElt(),"index",valueAttribut);
}
return nodStudent;
}
/**
* Recherche Le node text:p par les différents contenu du node.</br>
* @param nameNode
* @param nodSujet
* @param nod0Student
* @param nod1Student
* @param nod2Student
* @param a
* @return
*/
private static node findLeNodeTextpParDesNodesEnfantsSpecifique(String nameNode, node nodSujet,node nod0Student, node nod1Student, node nod2Student, Run a ) {
node nodStudent =null;
2022-05-09 21:22:50 +02:00
if(!nodSujet.getNodes().isEmpty()) return null;
String nameNodeSujet = nodSujet.getNomElt();
if(nodSujet.getNodes().size()>0) {
for(int i = 0; i < nodSujet.getNodes().size() ; i++) {
if(nodSujet.getNodes().get(i)!=null) {
node nodEnfantSujet = nodSujet.getNodes().get(i);
String nameNodeEnfantSujet = nodEnfantSujet.getNomElt();
if(nameNodeEnfantSujet.equals("text:user-defined")) {
2022-06-16 16:45:48 +02:00
String valueAttribut = evaluation.withoutCodeAndPoint(nodSujet.retourneFirstEnfantsByName("text:user-defined").getAttributs().get("text:name"));
2022-05-09 21:22:50 +02:00
if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue(nameNodeSujet,"text:user-defined", "text:name", valueAttribut);
if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue(nameNodeSujet,"text:user-defined", "text:name", valueAttribut);
if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue(nameNodeSujet,"text:user-defined", "text:name", valueAttribut);
}
if(nameNodeEnfantSujet.equals("text:conditional-text")) {
2022-06-16 16:45:48 +02:00
String valueAttribut = evaluation.withoutCodeAndPoint(nodSujet.retourneFirstEnfantsByName("text:conditional-text").getAttributs().get("text:condition"));
2022-05-09 21:22:50 +02:00
if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue(nameNodeSujet,"text:conditional-text", "text:condition", valueAttribut);
if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue(nameNodeSujet,"text:conditional-text", "text:condition", valueAttribut);
if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue(nameNodeSujet,"text:conditional-text", "text:condition", valueAttribut);
}
if(nameNodeEnfantSujet.equals("text:database-display")) {
2022-06-16 16:45:48 +02:00
String valueAttribut = evaluation.withoutCodeAndPoint(nodSujet.retourneFirstEnfantsByName("text:database-display").getAttributs().get("text:column-name"));
2022-05-09 21:22:50 +02:00
if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue(nameNodeSujet,"text:database-display", "text:column-name", valueAttribut);
if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue(nameNodeSujet,"text:database-display", "text:column-name", valueAttribut);
if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue(nameNodeSujet,"text:database-display", "text:column-name", valueAttribut);
}
if(nameNodeEnfantSujet.equals("text:date")) {
2022-06-16 16:45:48 +02:00
String valueAttribut = evaluation.withoutCodeAndPoint(nodSujet.retourneFirstEnfantsByName("text:date").getAttributs().get("text:fixed"));
2022-05-09 21:22:50 +02:00
if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue(nameNodeSujet,"text:date", "text:fixed", valueAttribut);
if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue(nameNodeSujet,"text:date", "text:fixed", valueAttribut);
if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue(nameNodeSujet,"text:date", "text:fixed", valueAttribut);
}
if(nameNodeEnfantSujet.equals("text:subject")) {
if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstEnfantsByNameNode1ContainNameNode2(nameNodeSujet,"text:subject");
if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstEnfantsByNameNode1ContainNameNode2(nameNodeSujet,"text:subject");
if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstEnfantsByNameNode1ContainNameNode2(nameNodeSujet,"text:subject");
}
if(nameNodeEnfantSujet.equals("text:title")) {
if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstEnfantsByNameNode1ContainNameNode2(nameNodeSujet,"text:title");
if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstEnfantsByNameNode1ContainNameNode2(nameNodeSujet,"text:title");
if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstEnfantsByNameNode1ContainNameNode2(nameNodeSujet,"text:title");
}
if(nameNodeEnfantSujet.equals("text:initial-creator")) {
if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstEnfantsByNameNode1ContainNameNode2(nameNodeSujet,"text:initial-creator");
if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstEnfantsByNameNode1ContainNameNode2(nameNodeSujet,"text:initial-creator");
if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstEnfantsByNameNode1ContainNameNode2(nameNodeSujet,"text:initial-creator");
}
if(nameNodeEnfantSujet.equals("text:creator")) {
if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstEnfantsByNameNode1ContainNameNode2(nameNodeSujet,"text:creator");
if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstEnfantsByNameNode1ContainNameNode2(nameNodeSujet,"text:creator");
if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstEnfantsByNameNode1ContainNameNode2(nameNodeSujet,"text:creator");
}
if(nameNodeEnfantSujet.equals("text:note")) {
node nodeTexteNoteSujet = nodSujet.retourneFirstEnfantsByName("text:note");
node nodeTexteNoteStudent = null;
if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstEnfantsByNameNode1ContainNameNode2(nameNodeSujet,"text:note");
if(nodStudent!=null) {
nodeTexteNoteStudent = nodStudent.retourneFirstEnfantsByName("text:note");
if(nodeTexteNoteSujet.retourneLesContenusEnfants("").equals(nodeTexteNoteStudent.retourneLesContenusEnfants(""))) return nodStudent;
}
if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstEnfantsByNameNode1ContainNameNode2(nameNodeSujet,"text:note");
if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstEnfantsByNameNode1ContainNameNode2(nameNodeSujet,"text:note");
if(nodStudent!=null) {
nodeTexteNoteStudent = nodStudent.retourneFirstEnfantsByName("text:note");
if(nodeTexteNoteSujet.retourneLesContenusEnfants("").equals(nodeTexteNoteStudent.retourneLesContenusEnfants(""))) return nodStudent;
}
if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstEnfantsByNameNode1ContainNameNode2(nameNodeSujet,"text:note");
if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstEnfantsByNameNode1ContainNameNode2(nameNodeSujet,"text:note");
if(nodStudent!=null) {
nodeTexteNoteStudent = nodStudent.retourneFirstEnfantsByName("text:note");
if(nodeTexteNoteSujet.retourneLesContenusEnfants("").equals(nodeTexteNoteStudent.retourneLesContenusEnfants(""))) return nodStudent;
}
}
2022-05-09 21:22:50 +02:00
if(nodStudent!=null) return nodStudent;
}
}
}
2022-05-09 21:22:50 +02:00
// //si le node "text:p" contient un "text:user-defined" alors le recherche par le "text:name" de ce node "text:user-defined"
// if(nodSujet.containElementByName("text:user-defined")) {
2022-06-16 16:45:48 +02:00
// String valueAttribut = evaluation.withoutCodeAndPoint(nodSujet.retourneFirstEnfantsByName("text:user-defined").getAttributs().get("text:name"));
2022-05-09 21:22:50 +02:00
// if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:user-defined", "text:name", valueAttribut);
// if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:user-defined", "text:name", valueAttribut);
// if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:user-defined", "text:name", valueAttribut);
// }
// //si le node "text:p" contient un "text:conditional-text" alors le recherche par le "text:condition" de ce node "text:conditional-text"
// if(nodSujet.containElementByName("text:conditional-text")) {
2022-06-16 16:45:48 +02:00
// String valueAttribut = evaluation.withoutCodeAndPoint(nodSujet.retourneFirstEnfantsByName("text:conditional-text").getAttributs().get("text:condition"));
2022-05-09 21:22:50 +02:00
// if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:conditional-text", "text:condition", valueAttribut);
// if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:conditional-text", "text:condition", valueAttribut);
// if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:conditional-text", "text:condition", valueAttribut);
// }
// //si le node "text:p" contient un "text:database-display" alors le recherche par le "text:column-name" de ce node "text:database-display"
// if(nodSujet.containElementByName("text:database-display")) {
2022-06-16 16:45:48 +02:00
// String valueAttribut = evaluation.withoutCodeAndPoint(nodSujet.retourneFirstEnfantsByName("text:database-display").getAttributs().get("text:column-name"));
2022-05-09 21:22:50 +02:00
// if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:database-display", "text:column-name", valueAttribut);
// if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:database-display", "text:column-name", valueAttribut);
// if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:database-display", "text:column-name", valueAttribut);
// }
// //si le node "text:p" contient un "text:date" alors le recherche par le "text:fixed" de ce node "text:date"
// if(nodSujet.containElementByName("text:date")) {
2022-06-16 16:45:48 +02:00
// String valueAttribut = evaluation.withoutCodeAndPoint(nodSujet.retourneFirstEnfantsByName("text:date").getAttributs().get("text:fixed"));
2022-05-09 21:22:50 +02:00
// if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:date", "text:fixed", valueAttribut);
// if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:date", "text:fixed", valueAttribut);
// if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstNodeByNameContainsNodeByNameAndAttributValue("text:p","text:date", "text:fixed", valueAttribut);
// }
// if(nodSujet.containElementByName("text:subject")) {
// if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:subject");
// if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:subject");
// if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:subject");
// }
// if(nodSujet.containElementByName("text:title")) {
// if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:title");
// if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:title");
// if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:title");
// }
// if(nodSujet.containElementByName("text:initial-creator")) {
// if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:initial-creator");
// if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:initial-creator");
// if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:initial-creator");
// }
// if(nodSujet.containElementByName("text:creator")) {
// if(nod2Student!=null) if(nodStudent==null) nodStudent = nod2Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:creator");
// if(nod1Student!=null) if(nodStudent==null) nodStudent = nod1Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:creator");
// if(nod0Student!=null) if(nodStudent==null) nodStudent = nod0Student.retourneFirstEnfantsByNameNode1ContainNameNode2("text:p","text:creator");
// }
2022-05-07 20:43:07 +02:00
//** Recherche par contenu
if(!nodSujet.getContenu().isEmpty()) {
2022-06-16 16:45:48 +02:00
String valueAttribut = evaluation.withoutCodeAndPointPourRechercheContenuExact(nodSujet.getContenu().get(0));
2022-05-07 20:43:07 +02:00
if(nod2Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContentExact(nod2Student.getNodes(), valueAttribut, nodSujet.getNomElt());
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContentExact(nod1Student.getNodes(), valueAttribut, nodSujet.getNomElt());
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContentExact(nod0Student.getNodes(), valueAttribut, nodSujet.getNomElt());
}
2022-05-09 21:22:50 +02:00
//** Recherche le node par index uniquement même si pas demandé. Si trouve pas retourne un null.
2022-05-07 20:43:07 +02:00
if(nodSujet.getAttributs().get("index")!=null){
String valueAttribut = nodSujet.getAttributs().get("index");
if(nod2Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod2Student.getNodes(), nodSujet.getNomElt(),"index",valueAttribut);
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod1Student.getNodes(), nodSujet.getNomElt(),"index",valueAttribut);
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod0Student.getNodes(), nodSujet.getNomElt(),"index",valueAttribut);
}
2022-05-07 20:43:07 +02:00
return nodStudent;
}
/**
* Recherche Le node draw:frame par l'attribut draw:name ou recherche_anchor-apge-number.</br>
* @param nameNode
* @param nodSujet
* @param nod0Student
* @param nod1Student
* @param nod2Student
* @param a
* @return
*/
private static node findDrawFrame(String nameNode, node nodSujet,node nod0Student, node nod1Student, node nod2Student, Run a) {
node nodStudent = null;
2022-06-16 16:45:48 +02:00
String nameDraw = evaluation.withoutCodeAndPointPourRechercheContenuExact(nodSujet.getAttributs().get("draw:name"));
System.out.println("recherche image ou cadre ="+ nameDraw);
2022-05-07 20:43:07 +02:00
//recherche par le nom de l'objet draw:name par défaut
if(nod2Student!=null) nodStudent = a.retourneFirstNodeByNameAttributValueNetTexte(nod2Student, nameNode, "draw:name", nameDraw);
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValueNetTexte(nod1Student, nameNode, "draw:name", nameDraw);
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValueNetTexte(nod0Student, nameNode, "draw:name", nameDraw);
2022-05-07 20:43:07 +02:00
if(nodStudent!=null) return nodStudent;
2022-05-07 20:43:07 +02:00
if(nodSujet.getAttributs().get("recherche_anchor-page-number")!=null) if(nodSujet.getAttributs().get("recherche_anchor-page-number").equalsIgnoreCase("true")) {
2022-06-16 16:45:48 +02:00
String AncragePage = evaluation.withoutCodeAndPointPourRechercheContenuExact(nodSujet.getAttributs().get("text:anchor-page-number"));
if(nod2Student!=null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod2Student, nameNode, "text:anchor-page-number", AncragePage);
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod1Student, nameNode, "text:anchor-page-number", AncragePage);
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod0Student, nameNode, "text:anchor-page-number", AncragePage);
2022-05-07 20:43:07 +02:00
}
return nodStudent;
}
2022-05-09 21:22:50 +02:00
/**
*
* @param nameNode
* @param nodSujet
* @param nod0Student
* @param nod1Student
* @param nod2Student
* @param a
* @return
*/
private static node findTextConditional(String nameNode, node nodSujet,node nod0Student, node nod1Student, node nod2Student, Run a) {
node nodStudent = null;
2022-06-16 16:45:48 +02:00
String valueAttribut = evaluation.withoutCodeAndPoint(nodSujet.getAttributs().get("text:condition"));
2022-05-09 21:22:50 +02:00
if(nod2Student!=null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod2Student, nameNode, "text:condition", valueAttribut);
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod1Student, nameNode, "text:condition", valueAttribut);
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod0Student, nameNode, "text:condition", valueAttribut);
return nodStudent;
}
2022-05-07 20:43:07 +02:00
/**
* Recherche Le node text:section par l'attribut text:name;</br>
* @param nameNode
* @param nodSujet
* @param nod0Student
* @param nod1Student
* @param nod2Student
* @param a
* @return
*/
private static node findByTextName(String nameNode, node nodSujet,node nod0Student, node nod1Student, node nod2Student, Run a) {
node nodStudent = null;
2022-06-16 16:45:48 +02:00
if(nod2Student!=null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod2Student, nameNode, "text:name", evaluation.withoutCodeAndPoint(nodSujet.getAttributs().get("text:name")));
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod1Student, nameNode, "text:name", evaluation.withoutCodeAndPoint(nodSujet.getAttributs().get("text:name")));
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod0Student, nameNode, "text:name", evaluation.withoutCodeAndPoint(nodSujet.getAttributs().get("text:name")));
2022-05-07 20:43:07 +02:00
return nodStudent;
}
2022-05-09 21:22:50 +02:00
/**
*
* @param nameNode
* @param nodSujet
* @param nod0Student
* @param nod1Student
* @param nod2Student
* @param a
* @return
*/
private static node findTextDate(String nameNode, node nodSujet,node nod0Student, node nod1Student, node nod2Student, Run a) {
node nodStudent = null;
2022-06-16 16:45:48 +02:00
String valueAttribut = evaluation.withoutCodeAndPoint(nodSujet.getAttributs().get("text:fixed"));
2022-05-09 21:22:50 +02:00
if(nod2Student!=null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod2Student, nameNode, "text:fixed", valueAttribut);
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod1Student, nameNode, "text:fixed", valueAttribut);
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod0Student, nameNode, "text:fixed", valueAttribut);
return nodStudent;
}
2022-05-07 20:43:07 +02:00
/**
* Recherche le node par son nom.<br>
* Retourne le premier node qui correspond au nom du node.<br>
* Sauf pour les nodes (draw:frame, ...)
2022-05-07 20:43:07 +02:00
* @param nameNode
* @param nodSujet
* @param nod0Student
* @param nod1Student
* @param nod2Student
* @param a
* @return
*/
private static node findByNameNode(String nameNode, node nodSujet,node nod0Student, node nod1Student, node nod2Student, Run a) {
node nodStudent = null;
if(nodSujet.getNomElt().equals("draw:frame")) return null;
2022-05-07 20:43:07 +02:00
if(nod2Student!=null) if(nod2Student.retourneEnfantsByNameExist(nameNode)) nodStudent = nod2Student.retourneFirstEnfantsByName(nameNode);
if(nod1Student!=null) if(nodStudent==null) if(nod1Student.retourneEnfantsByNameExist(nameNode)) nodStudent = nod1Student.retourneFirstEnfantsByName(nameNode);
if(nod0Student!=null) if(nodStudent==null) if(nod0Student.retourneEnfantsByNameExist(nameNode)) nodStudent = nod0Student.retourneFirstEnfantsByName(nameNode);
return nodStudent;
}
/**
* Recherche le node text:database-display par text:column-name.</br>
* @param nameNode
* @param nodSujet
* @param nod0Student
* @param nod1Student
* @param nod2Student
* @param a
* @return
*/
private static node findDataBase(String nameNode, node nodSujet,node nod0Student, node nod1Student, node nod2Student, Run a) {
node nodStudent = null;
2022-06-16 16:45:48 +02:00
String valueAttribut = evaluation.withoutCodeAndPoint(nodSujet.getAttributs().get("text:column-name"));
2022-05-09 21:22:50 +02:00
if(nod2Student!=null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod2Student, nameNode, "text:column-name", valueAttribut);
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod1Student, nameNode, "text:column-name", valueAttribut);
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod0Student, nameNode, "text:column-name", valueAttribut);
2022-05-07 20:43:07 +02:00
return nodStudent;
}
/**
* Recherche le node par le contenu simple get(0).</br>
* Le nom du node doit contenir "text" ou "style:" pour qu'il soit pris en compte.<br>
2022-05-07 20:43:07 +02:00
* @param nameNode
* @param nodSujet
* @param nod0Student
* @param nod1Student
* @param nod2Student
* @param a
* @return
*/
private static node findByContentZero(String nameNode, node nodSujet,node nod0Student, node nod1Student, node nod2Student, Run a) {
node nodStudent = null;
if(nodSujet.getNomElt().contains("text")||nodSujet.getNomElt().contains("style:")) {
if(!nodSujet.getContenu().isEmpty()) {
if(nod2Student!=null) nodStudent = a.retourneFirstNodeByNameContent(nod2Student, nameNode, nodSujet.getContenu().get(0));
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameContent(nod1Student, nameNode, nodSujet.getContenu().get(0));
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameContent(nod0Student, nameNode, nodSujet.getContenu().get(0));
}
2022-05-07 20:43:07 +02:00
}
return nodStudent;
}
/**
* Recherche le node style:tab-stop par style:position.</br>
* Un tolérance de 0.05 est appliquée sur la valeur de la position.</br>
* On peut utiliser les intervalles dans la valeur de l'attribut style:position.</br>
* @param nameNode
* @param nodSujet
* @param nod0Student
* @param nod1Student
* @param nod2Student
* @param a
* @return
*/
private static node findBystylePosition(String nameNode, node nodSujet,node nod0Student, node nod1Student, node nod2Student, Run a) {
double tolerance = 0.05;
String valueAttribut = evaluation.withoutCodeAndPoint(nodSujet.getAttributs().get("style:position"));
if(!valueAttribut.contains("¦")&&!valueAttribut.contains("|")&&!valueAttribut.contains("")&&!valueAttribut.contains("")
&&!valueAttribut.contains("")&&!valueAttribut.contains("×")&&!valueAttribut.contains("")&&!valueAttribut.contains("¢")) {
if(!valueAttribut.contains("")) {
Pattern p3 = Pattern.compile("^[0-9]{0,}\\.[0-9]{0,}|^[0-9]{0,}");
Matcher m3 = p3.matcher(valueAttribut);
if(m3.find()) {
valueAttribut = (valueAttribut.substring(m3.start(), m3.end()));
}else {
System.out.println("Tolérance par défaut du tab-stop");
System.out.println("La valeur du tab-stop du sujet est =" + valueAttribut);
System.out.println("Problème de pattern");
System.out.println("no match avec la valeur du tab-stop du sujet.");
JOptionPane.showMessageDialog(null, "Le fichier d'analyse possède une erreur dans la valeur du tab-stop."
+"\r\nLa valeur est " + valueAttribut+
"\r\nProblème de pattern.","Erreur",JOptionPane.ERROR_MESSAGE);
}
2022-11-26 16:05:52 +01:00
}else {
tolerance = (evaluation.TraitementIntervaleRetourneValeurMaximale(valueAttribut) - evaluation.TraitementIntervaleRetourneValeurMinimale(valueAttribut))/2;
valueAttribut = String.valueOf(evaluation.TraitementIntervaleRetourneValeurMaximale(valueAttribut) - tolerance);
2022-11-26 16:05:52 +01:00
}
}else {
System.out.println("Erreur avec la valeur du tab-stop du sujet.");
System.out.println("Valeur du tab-stop du sujet ="+valueAttribut);
JOptionPane.showMessageDialog(null, "Le fichier d'analyse possède une erreur dans la valeur du tab-stop."
+"\r\nLa valeur est " + valueAttribut,"Erreur",JOptionPane.ERROR_MESSAGE);
}
double ValeurSujet = 0.0;
try {
ValeurSujet = Double.valueOf(valueAttribut);
}catch (Exception e) {
System.out.println("La valeur du tab-stop du sujet est =" + valueAttribut);
System.out.println("Problème de cast en type double");
System.out.println("Valeur tab-stop="+ValeurSujet);
JOptionPane.showMessageDialog(null, "Le fichier d'analyse possède une erreur dans la valeur du tab-stop."
+"\r\nLa valeur est " + valueAttribut+
"\r\nImpossible de convertir la valeur en type Double.", "Erreur",JOptionPane.ERROR_MESSAGE);
}
if(nod2Student!=null) {
ArrayList<node> A = nod2Student.retourneTousLesNodesDeCeNiveauQuiOnAttribut(nameNode, "");
for(int i = 0 ; i < A.size() ; i++) {
String valueAttributStudent = A.get(i).getAttributs().get("style:position");
Pattern p3 = Pattern.compile("^[0-9]{0,}\\.[0-9]{0,}|^[0-9]{0,}");
Matcher m3 = p3.matcher(valueAttributStudent);
double ValeurStudent = 0.0;
if(m3.find()) {
valueAttributStudent = (valueAttributStudent.substring(m3.start(), m3.end()));
}else {
System.out.println("La valeur du tab-stop du student est =" + valueAttributStudent);
System.out.println("Problème de pattern");
System.out.println("no match avec la valeur du tab-stop du student.");
JOptionPane.showMessageDialog(null, "Le fichier de l'étudiant possède une erreur dans la valeur du tab-stop."
+"\r\nLa valeur est " + valueAttribut+
"\r\nProblème de pattern.","Erreur",JOptionPane.ERROR_MESSAGE);
}
ValeurStudent = Double.valueOf(valueAttributStudent);
if((ValeurStudent>ValeurSujet-tolerance)&&(ValeurStudent<ValeurSujet+tolerance)) return A.get(i);
}
}
return null;
}
2022-05-07 20:43:07 +02:00
/**
* Rechercher le node table:table par table:name.</br>
* @param nameNode
* @param nodSujet
* @param nod0Student
* @param nod1Student
* @param nod2Student
* @param a
* @return
*/
private static node findTable(String nameNode, node nodSujet,node nod0Student, node nod1Student, node nod2Student, Run a) {
node nodStudent = null;
2022-06-16 16:45:48 +02:00
if(nod2Student!=null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod2Student, nameNode, "table:name", evaluation.withoutCodeAndPointPourRechercheContenuExact(nodSujet.getAttributs().get("table:name")));
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod1Student, nameNode, "table:name", evaluation.withoutCodeAndPointPourRechercheContenuExact(nodSujet.getAttributs().get("table:name")));
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod0Student, nameNode, "table:name", evaluation.withoutCodeAndPointPourRechercheContenuExact(nodSujet.getAttributs().get("table:name")));
2022-05-07 20:43:07 +02:00
return nodStudent;
}
/**
* Recherche le node par son contenu avec une tolérance de carcatère.</br>
* @param nameNode
* @param nodSujet
* @param nod0Student
* @param nod1Student
* @param nod2Student
* @param a
* @return
*/
private static node findByContentWithTolerance(String nameNode, node nodSujet,node nod0Student, node nod1Student, node nod2Student, Run a) {
node nodStudent = null;
String contenuSujet = nodSujet.retourneLesContenusEnfants("");
if(nod2Student!=null) nodStudent = a.retourneFirstNodeByFindContent2(nod2Student.getNodes(), contenuSujet,commandes.tolerance_characters,commandes.tolerance_text);
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContent2(nod1Student.getNodes(), contenuSujet,commandes.tolerance_characters,commandes.tolerance_text);
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByFindContent2(nod0Student.getNodes(), contenuSujet,commandes.tolerance_characters,commandes.tolerance_text);
return nodStudent;
}
/**
* Rechreche le node par son index même si pas demandé.</br>
* @param nameNode
* @param nodSujet
* @param nod0Student
* @param nod1Student
* @param nod2Student
* @param a
* @return
*/
private static node findByIndexEvenIsFalse(String nameNode, node nodSujet,node nod0Student, node nod1Student, node nod2Student, Run a) {
node nodStudent = null;
if(nodSujet.getAttributs().get("index")!=null){
if(nod2Student!=null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod2Student, nameNode, "index", nodSujet.getAttributs().get("index"));
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod1Student, nameNode, "index", nodSujet.getAttributs().get("index"));
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod0Student, nameNode, "index", nodSujet.getAttributs().get("index"));
}
return nodStudent;
}
/**
* Recherche le node par table:style-name.</br>
* @param nameNode
* @param nodSujet
* @param nod0Student
* @param nod1Student
* @param nod2Student
* @param a
* @return
*/
private static node findTableByStyleName(String nameNode, node nodSujet,node nod0Student, node nod1Student, node nod2Student, Run a) {
node nodStudent = null;
if(nod2Student!=null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod2Student, nameNode, "table:style-name", nodSujet.getAttributs().get("table:style-name"));
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod1Student, nameNode, "table:style-name", nodSujet.getAttributs().get("table:style-name"));
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod0Student, nameNode, "table:style-name", nodSujet.getAttributs().get("table:style-name"));
return nodStudent;
}
2022-04-29 19:17:58 +02:00
}