analyseCalc/src/outils/outils.java

1197 lines
54 KiB
Java
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package outils;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import nodeAC.nodeAC;
public class outils {
private int pointsClass = 0;
private int pointTotal=0;
private int pointEnJeu = 0;
// /**
// *
// * @param code
// * @return
// */
// public static String TraductionWriter(String code) {
//
// //**************************************************************
// //** PARAGRAPHE
// //**************************************************************
//
// //Nom des styles de paragraphe
// if(code.equals("Heading_20_1")) code="<b>Titre 1</b>";
// if(code.equals("Heading_20_2")) code="<b>Titre 2</b>";
// if(code.equals("Heading_20_3")) code="<b>Titre 3</b>";
// if(code.equals("Standard_20__28_user_29_")) code="<b>Standard</b>";
//
//
// // style paragraphe optionnel
// if(code.equals("style:family")) code="<b><i>Optionnel</i></b> <p class=\"p2\">Type de style</p>"; //*
// if(code.equals("style:display-name")) code="<b><i>Optionnel</i></b> <p class=\"p2\">Nom du style affiché</p>"; //*
// if(code.equals("style:class")) code="<b><i>Optionnel</i></b> <p class=\"p2\">Classe</p>"; //*
// if(code.equals("style:default-outline-level")) code="<b><u>Plan & numérotation</i></u> <p class=\"p2\">Niveau de plan</p>"; //*
// if(code.equals("style:name")) code="<b><i>Optionnel</i></b><br/> <p class=\"p2\">Nom du style xml</p>"; //*
// if(code.equals("style:font-family-generic-complex")) code="<b><i>Optionnel</i></b><br/> <p class=\"p2\">Police de caractères générique</p>"; //*
// //*
// if(code.equals("style:justify-single-word")) code="<i><b>Optionnel</b></i><p class=\"p2\">Justifier un seul mot</p>";
// if(code.equals("loext:contextual-spacing")) code="<i><b>Optionnel</b></i><p class=\"p2\">Espacement contextuel</p>";
//
// // style paragraphe gestionnaire
// if(code.equals("style:next-style-name")) code="<b><u>Gestionnaire</u></b> <p class=\"p2\">Style de suite</p>";
// if(code.equals("style:parent-style-name")) code="<b><u>Gestionnaire</u></b> <p class=\"p2\">Hétité de</p>";
//
// // style paragraphe enchaînements
// String colorEn ="#CD5C5C";
// if(code.equals("fo:keep-together")) code="<b><u><span style=\"color:" + colorEn +"\">Enchaînements</span></u></b><p class=\"p2\">Ne pas scinder le paragraphe</p>";
// if(code.equals("fo:keep-with-next")) code="<b><u><span style=\"color:" + colorEn +"\">Enchaînements</span></u></b><p class=\"p2\">Conserver avec le paragraphe suivant</p>";
// if(code.equals("fo:orphans")) code="<b><u><span style=\"color:" + colorEn +"\">Enchaînements</span></u></b><p class=\"p2\">Traitement des orphelines</p>";
// if(code.equals("fo:widows")) code="<b><u><span style=\"color:" + colorEn +"\">Enchaînements</span></u></b><p class=\"p2\">Traitement des veuves</p>";
// if(code.equals("fo:break-after")) code="<b><u><span style=\"color:" + colorEn +"\">Enchaînements</span></u></b><p class=\"p2\">Saut après</p>";
// if(code.equals("fo:break-before")) code="<b><u><span style=\"color:" + colorEn +"\">Enchaînements</span></u></b><p class=\"p2\">Saut avant</p>";
//
//
//
// if(code.equals("style:master-page-name")) code="<b><u><span style=\"color:" + colorEn +"\">Enchaînements</span></u></b> <p class=\"p2\">Saut de page</p>";
// if(code.equals("style:page-number")) code="<b><u><span style=\"color:" + colorEn +"\">Enchaînements</span></u></b> <p class=\"p2\">Numérotation de la page</p>";
//
// // style paragraphe alignement
// if(code.equals("fo:text-align")) code="<b><u>Alignement</u></b><p class=\"p2\">Alignement du paragraphe</p>";
//
// // style paragraphe police
// String colorPo = "#FF8C00";
// if(code.equals("style:font-name")) code="<b><u><span style=\"color:"+ colorPo +"\">Police</span></u></b><p class=\"p2\">Nom de la police de caractères</p>";
// if(code.equals("fo:font-size")) code="<b><u><span style=\"color:"+ colorPo +"\">Police</span></u></b><p class=\"p2\">Taille des caractères</p>";
// if(code.equals("style:font-style-name")) code="<b><u><span style=\"color:"+ colorPo +"\">Police</span></u></b><p class=\"p2\">Style de la police</p>";
// if(code.equals("fo:font-family")) code="<b><u><span style=\"color:"+ colorPo +"\">Police</span></u></b><p class=\"p2\">Famille de police de caractères</p>";
// if(code.equals("fo:font-weight")) code="<b><u><span style=\"color:"+ colorPo +"\">Police</span></u></b><p class=\"p2\">Style <b>\"Gras\"</b></p>";
// if(code.equals("fo:font-style")) code="<b><u><span style=\"color:"+ colorPo +"\">Police</span></u></b><p class=\"p2\">Style de la font</b></p>";
// if(code.equals("style:font-size-asian")) code="<b><u><span style=\"color:"+ colorPo +"\">Police</span></u></b><p class=\"p2\">Taille des caractères</b></p>";
//
//
// //style paragraphe effets de caractère
// String colorEc = "#FF1493";
// if(code.equals("fo:text-shadow")) code="<b><u><span style=\"color:" + colorEc +"\">Effets de caractère</span></u></b><p class=\"p2\">Ombré</p>";
// if(code.equals("fo:font-variant")) code="<b><u><span style=\"color:" + colorEc +"\">Effets de caractère</span></u></b><p class=\"p2\">Petites majuscule</p>";
// if(code.equals("style:text-underline-style")) code="<b><u><span style=\"color:" + colorEc +"\">Effets de caractère</span></u></b><p class=\"p2\">Soulignement</p>";
// if(code.equals("style:text-underline-color")) code="<b><u><span style=\"color:" + colorEc +"\">Effets de caractère</span></u></b><p class=\"p2\">Couleur du soulignement</p>";
// if(code.equals("fo:text-transform")) code="<b><u><span style=\"color:" + colorEc +"\">Effets de caractère</span></u></b><p class=\"p2\"> ... </p>";
// if(code.equals("style:text-underline-type")) code="<b><u><span style=\"color:" + colorEc +"\">Effets de caractère</span></u></b><p class=\"p2\">Type de soulignement</p>";
// if(code.equals("style:text-underline-width")) code="<b><u><span style=\"color:" + colorEc +"\">Effets de caractère</span></u></b><p class=\"p2\">Épaisseur du soulignement</p>";
//
//
//
// // style paragraphe bordures
// String colorB = "#1099FA";
// if(code.equals("fo:border")) code="<b><u><span style=\"color:" + colorB +"\">Bordures</span></u></b><p class=\"p2\">Bordure tout autour</p>";
// if(code.equals("fo:border-bottom")) code="<b><u><span style=\"color:" + colorB +"\">Bordures</span></u></b><p class=\"p2\">Bordure du bas</p>";
// if(code.equals("fo:border-right")) code="<b><u><span style=\"color:" + colorB +"\">Bordures</span></u></b><p class=\"p2\">Bordure de droite</p>";
// if(code.equals("fo:border-top")) code="<b><u><span style=\"color:" + colorB +"\">Bordures</span></u></b><p class=\"p2\">Bordure du haut</p>";
// if(code.equals("fo:border-left")) code="<b><span style=\"color:" + colorB +"\"><u>Bordures</span></u></b><p class=\"p2\">Bordure de gauche</p>";
//
// if(code.equals("fo:padding")) code="<b><u><span style=\"color:" + colorB +"\">Bordures</span></u></b><p class=\"p2\">Remplissage synchronisé</p>";
// if(code.equals("fo:padding-top")) code="<b><u><span style=\"color:" + colorB +"\">Bordures</span></u></b><p class=\"p2\">Remplissage haut</p>";
// if(code.equals("fo:padding-bottom")) code="<b><u><span style=\"color:" + colorB +"\">Bordures</span></u></b><p class=\"p2\">Remplissage bas</p>";
// if(code.equals("fo:padding-left")) code="<b><u><span style=\"color:" + colorB +"\">Bordures</span></u></b><p class=\"p2\">Remplissage gauche</p>";
// if(code.equals("fo:padding-right")) code="<b><u><span style=\"color:" + colorB +"\">Bordures</span></u></b><p class=\"p2\">Remplissage droite</p>";
//
// if(code.equals("style:shadow")) code="<b><u><span style=\"color:" + colorB +"\">Bordures</span></u></b><p class=\"p2\">Ombrage</p>";
//
//
//
//
//
// // style paragraphe retraits et espacement
// if(code.equals("fo:margin-right")) code="<b><u>Retraits et espacement</u></b><p class=\"p2\">Retrait à droite</p>";
// if(code.equals("fo:margin-left")) code="<b><u>Retraits et espacement</u></b><p class=\"p2\">Retrait à gauche</p>";
// if(code.equals("fo:margin-top")) code="<b><u>Retraits et espacement</u></b><p class=\"p2\">Espacement au-dessus</p>";
// if(code.equals("fo:margin-bottom")) code="<b><u>Retraits et espacement</u></b><p class=\"p2\">Espacement sous le paragraphe</p>";
// if(code.equals("fo:line-height")) code="<b><u>Retraits et espacement</u></b><p class=\"p2\">Interligne</p>";
// if(code.equals("fo:text-indent")) code="<b><u>Retraits et espacement</u></b><p class=\"p2\">Retait de première ligne</p>";
// if(code.equals("style:auto-text-indent")) code="<b><u>Retraits et espacement</u></b><p class=\"p2\">Retait de première ligne automatique</p>";
//
//
//
// //**************************************************************
// //** PAGE
// //**************************************************************
//
// if(code.equals("Right_20_page")) code="Page \"Page droite\" (page recto)";
// if(code.equals("Left_20_page")) code="Page \"Page gauche\" (page verso)";
// if(code.equals("Sommaire_20__26__20_Remerciements")) code="Page \"Sommaire & Remerciements\"";
// if(code.equals("First_20_Page")) code="Page \"Première page\"";
// if(code.equals("Dernière_20_page")) code="Page \"Dernière page\"";
// if(code.equals("Tables_20__26__20_Index")) code="Page \"Tables & Index\"";
//
//
// // page
// String colorP = "#A010FA";
// if(code.equals("layout_properties_fo:margin-left")) code="<b><u><span style=\"color:" + colorP +"\">Page</span></u></b><p class=\"p2\">Marge gauche</p>";
// if(code.equals("layout_properties_fo:margin-top")) code="<b><u><span style=\"color:" + colorP +"\">Page</span></u></b><p class=\"p2\">Marge haute</p>";
// if(code.equals("layout_properties_fo:margin-right")) code="<b><u><span style=\"color:" + colorP +"\">Page</span></u></b><p class=\"p2\">Marge droite</p>";
// if(code.equals("layout_properties_fo:margin-bottom")) code="<b><u><span style=\"color:" + colorP +"\">Page</span></u></b><p class=\"p2\">Marge basse</p>";
//
// if(code.equals("layout_properties_style:print-orientation")) code="<b><u><span style=\"color:" + colorP +"\">Page</span></u></b><p class=\"p2\">Orientation page</p>";
// if(code.equals("layout_style:page-usage")) code="<b><u><span style=\"color:" + colorP +"\">Page</span></u></b><p class=\"p2\">Mise en page</p>";
// if(code.equals("layout_fo:page-height")) code="<b><u><span style=\"color:" + colorP +"\">Page</span></u></b><p class=\"p2\">Hauteur de la page</p>";
// if(code.equals("layout_properties_fo:page-width")) code="<b><u><span style=\"color:" + colorP +"\">Page</span></u></b><p class=\"p2\">Largeur de la page</p>";
// if(code.equals("layout_properties_fo:page-height")) code="<b><u><span style=\"color:" + colorP +"\">Page</span></u></b><p class=\"p2\">Hauteur de la page</p>";
// if(code.equals("layout_properties_style:num-format")) code="<b><u><span style=\"color:" + colorP +"\">Page</span></u></b><p class=\"p2\">Format de la numérotation de la page</p>";
//
//
// //Bordure de page
// if(code.equals("layout_fo:border-top")) code="<b><u><span style=\"color:" + colorB +"\">Bordures de page</span></u></b><p class=\"p2\">Bordure haute</p>";
// if(code.equals("layout_fo:border-left")) code="<b><u><span style=\"color:" + colorB +"\">Bordures de page</span></u></b><p class=\"p2\">Bordure gauche</p>";
// if(code.equals("layout_fo:border-right")) code="<b><u><span style=\"color:" + colorB +"\">Bordures de page</span></u></b><p class=\"p2\">Bordure droite</p>";
// if(code.equals("layout_fo:border-bottom")) code="<b><u><span style=\"color:" + colorB +"\">Bordures de page</span></u></b><p class=\"p2\">Bordure basse</p>";
// if(code.equals("layout_properties_fo:padding")) code="<b><u><span style=\"color:" + colorB +"\">Bordures de page</span></u></b><p class=\"p2\">Remplissage synchronisé</p>";
// if(code.equals("layout_properties_fo:border")) code="<b><u><span style=\"color:" + colorB +"\">Bordures de page</span></u></b><p class=\"p2\">Bordures de page</p>";
//
// //Arrière-plan de la page
// String colorAr = "#DAA520";
// if(code.equals("layout_properties_draw:fill-image-name")) code="<b><u><span style=\"color:" + colorAr +"\">Arrière plan de la page</span></u></b><p class=\"p2\">Image</p>";
// if(code.equals("layout_properties_draw:fill")) code="<b><u><span style=\"color:" + colorAr +"\">Arrière plan de la page</span></u></b><p class=\"p2\">Type d'arrière plan de la page</p>";
//
//
// // Entête
// String colorE = "#4B0082";
// if(code.equals("2-header-properties_fo:border-bottom")) code="<b><u><span style=\"color:" + colorE +"\">Entête</span></u></b><p class=\"p2\">Bordure basse</p>";
// if(code.equals("2-header-properties_fo:border-left")) code="<b><u><span style=\"color:" + colorE +"\">Entête</span></u></b><p class=\"p2\">Bordure gauche</p>";
// if(code.equals("2-header-properties_fo:border-right")) code="<b><u><span style=\"color:" + colorE +"\">Entête</span></u></b><p class=\"p2\">Bordure droite</p>";
// if(code.equals("2-header-properties_fo:border-top")) code="<b><u><span style=\"color:" + colorE +"\">Entête</span></u></b><p class=\"p2\">Bordure haute</p>";
// if(code.equals("2-header-properties_fo:border")) code="<b><u><span style=\"color:" + colorE +"\">Entête</span></u></b><p class=\"p2\">Bordures tout autour</p>";
//
//
//
//
// if(code.equals("2-header-properties_fo:margin-bottom")) code="<b><u><span style=\"color:" + colorE +"\">Entête</span></u></b><p class=\"p2\">Marge basse</p>";
// if(code.equals("2-header-properties_fo:margin-left")) code="<b><u><span style=\"color:" + colorE +"\">Entête</span></u></b><p class=\"p2\">Marge gauche</p>";
// if(code.equals("2-header-properties_fo:margin-right")) code="<b><u><span style=\"color:" + colorE +"\">Entête</span></u></b><p class=\"p2\">Marge droite</p>";
//
// if(code.equals("2-header-properties_fo:min-height")) code="<b><u><span style=\"color:" + colorE +"\">Entête</span></u></b><p class=\"p2\">Hauteur minimale de l'entête</p>";
// if(code.equals("2-header-properties_fo:padding")) code="<b><u><span style=\"color:" + colorE +"\">Entête</span></u></b><p class=\"p2\">Remplissage synchronisé</p>";
//
// // Pied de page
// String colorPied = "#FF69B4";
// if(code.equals("4-footer-style_fo:border-bottom")) code="<b><u><span style=\"color:" + colorPied +"\">Pied de page</span></u></b><p class=\"p2\">Bordure basse</p>";
// if(code.equals("4-footer-style_fo:border-left")) code="<b><u><span style=\"color:" + colorPied +"\">Pied de page</span></u></b><p class=\"p2\">Bordure gauche</p>";
// if(code.equals("4-footer-style_fo:border-right")) code="<b><u><span style=\"color:" + colorPied +"\">Pied de page</span></u></b><p class=\"p2\">Bordure droite</p>";
// if(code.equals("4-footer-style_fo:border-top")) code="<b><u><span style=\"color:" + colorPied +"\">Pied de page</span></u></b><p class=\"p2\">Bordure haute</p>";
// if(code.equals("4-footer-style_fo:border")) code="<b><u><span style=\"color:" + colorPied +"\">Pied de page</span></u></b><p class=\"p2\">Bordures tout autour</p>";
//
//
//
//
// if(code.equals("4-footer-style_fo:margin-top")) code="<b><u><span style=\"color:" + colorPied +"\">Pied de page</span></u></b><p class=\"p2\">Marge haute</p>";
// if(code.equals("4-footer-style_fo:margin-left")) code="<b><u><span style=\"color:" + colorPied +"\">Pied de page</span></u></b><p class=\"p2\">Marge gauche</p>";
// if(code.equals("4-footer-style_fo:margin-right")) code="<b><u><span style=\"color:" + colorPied +"\">Pied de page</span></u></b><p class=\"p2\">Marge droite</p>";
// if(code.equals("4-footer-style_fo:margin-bottom")) code="<b><u><span style=\"color:" + colorPied +"\">Pied de page</span></u></b><p class=\"p2\">Marge basse</p>";
//
// if(code.equals("4-footer-style_fo:min-height")) code="<b><u><span style=\"color:" + colorPied +"\">Pied de page</span></u></b><p class=\"p2\">Hauteur minimale de l'entête</p>";
// if(code.equals("4-footer-style_fo:padding")) code="<b><u><span style=\"color:" + colorPied +"\">Pied de page</span></u></b><p class=\"p2\">Remplissage synchronisé</p>";
//
//
// // Champs pied de page
// String colorC = "#FF7F50";
// if(code.equals("footer_text:bookmark-ref_text:ref-name")) code="<b><u><span style=\"color:"+ colorC + "\">Champ dans le pied de page</span></u></b><p class=\"p2\">Champ \"<b>Marque page</b>\"</p>";
// if(code.equals("footer_text:bookmark-ref_text:bookmark-ref_name")) code="<b><u><span style=\"color:"+ colorC + "\">Champ dans le pied de page</span></u></b><p class=\"p2\">Référence du marque page</p>";
// if(code.equals("footer_text:bookmark-ref_text:reference-format")) code="<b><u><span style=\"color:"+ colorC + "\">Champ dans le pied de page</span></u></b><p class=\"p2\">Type de référence du marque page</p>";
// if(code.equals("footer_text:bookmark-ref_text:bookmark-ref_content")) code="<b><u><span style=\"color:"+ colorC + "\">Champ dans le pied de page</span></u></b><p class=\"p2\">Valeur du champ marque page</p>";
//
// if(code.equals("footer_text:page-number_text:page-number_content")) code="<b><u><span style=\"color:"+ colorC + "\">Champ dans le pied de page</span></u></b><p class=\"p2\">Valeur du champ numéro de page</p>";
// if(code.equals("footer_text:page-number_text:page-number_name")) code="<b><u><span style=\"color:"+ colorC + "\">Champ dans le pied de page</span></u></b><p class=\"p2\">Champ \"<b>Numéro de page</b>\"</p>";
// if(code.equals("footer_text:page-number_text:select-page")) code="<b><u><span style=\"color:"+ colorC + "\">Champ dans le pied de page</span></u></b><p class=\"p2\">Valeur du champ sélectionné</p>";
// if(code.equals("footer_text:date_text:date_name")) code="<b><u><span style=\"color:"+ colorC + "\">Champ dans le pied de page</span></u></b><p class=\"p2\">Champ \"<b>Date</b>\"</p>";
// if(code.equals("footer_text:page-count_text:page-count_name")) code="<b><u><span style=\"color:"+ colorC + "\">Champ dans le pied de page</span></u></b><p class=\"p2\">Champ \"<b>Nombre de page</b>\"</p>";
// if(code.equals("footer_text:title_text:title_name")) code="<b><u><span style=\"color:"+ colorC + "\">Champ dans le pied de page</span></u></b><p class=\"p2\">Champ \"<b>Titre</b>\"</p>";
// if(code.equals("footer_text:initial-creator_text:initial-creator_name")) code="<b><u><span style=\"color:"+ colorC + "\">Champ dans le pied de page</span></u></b><p class=\"p2\">Champ \"<b>Auteur</b>\"</p>";
//
//
// // Champs entête
// String colorEnt= "#8B0000";
// if(code.equals("header_text:chapter_text:chapter_content")) code="<b><u><span style=\"color:"+ colorEnt + "\">Champ dans l'entête</span></u></b><p class=\"p2\">Valeur du champ chapitre sélectionné</p>";
// if(code.equals("header_text:chapter_text:chapter_name")) code="<b><u><span style=\"color:"+ colorEnt + "\">Champ dans l'entête</span></u></b><p class=\"p2\">Champ \"<b>Chapitre</b>\"</p>";
// if(code.equals("header_text:chapter_text:display")) code="<b><u><span style=\"color:"+ colorEnt + "\">Champ dans l'entête</span></u></b><p class=\"p2\">Type d'affichage du champ chapitre</p>";
// if(code.equals("header_text:chapter_text:outline-level")) code="<b><u><span style=\"color:"+ colorEnt + "\">Champ dans l'entête</span></u></b><p class=\"p2\">Niveau du plan du chapitre</p>";
//
// if(code.equals("header_text:title_text:title_content")) code="<b><u><span style=\"color:"+ colorEnt + "\">Champ dans l'entête</span></u></b><p class=\"p2\">Valeur du champ titre sélectionné</p>";
// if(code.equals("header_text:title_text:title_name")) code="<b><u><span style=\"color:"+ colorEnt + "\">Champ dans l'entête</span></u></b><p class=\"p2\">Champ \"<b>Titre</b>\"</p>";
// if(code.equals("header_text:title_text:display")) code="<b><u><span style=\"color:"+ colorEnt + "\">Champ dans l'entête</span></u></b><p class=\"p2\">Type d'affichage du champ titre</p>";
// if(code.equals("header_text:title_text:outline-level")) code="<b><u><span style=\"color:"+ colorEnt + "\">Champ dans l'entête</span></u></b><p class=\"p2\">Niveau du plan du titre</p>";
//
// if(code.equals("header_text:page-number_text:page-number_name")) code="<b><u><span style=\"color:"+ colorEnt + "\">Champ dans l'entête</span></u></b><p class=\"p2\">Champ \"<b>Numéro de page</b>\"</p>";
// if(code.equals("header_text:page-count_text:page-count_name")) code="<b><u><span style=\"color:"+ colorEnt + "\">Champ dans l'entête</span></u></b><p class=\"p2\">Champ \"<b>Nombre de page</b>\"</p>";
// if(code.equals("header_text:initial-creator_text:initial-creator_name")) code="<b><u><span style=\"color:"+ colorEnt + "\">Champ dans l'entête</span></u></b><p class=\"p2\">Champ \"<b>Auteur</b>\"</p>";
// if(code.equals("header_text:date_text:date_name")) code="<b><u><span style=\"color:"+ colorEnt + "\">Champ dans l'entête</span></u></b><p class=\"p2\">Champ \"<b>Date</b>\"</p>";
//
// String colorCol= "#FF4040";
// if(code.equals("column_fo:column-count")) code="<b><u><span style=\"color:"+ colorCol + "\">Colonnes</span></u></b><p class=\"p2\">Nombre de colonne</p>";
// if(code.equals("column_fo:column-gap")) code="<b><u><span style=\"color:"+ colorCol + "\">Colonnes</span></u></b><p class=\"p2\">Gouttière : distance entre deux colonnes</p>";
//
//
// // traduction style de page
// if(code.equals("Sommaire_20__26__20_Remerciements")) code="Sommaire & Remerciements";
// if(code.equals("First_20_Page")) code="Première page";
// if(code.equals("Tables_20__26__20_Index")) code="Tables & Index";
// if(code.equals("Right_20_Page")) code="Page droite";
// if(code.equals("Left_20_Page")) code="Page gauche";
// if(code.equals("Dernière_20_page")) code="Dernière page";
//
// //style page
// if(code.equals("layout_fo:page-width")) code="<b><u>Page</u></b><p class=\"p2\">Largeur de la page</p>";
//
// if(code.equals("layout_draw:fill-image-name")) code="<b><i>Optionnel</u></i><p class=\"p2\">Image d'arrière-plan</p>"; //*
// if(code.equals("layout_fo:margin-bottom")) code="<b><u>Page</u></u><p class=\"p2\">Espacement sous l'en-tête</p>";
// if(code.equals("layout_fo:margin-top")) code="<b><u>Page</u></u><p class=\"p2\">Marge en haut</p>";
// if(code.equals("layout_fo:margin-right")) code="<b><u>Page</u></u><p class=\"p2\">Marge à droite</p>";
// if(code.equals("layout_fo:margin-left")) code="<b><u>Page</u></u><p class=\"p2\">Marge à gauche</p>";
//
//
//
// //**************************************************************
// //** CADRE & IMAGE
// //**************************************************************
//
//
// String colorT = "#4B0082"; // type
// String colorBc = "#8A2BE2"; // bordure cadre
// String colorAc = "#6495ED"; // adaptatioin cadre
// String colorPc = "#D2691E"; //position cadre
// String colorLc = "#FF5080"; //légende
//
// // optionnelle
// if(code.equals("draw:style-name")) code="<b><i>Optionnel</u></i><p class=\"p2\">Nom du style du cadre ou de l'image</p>";
// if(code.equals("style-style:name")) code="<b><i>Optionnel</u></i><p class=\"p2\">Nom du style du cadre ou de l'image</p>";
// if(code.equals("style-style:protect")) code="<b><u>Options</u></b><p class=\"p2\">Protections</p>";
//
// // type
// if(code.equals("draw:name")) code="<b><u><span style=\"color:" + colorT +"\">Type</span></u></b><p class=\"p2\">Nom de l'objet</p>";
// if(code.equals("text:anchor-type")) code="<b><u><span style=\"color:" + colorT +"\">Type</span></u></b><p class=\"p2\">Type d'ancrage</p>";
// if(code.equals("text:anchor-page-number")) code="<b><u><span style=\"color:" + colorT +"\">Type</span></u></b><p class=\"p2\">Ancrage dans la page numéro</p>";
// if(code.equals("svg:width")) code="<b><u><span style=\"color:" + colorT +"\">Type</span></u></b><p class=\"p2\">Largeur</p>";
// if(code.equals("fo:min-height")) code="<b><u><span style=\"color:" + colorT +"\">Type</span></u></b><p class=\"p2\">Hauteur minimale</p>";
//
// if(code.equals("style:rel-width")) code="<b><u><span style=\"color:" + colorT +"\">Type</span></u></b><p class=\"p2\">Largeur par rapport à</p>";
// if(code.equals("style:rel-height")) code="<b><u><span style=\"color:" + colorT +"\">Type</span></u></b><p class=\"p2\">Hauteur par rapport à</p>";
// if(code.equals("svg:height")) code="<b><u><span style=\"color:" + colorT +"\">Type</span></u></b><p class=\"p2\">Hauteur</p>";
//
// //adapter
// if(code.equals("style-fo:margin-bottom")) code="<b><u><span style=\"color:" + colorAc +"\">Adapter</span></u></b><p class=\"p2\">Espacement en bas</p>";
// if(code.equals("style-fo:margin-right")) code="<b><u><span style=\"color:" + colorAc +"\">Adapter</span></u></b><p class=\"p2\">Espacement à droite</p>";
// if(code.equals("style-fo:margin-top")) code="<b><u><span style=\"color:" + colorAc +"\">Adapter</span></u></b><p class=\"p2\">Espacement en haut</p>";
// if(code.equals("style-fo:margin-left")) code="<b><u><span style=\"color:" + colorAc +"\">Adapter</span></u></b><p class=\"p2\">Espacement à gauche</p>";
//
// if(code.equals("style-style:wrap")) code="<b><u><span style=\"color:" + colorAc +"\">Adapter</span></u></b><p class=\"p2\">Adaptation du texte</p>";
// if(code.equals("style-style:number-wrapped-paragraphs")) code="<b><u><span style=\"color:" + colorAc +"\">Adapter</span></u></b><p class=\"p2\">Nombre de ligne adaptée</p>";
// if(code.equals("style-style:wrap-contour")) code="<b><u><span style=\"color:" + colorAc +"\">Adapter</span></u></b><p class=\"p2\">Contour</p>";
//
//
//
//
// //position
// if(code.equals("style-style:horizontal-pos")) code="<b><u><span style=\"color:" + colorPc +"\">Position</span></u></b><p class=\"p2\">Horizontale</p>";
// if(code.equals("style-style:horizontal-rel")) code="<b><u><span style=\"color:" + colorPc +"\">Position</span></u></b><p class=\"p2\">Horizontalement par rapport à </p>";
// if(code.equals("style-style:vertical-pos")) code="<b><u><span style=\"color:" + colorPc +"\">Position</span></u></b><p class=\"p2\">Verticale</p>";
// if(code.equals("style-style:vertical-rel")) code="<b><u><span style=\"color:" + colorPc +"\">Position</span></u></b><p class=\"p2\">Verticalement par rapport à</p>";
// if(code.equals("svg:y")) code="<b><u><span style=\"color:" + colorPc +"\">Position</span></u></b><p class=\"p2\">Position Y verticale</p>";
// if(code.equals("svg:x")) code="<b><u><span style=\"color:" + colorPc +"\">Position</span></u></b><p class=\"p2\">Position X horizontale</p>";
//
//
//
// //légende
// if(code.equals("Contenu")) code="<b><u><span style=\"color:" + colorLc +"\">Légende</span></u></b><p class=\"p2\"></p>";
// if(code.equals("ContenuSequence")) code="<b><u><span style=\"color:" + colorLc +"\">Légende</span></u></b><p class=\"p2\">Valeur de la variable de séquence</p>";
// if(code.equals("text:style-name")) code="<b><u><span style=\"color:" + colorLc +"\">Légende</span></u></b><p class=\"p2\">Nom de variable de séquence</p>";
// if(code.equals("text:name")) code="<b><u><span style=\"color:" + colorLc +"\">Légende</span></u></b><p class=\"p2\">Nom2 de variable de séquence</p>";
//
//
//
//
// if(code.equals("style-fo:padding")) code="<b><u><span style=\"color:" + colorBc +"\">Bordures</span></u></b><p class=\"p2\">Remplissage</p>";
// if(code.equals("style-fo:border")) code="<b><u><span style=\"color:" + colorBc +"\">Bordures</span></u></b><p class=\"p2\">Bordures</p>";
//
//
// // index
// if(code.equals("text:protected")) code="<b><u><span style=\"color:" + colorBc +"\">Protection</span></u></b><p class=\"p2\">Protection contre les modifications manuelles</p>";
//
//
//
//
//
// return code;
// }
//
/**
* Compare les String A et B.
* La String B contient le poids de la note après le symbole ‽
* Les String ne sont pas nettoyées avant comparaisons.
*
* @param A : String du fichier remis
* @param B : string du fichier consigne (sujet) avec le symbole ‽ pour la notation
* @return une String contenant "Correct" , "Erreur" ou "Optionnel".
* @throws UnsupportedEncodingException
*/
public String Compare1(String A, String Sujet ) throws UnsupportedEncodingException {
String pointString = "" ;
this.pointEnJeu=0;
if(Sujet!=null) if(Sujet.contains("")) {
if(Sujet.contains("")) { // suppression des dollars $
Sujet = SupprimeDollar(Sujet);
A = SupprimeDollar(A);
}
if(Sujet.contains("¬")) { // suppression des dollars $
Sujet = SupprimeEpaces(Sujet);
A = SupprimeEpaces(A);
}
pointString = TraitePoint(Sujet);
Sujet=Sujet.substring(0, Sujet.indexOf(""));
}
if(this.pointEnJeu==0) return "Optionnel";
//intervalles de valeurs avec le symbole →
if(Sujet.contains("") && A!=null && !Sujet.contains("#") && !Sujet.contains("¦")) {
if (TraitementIntervalle(A,Sujet).equals("Correct : ")) {
IncrementPointClass(this.pointEnJeu);
return "Correct : +" + pointString;
}else {
return "Erreur : -" + pointString;
}
}
//intervalles de valeurs avec le symbole → et OU strict
if(Sujet.contains("") && A!=null && !Sujet.contains("#") && Sujet.contains("¦")) {
if (TraitementIntervalleOUExact(A,Sujet).equals("Correct : ")) {
IncrementPointClass(this.pointEnJeu);
return "Correct : +" + pointString;
}else {
return "Erreur : -" + pointString;
}
}
// bordures
if(Sujet.contains("#") && Sujet.contains("pt") && A!=null) {
if(TraitementBordure(Sujet,A).equals("Correct : ")) {
IncrementPointClass(this.pointEnJeu);
return "Correct : +" + pointString;
}else {
return "Erreur : -" + pointString;
}
}
// Couleur
if(Sujet.contains("#") && !Sujet.contains("pt") && Sujet.length()==7 && A!=null) {
String reponse = TraitementCouleur(Sujet,A);
if(reponse.contains("Correct")) {
IncrementPointClass(this.pointEnJeu);
return reponse + pointString;
}else {
return reponse + pointString;
}
}
// Condition OU exacte la valeur null est prise en compte dans la fonction TraitementOUExact
if(Sujet.contains("¦") && (A!=null || (A==null && Sujet.contains("null")))) {
if(TraitementOUExact(A,Sujet).equals("Correct : ")) {
IncrementPointClass(this.pointEnJeu);
return "Correct : +" + pointString;
}else {
return "Erreur : -" + pointString;
}
}
//Opérateur OU avec néttoyage ponctuation, case, espace, retour à la ligne, tabulation
if(Sujet.contains("")) {
if(TraitementOU(A,Sujet).equals("Correct : ")) {
IncrementPointClass(this.pointEnJeu);
return "Correct : +" + pointString;
}else {
return "Erreur : -" + pointString;
}
}
//Opérateur OU avec nettoyage des chiffres
if(Sujet.contains("")) {
if(TraitementOUSupprimeChiffreEtsansCase(A,Sujet).equals("Correct : ")) {
IncrementPointClass(this.pointEnJeu);
return "Correct : +" + pointString;
}else {
return "Erreur : -" + pointString;
}
}
if(A!=null)if(A.equals("auto")) A=null;
if(Sujet!=null)if(Sujet.equals("auto")) Sujet=null;
if(A!=null) if(A.equals("0cm")) A=null;
if(Sujet!=null) if(Sujet.equals("0cm")) Sujet=null;
if(A!=null) if(A.equals("none")) A=null;
if(Sujet!=null) if(Sujet.equals("none")) Sujet=null;
if(A!=null) if(A.isEmpty()) A=null;
if(Sujet!=null) if(Sujet.isEmpty()) Sujet=null;
if(A!=null) if(A.equals("0")) A=null;
if(Sujet!=null) if(Sujet.equals("0")) Sujet=null;
if(A!=null) if(A.equals("null")) A=null;
if(Sujet!=null) if(Sujet.equals("null")) Sujet=null;
if(A!=null) if(A.equals("false")) A=null;
if(Sujet!=null) if(Sujet.equals("false")) Sujet=null;
if(A!=null) if(Sujet==null) if(!pointString.isEmpty()) { return "Erreur : -" + pointString;}
if(A!=null) if(Sujet==null) if(pointString.isEmpty()) {return "Erreur";}
if(A==null) if(Sujet==null) if(!pointString.isEmpty()){IncrementPointClass(this.pointEnJeu); return "Correct : +" + pointString;}
if(A==null) if(Sujet==null) if(pointString.isEmpty()) {IncrementPointClass(this.pointEnJeu); return "Correct";}
if(A==null) if(Sujet!=null) if(!pointString.isEmpty()) return "Erreur : -" + pointString;
if(A==null) if(Sujet!=null) if(pointString.isEmpty()) return "Erreur";
if(!pointString.isEmpty()) {
if(A.equals(Sujet)){
IncrementPointClass(this.pointEnJeu);
return "Correct : +" + pointString;}
else {
return "Erreur : -" + pointString;
}
}else {
if(A.equals(Sujet)){
IncrementPointClass(this.pointEnJeu);
return "Correct";}
else {
return "Erreur";
}
}
}
/**
* Compare les String A et B.
* La String B contient le poids de la note après le symbole ‽
* Les String sont nettoyées avant comparaisons avec nettoyage des digites 0 à 20 en fin de chaîne.
*
* @param A : String du fichier remis
* @param B : string du fichier consigne (sujet) avec le symbole ‽ pour la notation
* @return une String contenant "Correct" , "Erreur" ou "Optionnel".
*/
public String TraitePoint(String B) {
int point = 0;
this.pointEnJeu=0;
String pointString ="";
if(B!=null) if(B.contains("")) if(B.length()>1) {
String p = B.substring(B.indexOf("")+1,B.length());
if(!p.isEmpty()) { point = Integer.valueOf(p);} else {point=0;}
}
pointString="";
if(point==1) {pointString="1 pt"; IncrementPointTotal(1);this.pointEnJeu=1;}
if(point==2) {pointString="2 pt"; IncrementPointTotal(2); this.pointEnJeu=2;}
if(point==3) {pointString="3 pt"; IncrementPointTotal(3); this.pointEnJeu=3;}
if(point==4) {pointString="4 pt"; IncrementPointTotal(4); this.pointEnJeu=4;}
if(point==5) {pointString="5 pt"; IncrementPointTotal(5); this.pointEnJeu=5;}
if(point==6) {pointString="6 pt"; IncrementPointTotal(6); this.pointEnJeu=6;}
if(point==7) {pointString="7 pt"; IncrementPointTotal(7); this.pointEnJeu=7;}
if(point==8) {pointString="8 pt"; IncrementPointTotal(8); this.pointEnJeu=8;}
if(point==9) {pointString="9 pt"; IncrementPointTotal(9); this.pointEnJeu=9;}
if(point==10) {pointString="10 pt"; IncrementPointTotal(10); this.pointEnJeu=10;}
if(point==11) {pointString="11 pt"; IncrementPointTotal(11); this.pointEnJeu=11;}
if(point==12) {pointString="12 pt"; IncrementPointTotal(12); this.pointEnJeu=12;}
if(point==13) {pointString="13 pt"; IncrementPointTotal(13); this.pointEnJeu=13;}
if(point==14) {pointString="14 pt"; IncrementPointTotal(14); this.pointEnJeu=14;}
if(point==15) {pointString="15 pt"; IncrementPointTotal(15); this.pointEnJeu=15;}
if(point==16) {pointString="16 pt"; IncrementPointTotal(16); this.pointEnJeu=16;}
if(point==17) {pointString="17 pt"; IncrementPointTotal(17); this.pointEnJeu=17;}
if(point==18) {pointString="18 pt"; IncrementPointTotal(18); this.pointEnJeu=18;}
if(point==19) {pointString="19 pt"; IncrementPointTotal(19); this.pointEnJeu=19;}
if(point==20) {pointString="20 pt"; IncrementPointTotal(20); this.pointEnJeu=20;}
if(point==21) {pointString="21 pt"; IncrementPointTotal(21); this.pointEnJeu=21;}
if(point==22) {pointString="22 pt"; IncrementPointTotal(22); this.pointEnJeu=22;}
if(point==23) {pointString="23 pt"; IncrementPointTotal(23); this.pointEnJeu=23;}
if(point==24) {pointString="24 pt"; IncrementPointTotal(24); this.pointEnJeu=24;}
if(point==25) {pointString="25 pt"; IncrementPointTotal(25); this.pointEnJeu=25;}
if(point==26) {pointString="26 pt"; IncrementPointTotal(26); this.pointEnJeu=26;}
if(point==27) {pointString="27 pt"; IncrementPointTotal(27); this.pointEnJeu=27;}
if(point==28) {pointString="28 pt"; IncrementPointTotal(28); this.pointEnJeu=28;}
if(point==29) {pointString="29 pt"; IncrementPointTotal(29); this.pointEnJeu=29;}
if(point==30) {pointString="30 pt"; IncrementPointTotal(30); this.pointEnJeu=30;}
if(point==31) {pointString="31 pt"; IncrementPointTotal(31); this.pointEnJeu=31;}
if(point==32) {pointString="32 pt"; IncrementPointTotal(32); this.pointEnJeu=32;}
if(point==33) {pointString="33 pt"; IncrementPointTotal(33); this.pointEnJeu=33;}
if(point==34) {pointString="34 pt"; IncrementPointTotal(34); this.pointEnJeu=34;}
if(point==35) {pointString="35 pt"; IncrementPointTotal(35); this.pointEnJeu=35;}
if(point==36) {pointString="36 pt"; IncrementPointTotal(36); this.pointEnJeu=36;}
if(point==37) {pointString="37 pt"; IncrementPointTotal(37); this.pointEnJeu=37;}
if(point==38) {pointString="38 pt"; IncrementPointTotal(38); this.pointEnJeu=38;}
if(point==39) {pointString="39 pt"; IncrementPointTotal(39); this.pointEnJeu=39;}
if(point==40) {pointString="40 pt"; IncrementPointTotal(40); this.pointEnJeu=40;}
if(point==41) {pointString="41 pt"; IncrementPointTotal(41); this.pointEnJeu=41;}
if(point==42) {pointString="42 pt"; IncrementPointTotal(42); this.pointEnJeu=42;}
if(point==43) {pointString="43 pt"; IncrementPointTotal(43); this.pointEnJeu=43;}
if(point==44) {pointString="44 pt"; IncrementPointTotal(44); this.pointEnJeu=44;}
if(point==45) {pointString="45 pt"; IncrementPointTotal(45); this.pointEnJeu=45;}
if(point==46) {pointString="46 pt"; IncrementPointTotal(46); this.pointEnJeu=46;}
if(point==47) {pointString="47 pt"; IncrementPointTotal(47); this.pointEnJeu=47;}
if(point==48) {pointString="48 pt"; IncrementPointTotal(48); this.pointEnJeu=48;}
if(point==49) {pointString="49 pt"; IncrementPointTotal(49); this.pointEnJeu=49;}
if(point==50) {pointString="50 pt"; IncrementPointTotal(50); this.pointEnJeu=50;}
if(point==51) {pointString="51 pt"; IncrementPointTotal(51); this.pointEnJeu=51;}
if(point==52) {pointString="52 pt"; IncrementPointTotal(52); this.pointEnJeu=52;}
if(point==53) {pointString="53 pt"; IncrementPointTotal(53); this.pointEnJeu=53;}
if(point==54) {pointString="54 pt"; IncrementPointTotal(54); this.pointEnJeu=54;}
if(point==55) {pointString="55 pt"; IncrementPointTotal(55); this.pointEnJeu=55;}
if(point==56) {pointString="56 pt"; IncrementPointTotal(56); this.pointEnJeu=56;}
if(point==57) {pointString="57 pt"; IncrementPointTotal(57); this.pointEnJeu=57;}
if(point==58) {pointString="58 pt"; IncrementPointTotal(58); this.pointEnJeu=58;}
if(point==59) {pointString="59 pt"; IncrementPointTotal(59); this.pointEnJeu=59;}
if(point==60) {pointString="60 pt"; IncrementPointTotal(60); this.pointEnJeu=60;}
if(point==61) {pointString="61 pt"; IncrementPointTotal(61); this.pointEnJeu=61;}
if(point==62) {pointString="62 pt"; IncrementPointTotal(62); this.pointEnJeu=62;}
if(point==63) {pointString="63 pt"; IncrementPointTotal(63); this.pointEnJeu=63;}
if(point==64) {pointString="64 pt"; IncrementPointTotal(64); this.pointEnJeu=64;}
if(point==65) {pointString="65 pt"; IncrementPointTotal(65); this.pointEnJeu=65;}
if(point==66) {pointString="66 pt"; IncrementPointTotal(66); this.pointEnJeu=66;}
if(point==67) {pointString="67 pt"; IncrementPointTotal(67); this.pointEnJeu=67;}
if(point==68) {pointString="68 pt"; IncrementPointTotal(68); this.pointEnJeu=68;}
if(point==69) {pointString="69 pt"; IncrementPointTotal(69); this.pointEnJeu=69;}
if(point==70) {pointString="70 pt"; IncrementPointTotal(70); this.pointEnJeu=70;}
if(point==71) {pointString="71 pt"; IncrementPointTotal(71); this.pointEnJeu=71;}
return pointString;
}
/**
* Traitement des intervalles simple
* @return
*/
private String TraitementIntervalle(String A, String Sujet) {
if(A.length()==0) {
return "Erreur : ";
}
String Text[] = Sujet.split("");
// rechercher un digite une ou plusieur fois en fin.
Pattern p = Pattern.compile("[^0-9\\.]");
// création du moteur associé à la regex sur la chaîne A
// Matcher m0 = p.matcher(Text[0]);
// remplacement de toutes les occurrences par ""
Text[0]= p.matcher(Text[0]).replaceAll("");
Text[1] = p.matcher(Text[1]).replaceAll("");
A = p.matcher(A).replaceAll("");
double b0 = Double.valueOf(Text[0]);
double b1 = Double.valueOf(Text[1]);
double v = 0;
try {
v = Double.valueOf(A);
}catch(Exception e) {
return "Erreur : ";
}
if(v<=b1 && v>=b0 ) return "Correct : ";
return "Erreur : ";
}
/**
* Tritaement des tollérance et des OU exact
* @param A
* @param Sujet
* @return
*/
private String TraitementIntervalleOUExact(String A, String Sujet) {
if(A.length()==0) {
return "Erreur : ";
}
String TextB[] = Sujet.split("¦");
for(int i=0;i<TextB.length;i++) {
if (TextB[i].equals("null")) TextB[i]="none";
if (TextB[i].isEmpty()) TextB[i]="none";
String Text[] = TextB[i].split("");
// rechercher un digite une ou plusieur fois en fin.
Pattern p = Pattern.compile("[^0-9\\.]");
// création du moteur associé à la regex sur la chaîne A
// Matcher m0 = p.matcher(Text[0]);
// remplacement de toutes les occurrences par ""
Text[0]= p.matcher(Text[0]).replaceAll("");
Text[1] = p.matcher(Text[1]).replaceAll("");
A = p.matcher(A).replaceAll("");
double b0 = Double.valueOf(Text[0]);
double b1 = Double.valueOf(Text[1]);
double v = 0;
try {
v = Double.valueOf(A);
}catch(Exception e) {
return "Erreur : ";
}
if(v<=b1 && v>=b0 ) return "Correct : ";
}
return "Erreur : ";
}
private String TraitementBordure(String Sujet, String B) {
if(Sujet.isEmpty()) return "Erreur : ";
String TextB[] = B.split(" ");
String TextA[] = Sujet.split(" ");
if(TextB.length!=3 || TextA.length!=3) return "Erreur : ";
boolean taille = false;
boolean type = false;
boolean couleur =false;
// traitement de la taille (epaisseur du trait)
if(TextA[0].contains("")) {
if(TraitementIntervalle(TextB[0], TextA[0]).equals("Correct : ")) taille = true;
if(TextB[0].equals("thin")) {
if(TextA[0].equals("0.05pt→0.1pt")) taille = true;
}
}else {
double tailleA = Double.valueOf(TextA[0].replace("pt",""));
double tailleB = Double.valueOf(TextB[0].replace("pt",""));
double IT = 0.02;
if((tailleA<tailleB+IT) && (tailleA>tailleB-IT))taille = true;
}
// traitement du type de trait
String typeA = TextA[1];
String typeB = TextB[1];
//trait pointillé
if(typeA.equals("dash-dot")) typeA="dashed";
if(typeB.equals("dash-dot")) typeB="dashed";
if(typeA.equals("dotted")) typeA="dashed";
if(typeB.equals("dotted")) typeB="dashed";
if(typeA.equals("fine-dashed")) typeA="dashed";
if(typeB.equals("fine-dashed")) typeB="dashed";
if(typeB.equals("dash-dot-dot")) typeB="dashed";
if(typeA.equals("dash-dot-dot")) typeA="dashed";
if(typeA.equals("double-thin")) typeA="double";
if(typeB.equals("double-thin")) typeB="double";
if(typeA.equals("outset")) typeA="double";
if(typeB.equals("outset")) typeB="double";
if(typeA.equals("inset")) typeA="double";
if(typeB.equals("inset")) typeB="double";
if(typeA.equals("groove")) typeA="solid";
if(typeB.equals("groove")) typeB="solid";
if(typeA.equals("ridge")) typeA="solid";
if(typeB.equals("ridge")) typeB="solid";
if(typeA.equals(typeB)) type=true;
// traitement de la couleur du trait
String couleurA = TextA[2].replace("#", "");
String couleurB = TextB[2].replace("#", "");
if(couleurA.equals(couleurB)) couleur = true;
if(!couleur) {
if(TraitementCouleur(couleurA, couleurB).equals("Correct : ")) {
couleur =true;
}
// int Ared = Integer.parseInt(couleurA.substring(0, 2),16);
// int Agreen = Integer.parseInt(couleurA.substring(2, 4),16);
// int Ablue = Integer.parseInt(couleurA.substring(4, 6),16);
//
// int Bred = Integer.parseInt(couleurB.substring(0, 2),16);
// int Bgreen = Integer.parseInt(couleurB.substring(2, 4),16);
// int Bblue = Integer.parseInt(couleurB.substring(4, 6),16);
//
// // couleur dominante
// if(Ared>Agreen+10 && Ared>Ablue+10 && Bred>Bgreen+10 && Bred>=Bblue+10) couleur=true;
// if(Agreen>Ared+10 && Agreen>Ablue+10 && Bgreen>Bred+10 && Bgreen>Bblue+10) couleur = true;
// if(Ablue>Ared+10 && Ablue>Agreen+10 & Bblue>Bred+10 && Bblue>Bgreen+10) couleur = true;
}
if(taille && type && couleur) return "Correct : ";
return "Erreur : ";
}
/**
* Traitement de la couleur pour comparaison
* @param A
* @param B
* @return
*/
private String TraitementCouleur(String A, String B) {
if(A.isEmpty()) return "Erreur : ";
// traitement de la couleur du trait
String couleurA = A.replace("#", "");
String couleurB = B.replace("#", "");
if(couleurA.equals(couleurB)) return "Correct : ";
if(couleurA.length()==6 && couleurB.length()==6) {
int Ared = Integer.parseInt(couleurA.substring(0, 2),16);
int Agreen = Integer.parseInt(couleurA.substring(2, 4),16);
int Ablue = Integer.parseInt(couleurA.substring(4, 6),16);
int Bred = Integer.parseInt(couleurB.substring(0, 2),16);
int Bgreen = Integer.parseInt(couleurB.substring(2, 4),16);
int Bblue = Integer.parseInt(couleurB.substring(4, 6),16);
// couleur dominante avec 10 niveau
if(Ared>Agreen+10 && Ared>Ablue+10 && Bred>Bgreen+10 && Bred>=Bblue+10) return "Correct : ";//couleur=true; //Couleur dominante rouge
if(Agreen>Ared+10 && Agreen>Ablue+10 && Bgreen>Bred+10 && Bgreen>Bblue+10) return "Correct : "; //couleur = true; //Couleur dominante vert
if(Ablue>Ared+10 && Ablue>Agreen+10 && Bblue>Bred+10 && Bblue>Bgreen+10) return "Correct : "; //couleur = true; //Couleur dominante bleu
if(Ablue==Ared && Ablue==Agreen && Bblue==Bred && Bblue==Bgreen) return "Correct : "; //couleur = true; //Couleur gris (tous les gris)
if(procheCouleur(Ared,Bred,Agreen,Bgreen,Ablue,Bblue)) return "Correct : "; //couleur = true; //Couleur gris (tous les gris)
}
//if(couleur) return "Correct : ";
return "Erreur : ";
}
/**
* couleur proche
* @param S1
* @param S2
* @return
*/
private Boolean procheCouleur(int R1, int R2, int V1, int V2, int B1, int B2) {
int ecartR = Math.abs(R1-R2);
int ecartV = Math.abs(V1-V2);
int ecartB = Math.abs(B1-B2);
int sommeEcrat = ecartR+ecartV+ecartB;
if(sommeEcrat < 135) return true;
return false;
}
/**
* Traitement des conditions OU
* @param A
* @param B
* @return
* @throws UnsupportedEncodingException
*/
private String TraitementOU(String Student, String Sujet) throws UnsupportedEncodingException {
if(Student==null) Student="none";
if(Student.isEmpty()) Student="none";
if(Sujet.contains("null")) Sujet=Sujet.replace("null", "none");
Student=Student.trim().toLowerCase();
Sujet=Sujet.trim().toLowerCase();
Student=NetTexte(Student,"");
// Sujet=NetTexte(Sujet,"↕");
String TextB[] = Sujet.split("");
for(int i=0;i<TextB.length;i++) {
TextB[i] = NetTexte(TextB[i],"");
if(Student.equals(TextB[i])) return "Correct : ";
}
return "Erreur : ";
}
/**
* Traitement des conditions OU exactes
* @param A
* @param B
* @return
*/
private String TraitementOUExact(String A, String B) {
if(A==null) A="none";
if(A.isEmpty()) A="none";
String TextB[] = B.split("¦");
for(int i=0;i<TextB.length;i++) {
if (TextB[i].equals("null")) TextB[i]="none";
if (TextB[i].isEmpty()) TextB[i]="none";
if(A.equals(TextB[i])) return "Correct : ";
}
return "Erreur : ";
}
/**
* Traitement des conditions OU en supprimant les chiffres
* @param A
* @param B
* @return
*/
private String TraitementOUSupprimeChiffreEtsansCase(String A, String B) {
if(A==null) { return "Erreur : ";}
if(A.isEmpty()) { return "Erreur : ";}
if(A.equals("null")) { return "Erreur : ";}
Pattern p = Pattern.compile("[0-9]");
Matcher m = p.matcher(A);
A= m.replaceAll("");
A=A.toLowerCase();
m = p.matcher(B);
B= m.replaceAll("");
B=B.toLowerCase();
String TextB[] = B.split("");
for(int i=0;i<TextB.length;i++) {
if(A.equals(TextB[i].toLowerCase())) return "Correct : ";
}
return "Erreur : ";
}
/**
* Supprime les dollars
* @param A
* @return
*/
private String SupprimeDollar(String A) {
if (A==null) return A;
if (A.isEmpty()) return A;
A = A.replace("", "");
A = A.replace("$", "");
return A;
}
/**
* Supprime les espaces
* @param A
* @return
*/
private String SupprimeEpaces(String A) {
if (A==null) return A;
if (A.isEmpty()) return A;
A = A.replace("¬", "");
A = A.replace(" ", "");
return A;
}
/**
* Sans les point
* @param B
* @return
*/
public static String withoutPoint(String B) {
if(B!=null) if(B.contains("")) {
B=B.substring(0, B.indexOf(""));
}
return B;
}
/**
* Supprime les caractères accentués, les espaces, etc...
* @param A
* @return
* @throws UnsupportedEncodingException
*/
public static String NetTexte(String A, String exception) throws UnsupportedEncodingException {
// boolean zz = false;
if (A!=null) {
ArrayList<Integer> table1 = new ArrayList<Integer>();
byte[] V = A.getBytes();
if(exception.isEmpty()) {
byte[] W = new byte[V.length];
int c =0;
for(int i = 0 ; i < V.length;i++) {
if(V[i]>0) {
//if (V[i]!=63 && V[i]!=-128 && V[i]!=-103) { //63 les accents é ; -128 le symbole € -30,-128,-103 l'apostrophe
W[c]=V[i];
table1.add((int) W[c]);
c++;
}
}
A = new String(W,"UTF-8");
}
A=A.toLowerCase().trim();
A=A.replace("@", "");
A=A.replace("?", "");
A=A.replace("!", "");
A=A.replace("α", "");
A=A.replace("β", "");
A=A.replace("γ", "");
A=A.replace("δ", "");
A=A.replace("ε", "");
A=A.replace("σ", "");
A=A.replace("τ", "");
A=A.replace("ζ", "");
A=A.replace("η", "");
A=A.replace("θ", "");
A=A.replace("ι", "");
A=A.replace("", "'");
A=A.replace("Þ", "");
A=A.replace(" ", "");
A=A.replace("'", "");
A=A.replace("?", "");
A=A.replace("", "");
A=A.replace("&apos;","");
A=A.replace("&amp;","");
A=A.replace("&","");
A=A.replace("", "");
A=A.replace("é", "");
A=A.replace("e", "");
A=A.replace("è", "");
A=A.replace("ê", "");
A=A.replace("o", "");
A=A.replace("ô", "");
A=A.replace("a", "");
A=A.replace("â", "");
A=A.replace("à", "");
A=A.replace("u", "");
A=A.replace("ù", "");
A=A.replace("û", "");
A=A.replace("ü", "");
A=A.replace("ç", "");
A=A.replace("î", "");
A=A.replace(":", "");
A=A.replace("-", "");
A=A.replace(".", "");
A=A.replace(",", "");
A=A.replace("_", "");
A=A.replace("_", "");
A=A.replace("(", "");
A=A.replace(")", "");
A=A.replace("\"", "");
A=A.replace("+", "");
A=A.replace("Œ", "");
A=A.replace("œ", "");
A=A.replace("\r", "");
A=A.replace("\n", "");
A=A.replace("'", "");
if(!exception.equals("")) A=A.replace("", "");
if(!exception.equals("")) A=A.replace("", "");
if(!exception.equals("¦")) A=A.replace("¦", "");
if(!exception.equals("")) A=A.replace("", "");
}
// if(zz) {
// ArrayList<Integer> table = new ArrayList<Integer>();
// System.out.println("-fin-");
// System.out.println(A);
// byte[] V = A.getBytes();
// for(byte bb:V) {
// table.add((int) bb);
// }
// System.out.println(table.toString());
// System.out.println();
//
// }
return A;
}
public static String retourneEncodageUTF8(String txt){
if (txt!=null) {
try {
txt = new String(txt.getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
System.out.println(e);
}
}
return txt;
}
/**
* Nettoyage des digites en fin de ligne juste avant le symbol $
* Permet de supprimer les numéros de page dans les index
* Puis nettoyage de la chaîne avec la fonction NetText
* @param A
* @return
* @throws UnsupportedEncodingException
*/
@SuppressWarnings("unused")
private String Net2Texte(String A) throws UnsupportedEncodingException {
// rechercher un digite une ou plusieur fois en fin.
Pattern p = Pattern.compile("[0-9]+$");
// création du moteur associé à la regex sur la chaîne A
Matcher m = p.matcher(A);
// remplacement de toutes les occurrences par ""
A= m.replaceAll("");
A = NetTexte(A,"");
return A;
}
/**
* Retourne la chaîne sans le numéro à la fin
* @param A
* @return
*/
public static String RemoveLastNumber(String A) {
Pattern p = Pattern.compile("[0-9]+$");
Matcher m = p.matcher(A);
A= m.replaceAll("");
return A;
}
/**
*
* @param A
* @param B
* @return
*/
public static ArrayList<nodeAC> AjouteDansALesNodesB(ArrayList<nodeAC> A,ArrayList<nodeAC> B){
for(int i=0; i<B.size();i++) {
A.add(B.get(i));
}
return A;
}
/**
* Initialisation des points
*/
public void initilisePointClass() {
this.pointsClass=0;
this.pointEnJeu=0;
this.pointTotal=0;
}
/**
* La proportion ne doit pas être linéaire sinon c'est trop facile
* @return
*/
public double getPropClass() {
double a = (double) this.pointsClass;
double b = (double) this.pointTotal;
return (double) Math.pow(a/b, 3);
}
public int getPointsClass() {
return this.pointsClass;
}
public int getPointTotal() {
return this.pointTotal;
}
public int getPointEnJeu() {
return this.pointEnJeu;
}
public void setPointsClass(int pointsClass) {
this.pointsClass = pointsClass;
}
public void setPointTotal(int pointTotal) {
this.pointTotal = pointTotal;
}
public void setPointEnJeu(int pointEnJeu) {
this.pointEnJeu = pointEnJeu;
}
private void IncrementPointTotal(Integer pt) {
this.pointTotal=this.pointTotal+ pt;
}
private void IncrementPointClass(Integer pt) {
this.pointsClass=this.pointsClass+ pt;
}
}