/* *Copyright 2007, 2011 CCLS Columbia University (USA), LIFO University of Orl��ans (France), BRGM (France) * *Authors: Cyril Nortet, Xiangrong Kong, Ansaf Salleb-Aouissi, Christel Vrain, Daniel Cassard * *This file is part of QuantMiner. * *QuantMiner is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. * *QuantMiner is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * *You should have received a copy of the GNU General Public License along with QuantMiner. If not, see <http://www.gnu.org/licenses/>. */ package src.graphicalInterface; import javax.swing.*; import javax.swing.tree.*; import javax.swing.table.*; import src.apriori.*; import src.database.*; import src.graphicalInterface.TreeTable.*; import src.solver.*; import src.tools.*; import java.awt.*; import java.util.*; public class PanelSort extends javax.swing.JPanel { //step 5 the second/middle panel public static final int METHODE_TRI_SUPPORT = 0; public static final int METHODE_TRI_CONFIANCE = 1; public static final int METHODE_TRI_NOMBRE_ATTRIBUTS = 2; /** Creates new form PanneauTri */ public PanelSort(PanelResults panneauResultats, ResolutionContext contexteResolution) { initComponents(); jTextFieldInteret.setText( m_contexteResolution.EcrirePourcentage(0.75f, 3, false) ); jTextFieldInteret.setEnabled(false); jCheckBoxInteret.setSelected(false); m_panneauResultats = panneauResultats; m_contexteResolution = contexteResolution; m_bPanneauFiltreAffiche = false; InitialiserContenuPanneau(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents private void initComponents() { jComboBoxMethodeTri = new javax.swing.JComboBox(); //sorting method jLabelMethodeTri = new javax.swing.JLabel(); //"Sorting method" jCheckBoxTriDecroissant = new javax.swing.JCheckBox(); //descending order check box jScrollPaneFiltre = new javax.swing.JScrollPane(); //filter panel --will open when click browse filter jLabelFiltre = new javax.swing.JLabel(); //label in filter panel --will open when click browse filter jButtonAppliquer = new javax.swing.JButton(); //apply button jButtonFiltre = new javax.swing.JButton(); //Display filter jButtonReinitFiltre = new javax.swing.JButton(); //reinitialize filter jButtonFiltreSelection = new javax.swing.JButton(); //filter from selection jCheckBoxInteret = new javax.swing.JCheckBox(); //check box of Exclude rules with consequent support exceeds... jTextFieldInteret = new javax.swing.JTextField(); //0.0f-100.0f setLayout(null); jComboBoxMethodeTri.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "confidence sorting", "support sorting", "sorting by attributes number" })); jComboBoxMethodeTri.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jComboBoxMethodeTriActionPerformed(evt); } }); add(jComboBoxMethodeTri); jComboBoxMethodeTri.setBounds(170, 10, 230, 20); jLabelMethodeTri.setText("Sorting method :"); add(jLabelMethodeTri); jLabelMethodeTri.setBounds(10, 10, 160, 14); jCheckBoxTriDecroissant.setSelected(true); jCheckBoxTriDecroissant.setText("decreasing order"); add(jCheckBoxTriDecroissant); jCheckBoxTriDecroissant.setBounds(410, 10, 130, 20); //filter panel --will open when click browse filter add(jScrollPaneFiltre); jScrollPaneFiltre.setBounds(10, 110, 510, 110); jLabelFiltre.setText("Filter on items :"); add(jLabelFiltre); jLabelFiltre.setBounds(10, 90, 140, 20); jButtonAppliquer.setText("APPLY"); jButtonAppliquer.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonAppliquerActionPerformed(evt); } }); add(jButtonAppliquer); jButtonAppliquer.setBounds(540, 10, 130, 70); jButtonFiltre.setText("Display filter"); jButtonFiltre.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonFiltreActionPerformed(evt); } }); add(jButtonFiltre); jButtonFiltre.setBounds(10, 60, 140, 20); jButtonReinitFiltre.setText("Reinitialize filter"); jButtonReinitFiltre.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonReinitFiltreActionPerformed(evt); } }); add(jButtonReinitFiltre); jButtonReinitFiltre.setBounds(170, 60, 180, 20); jButtonFiltreSelection.setText("Filter from selection"); jButtonFiltreSelection.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonFiltreSelectionActionPerformed(evt); } }); add(jButtonFiltreSelection); jButtonFiltreSelection.setBounds(370, 60, 237, 20); jCheckBoxInteret.setText("Exclude rules with consequent support (part B) exceeds (%) : "); jCheckBoxInteret.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jCheckBoxInteretActionPerformed(evt); } }); add(jCheckBoxInteret); jCheckBoxInteret.setBounds(6, 34, 440, 20); jTextFieldInteret.setInputVerifier(new ToolsInterface.VerifieurTextFieldIntervalleFloat(0.0f, 100.0f)); add(jTextFieldInteret); jTextFieldInteret.setBounds(450, 34, 66, 20); }// </editor-fold>//GEN-END:initComponents private void jComboBoxMethodeTriActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxMethodeTriActionPerformed // Add your handling code here: }//GEN-LAST:event_jComboBoxMethodeTriActionPerformed private void jCheckBoxInteretActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxInteretActionPerformed if (jCheckBoxInteret.isSelected()) { jTextFieldInteret.setEnabled(true); } else { jTextFieldInteret.setEnabled(false); } }//GEN-LAST:event_jCheckBoxInteretActionPerformed private void jButtonFiltreSelectionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonFiltreSelectionActionPerformed AssociationRule regleCourante = null; int iIndiceCoteRegle = 0; int iTypePriseEnCompte = 0; int iNombreColonnes = 0; int iIndiceColonne = 0; int iTypeNoeud = 0; String sNomColonne = null; DataColumn colonneDonnees = null; DatabaseAdmin gestionnaireBD = null; String [] tItems = null; int iNombreItems = 0; int iIndiceItem = 0; Item item = null; Item [] tItemsRegle = null; ItemQualitative itemQual = null; ItemQuantitative itemQuant = null; String sNomItem = null; regleCourante = m_panneauResultats.ObtenirRegleCourante(); if (regleCourante == null) return; // Pour commencer, on fait en sorte de ne plus rien filtrer : if (m_contexteResolution == null) return; gestionnaireBD = m_contexteResolution.m_gestionnaireBD; if (gestionnaireBD == null) return; //get the number of columns selected iNombreColonnes = gestionnaireBD.ObtenirNombreColonnesPrisesEnCompte(); if (iNombreColonnes == 0) return; for (iIndiceColonne=0;iIndiceColonne<iNombreColonnes;iIndiceColonne++) { //get a selected column colonneDonnees = gestionnaireBD.ObtenirColonneBDPriseEnCompte(iIndiceColonne); if (colonneDonnees != null) { sNomColonne = new String( colonneDonnees.m_sNomColonne ); //if the position of this column is not no where if (m_contexteResolution.ObtenirTypePrisEnCompteAttribut(sNomColonne) != ResolutionContext.PRISE_EN_COMPTE_ITEM_NULLE_PART) { // Attributs qualitatifs : if (colonneDonnees.m_iTypeValeurs == DatabaseAdmin.TYPE_VALEURS_COLONNE_ITEM) { // Items : tItems = colonneDonnees.ConstituerTableauValeurs(); if (tItems != null) for (iIndiceItem=0; iIndiceItem<tItems.length; iIndiceItem++) if (m_contexteResolution.ObtenirTypePrisEnCompteItem(sNomColonne, tItems[iIndiceItem]) != ResolutionContext.PRISE_EN_COMPTE_ITEM_NULLE_PART) { m_contexteResolution.DefinirTypePrisEnCompteItem_Filtrage(sNomColonne, tItems[iIndiceItem], ResolutionContext.PRISE_EN_COMPTE_ITEM_2_COTES); m_contexteResolution.DefinirPresenceObligatoireItem_Filtrage(sNomColonne, tItems[iIndiceItem], false); } } // Attributs quantitatifs : else if (colonneDonnees.m_iTypeValeurs == DatabaseAdmin.TYPE_VALEURS_COLONNE_REEL) { m_contexteResolution.DefinirTypePrisEnCompteAttribut_Filtrage(sNomColonne, ResolutionContext.PRISE_EN_COMPTE_ITEM_2_COTES); m_contexteResolution.DefinirPresenceObligatoireAttribut_Filtrage(sNomColonne, false); } } } } // On traite les 2 c�t�s de la r�gle approximativemen de la m�me mani�re : for (iIndiceCoteRegle=0; iIndiceCoteRegle<2; iIndiceCoteRegle++) { if (iIndiceCoteRegle==0) { iNombreItems = regleCourante.m_iNombreItemsGauche; tItemsRegle = regleCourante.m_tItemsGauche; iTypePriseEnCompte = m_contexteResolution.PRISE_EN_COMPTE_ITEM_GAUCHE; } else { iNombreItems = regleCourante.m_iNombreItemsDroite; tItemsRegle = regleCourante.m_tItemsDroite; iTypePriseEnCompte = m_contexteResolution.PRISE_EN_COMPTE_ITEM_DROITE; } for (iIndiceItem=0; iIndiceItem<iNombreItems; iIndiceItem++) { item = tItemsRegle[iIndiceItem]; if (item.m_iTypeItem == Item.ITEM_TYPE_QUALITATIF) { itemQual = (ItemQualitative)item; sNomColonne = itemQual.m_attributQual.ObtenirNom(); sNomItem = itemQual.ObtenirIdentifiantTexteItem(); m_contexteResolution.DefinirTypePrisEnCompteItem_Filtrage(sNomColonne, sNomItem, iTypePriseEnCompte); m_contexteResolution.DefinirPresenceObligatoireItem_Filtrage(sNomColonne, sNomItem, true); } else if (item.m_iTypeItem == Item.ITEM_TYPE_QUANTITATIF) { itemQuant = (ItemQuantitative)item; sNomColonne = itemQuant.m_attributQuant.ObtenirNom(); m_contexteResolution.DefinirTypePrisEnCompteAttribut_Filtrage(sNomColonne, iTypePriseEnCompte); m_contexteResolution.DefinirPresenceObligatoireAttribut_Filtrage(sNomColonne, true); } } } // Pour ce type de filtrage, un tri croissant par nombre d'attributs est la m�thode la mieux adapt�e : jComboBoxMethodeTri.setSelectedIndex(2); jCheckBoxTriDecroissant.setSelected(false); // Rafra�chissement : jScrollPaneFiltre.repaint(); m_panneauResultats.MettreAJourListeRegles(); }//GEN-LAST:event_jButtonFiltreSelectionActionPerformed private void jButtonReinitFiltreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonReinitFiltreActionPerformed int iNombreColonnes = 0; int iIndiceColonne = 0; int iTypeNoeud = 0; String sNomColonne = null; DataColumn colonneDonnees = null; DatabaseAdmin gestionnaireBD = null; String [] tItems = null; int iIndiceItem = 0; int iTypePriseEnCompte = 0; boolean bPresenceObligatoire = false; if (m_contexteResolution == null) return; gestionnaireBD = m_contexteResolution.m_gestionnaireBD; if (gestionnaireBD == null) return; iNombreColonnes = gestionnaireBD.ObtenirNombreColonnesPrisesEnCompte(); if (iNombreColonnes == 0) return; for (iIndiceColonne=0;iIndiceColonne<iNombreColonnes;iIndiceColonne++) { colonneDonnees = gestionnaireBD.ObtenirColonneBDPriseEnCompte(iIndiceColonne); if (colonneDonnees != null) { sNomColonne = new String( colonneDonnees.m_sNomColonne ); iTypePriseEnCompte = m_contexteResolution.ObtenirTypePrisEnCompteAttribut(sNomColonne); if (iTypePriseEnCompte != ResolutionContext.PRISE_EN_COMPTE_ITEM_NULLE_PART) { m_contexteResolution.DefinirTypePrisEnCompteAttribut_Filtrage(sNomColonne, iTypePriseEnCompte); // Attributs qualitatifs : if (colonneDonnees.m_iTypeValeurs == DatabaseAdmin.TYPE_VALEURS_COLONNE_ITEM) { // Items : tItems = colonneDonnees.ConstituerTableauValeurs(); if (tItems != null) for (iIndiceItem=0; iIndiceItem<tItems.length; iIndiceItem++) { iTypePriseEnCompte = m_contexteResolution.ObtenirTypePrisEnCompteItem(sNomColonne, tItems[iIndiceItem]); if (iTypePriseEnCompte != ResolutionContext.PRISE_EN_COMPTE_ITEM_NULLE_PART) { m_contexteResolution.DefinirTypePrisEnCompteItem_Filtrage(sNomColonne, tItems[iIndiceItem], iTypePriseEnCompte); bPresenceObligatoire = m_contexteResolution.ObtenirPresenceObligatoireItem(sNomColonne, tItems[iIndiceItem]); m_contexteResolution.DefinirPresenceObligatoireItem_Filtrage(sNomColonne, tItems[iIndiceItem], bPresenceObligatoire); } } } // Attributs quantitatifs : else if (colonneDonnees.m_iTypeValeurs == DatabaseAdmin.TYPE_VALEURS_COLONNE_REEL) { bPresenceObligatoire = (m_contexteResolution.ObtenirPresenceObligatoireAttribut(sNomColonne) == 1); m_contexteResolution.DefinirPresenceObligatoireAttribut_Filtrage(sNomColonne, bPresenceObligatoire); } } } } jScrollPaneFiltre.repaint(); m_panneauResultats.MettreAJourListeRegles(); }//GEN-LAST:event_jButtonReinitFiltreActionPerformed private void jButtonAppliquerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAppliquerActionPerformed m_panneauResultats.MettreAJourListeRegles(); }//GEN-LAST:event_jButtonAppliquerActionPerformed private void jButtonFiltreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonFiltreActionPerformed m_bPanneauFiltreAffiche = !m_bPanneauFiltreAffiche; if (m_bPanneauFiltreAffiche) jButtonFiltre.setText("Hide filter"); else jButtonFiltre.setText("Display filter"); jScrollPaneFiltre.setVisible(m_bPanneauFiltreAffiche); m_panneauResultats.IndiquerModificationAffichageFiltre(); }//GEN-LAST:event_jButtonFiltreActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButtonAppliquer; private javax.swing.JButton jButtonFiltre; private javax.swing.JButton jButtonFiltreSelection; private javax.swing.JButton jButtonReinitFiltre; private javax.swing.JCheckBox jCheckBoxInteret; private javax.swing.JCheckBox jCheckBoxTriDecroissant; private javax.swing.JComboBox jComboBoxMethodeTri; private javax.swing.JLabel jLabelFiltre; private javax.swing.JLabel jLabelMethodeTri; private javax.swing.JScrollPane jScrollPaneFiltre; private javax.swing.JTextField jTextFieldInteret; // End of variables declaration//GEN-END:variables private PanelResults m_panneauResultats = null; private ResolutionContext m_contexteResolution = null; private boolean m_bPanneauFiltreAffiche = false; public int ObtenirTailleReduite() { int iTailleReduite = 0; iTailleReduite = jButtonFiltre.getY(); iTailleReduite += jButtonFiltre.getHeight(); iTailleReduite = iTailleReduite/2 + jLabelFiltre.getY()/2; return iTailleReduite; } public boolean EstFiltreAffiche() { return m_bPanneauFiltreAffiche; } public int ObtenirMethodeTri() { switch( jComboBoxMethodeTri.getSelectedIndex() ) { case 0: return METHODE_TRI_CONFIANCE; case 1: return METHODE_TRI_SUPPORT; case 2: return METHODE_TRI_NOMBRE_ATTRIBUTS; default: return METHODE_TRI_CONFIANCE; } } public boolean EstTriDecroissant() { return ( jCheckBoxTriDecroissant.isSelected() ); } // Renvoie la valeur du sueil maximum de support du cons�quent sp�cifi� dans le filtrage d'int�r�t des // r�gles, ou -1.0f si celui-ci n'est pas d�fini : public float ObtenirSueilMaxSupportConsequent() { float fSeuilSupportMax = 0.0f; if (this.jCheckBoxInteret.isSelected()) { try { fSeuilSupportMax = (float) ( Double.parseDouble( jTextFieldInteret.getText() ) / 100.0 ); } catch (NumberFormatException e) { fSeuilSupportMax = -1.0f; } } else fSeuilSupportMax = -1.0f; return fSeuilSupportMax; } public void ArrangerDisposition() { jButtonAppliquer.setLocation(this.getWidth()-jButtonAppliquer.getWidth()-10, jButtonAppliquer.getY()); jScrollPaneFiltre.setBounds( jScrollPaneFiltre.getX(), jScrollPaneFiltre.getY(), this.getWidth() - 2*jScrollPaneFiltre.getX(), this.getHeight() - jScrollPaneFiltre.getY() - 10 ); } private void InitialiserContenuPanneau() { int iNombreColonnes = 0; int iIndiceColonne = 0; int iTypeNoeud = 0; String sNomColonne = null; AttributsBDModel attributsBD = null; JTreeTable treeTable = null; DatabaseAdmin gestionnaireBD = null; DataColumn colonneDonnees = null; String [] tItems = null; int [] tOccurrences = null; int iPasseRemplissage = 0; DefaultMutableTreeNode noeudRacine = null; DefaultMutableTreeNode noeudCourant = null; String sDescriptionElement = null; int iNombreRegles = 0; int iIndiceRegle = 0; int iIndiceCoteRegle = 0; int iNombreItems = 0; int iIndiceItem = 0; Item item = null; Item [] tItemsRegle = null; ItemQualitative itemQual = null; ItemQuantitative itemQuant = null; AssociationRule regle = null; Hashtable tableOccurrencesAttributs = null; Hashtable tableAttributsQualitatifs = null; Hashtable tableOccurrencesItems = null; if (m_contexteResolution == null) return; gestionnaireBD = m_contexteResolution.m_gestionnaireBD; if (gestionnaireBD == null) return; iNombreColonnes = gestionnaireBD.ObtenirNombreColonnesPrisesEnCompte(); if (iNombreColonnes == 0) return; //---------------------------------------------------------------------------------------- // On commence par comptabiliser les occurrences de chaque attribut/item dans les r�gles : // D�finition d'une classe permettant de m�moriser les 2 nombres d'occurrences par attribut/item : class NombreOccurrences { public int m_iOccurrencesGauche = 0; public int m_iOccurrencesDroite = 0; public NombreOccurrences() { m_iOccurrencesGauche = 0; m_iOccurrencesDroite = 0; } } NombreOccurrences nombreOccurrencesAttribut = null; NombreOccurrences nombreOccurrencesItem = null; // Cr�ation des structures de donn�es visant � m�moriser les nombres d'occurrences : tableOccurrencesAttributs = new Hashtable(); tableAttributsQualitatifs = new Hashtable(); tableOccurrencesItems = new Hashtable(); // Instanciation des structures de donn�es : for (iIndiceColonne=0;iIndiceColonne<iNombreColonnes;iIndiceColonne++) { colonneDonnees = gestionnaireBD.ObtenirColonneBDPriseEnCompte(iIndiceColonne); if (colonneDonnees.m_sNomColonne != null) { sNomColonne = new String( colonneDonnees.m_sNomColonne ); // Il n'est pas utile de prendre en consid�ration les attributs qui ne devaient pas appara�tre dans les r�gles : if (m_contexteResolution.ObtenirTypePrisEnCompteAttribut(sNomColonne) != ResolutionContext.PRISE_EN_COMPTE_ITEM_NULLE_PART) { tableOccurrencesAttributs.put(sNomColonne, new NombreOccurrences()); // Cas particulier des attributs qualitatifs o� on doit cr�er une structure pour chaque item : if (colonneDonnees.m_iTypeValeurs == DatabaseAdmin.TYPE_VALEURS_COLONNE_ITEM) { // Cr�ation de la sous-table de hachage destin�e � r�pertorier chaque item de l'attribut : tableOccurrencesItems = new Hashtable(); tableAttributsQualitatifs.put(sNomColonne, tableOccurrencesItems); tItems = colonneDonnees.ConstituerTableauValeurs(); for (iIndiceItem=0; iIndiceItem<tItems.length; iIndiceItem++) if (tItems[iIndiceItem] != null) if (m_contexteResolution.ObtenirTypePrisEnCompteItem(sNomColonne, tItems[iIndiceItem]) != ResolutionContext.PRISE_EN_COMPTE_ITEM_NULLE_PART) tableOccurrencesItems.put(tItems[iIndiceItem], new NombreOccurrences()); } } } } // Calcul des nombres d'occurrences : if (m_contexteResolution.m_listeRegles != null) iNombreRegles = m_contexteResolution.m_listeRegles.size(); else iNombreRegles = 0; for (iIndiceRegle=0; iIndiceRegle<iNombreRegles; iIndiceRegle++) { regle = (AssociationRule)m_contexteResolution.m_listeRegles.get(iIndiceRegle); // On traite les 2 c�t�s de la r�gle approximativemen de la m�me mani�re : for (iIndiceCoteRegle=0; iIndiceCoteRegle<2; iIndiceCoteRegle++) { if (iIndiceCoteRegle==0) { iNombreItems = regle.m_iNombreItemsGauche; tItemsRegle = regle.m_tItemsGauche; } else { iNombreItems = regle.m_iNombreItemsDroite; tItemsRegle = regle.m_tItemsDroite; } for (iIndiceItem=0; iIndiceItem<iNombreItems; iIndiceItem++) { item = tItemsRegle[iIndiceItem]; if (item.m_iTypeItem == Item.ITEM_TYPE_QUALITATIF) { itemQual = (ItemQualitative)item; // On r�cup�re les nombres courants d'occurrences pour l'attribut : nombreOccurrencesAttribut = (NombreOccurrences)tableOccurrencesAttributs.get(itemQual.m_attributQual.ObtenirNom()); // On r�cup�re les nombres courants d'occurrences pour l'item : tableOccurrencesItems = (Hashtable)tableAttributsQualitatifs.get(itemQual.m_attributQual.ObtenirNom()); if (tableOccurrencesItems != null) nombreOccurrencesItem = (NombreOccurrences)tableOccurrencesItems.get(itemQual.ObtenirIdentifiantTexteItem()); else nombreOccurrencesItem = null; // Incr�mentation du bon c�t� de la r�gle : if (iIndiceCoteRegle==0) { if (nombreOccurrencesAttribut != null) nombreOccurrencesAttribut.m_iOccurrencesGauche++; if (nombreOccurrencesItem != null) nombreOccurrencesItem.m_iOccurrencesGauche++; } else { if (nombreOccurrencesAttribut != null) nombreOccurrencesAttribut.m_iOccurrencesDroite++; if (nombreOccurrencesItem != null) nombreOccurrencesItem.m_iOccurrencesDroite++; } } else if (item.m_iTypeItem == Item.ITEM_TYPE_QUANTITATIF) { itemQuant = (ItemQuantitative)item; // On r�cup�re les nombres courants d'occurrences pour l'attribut : nombreOccurrencesAttribut = (NombreOccurrences)tableOccurrencesAttributs.get(itemQuant.m_attributQuant.ObtenirNom()); // Incr�mentation du bon c�t� de la r�gle : if (nombreOccurrencesAttribut != null) { if (iIndiceCoteRegle==0) nombreOccurrencesAttribut.m_iOccurrencesGauche++; else nombreOccurrencesAttribut.m_iOccurrencesDroite++; } } } } } //------------------------------------- // Remplissage du tableau de filtrage : attributsBD = new AttributsBDModel(); noeudRacine = (DefaultMutableTreeNode)attributsBD.getRoot(); // Remplissage de la liste des noms de colonnes qualitatives puis quantitatives disponibles au total dans la BD : for (iPasseRemplissage=0; iPasseRemplissage<2; iPasseRemplissage++) for (iIndiceColonne=0;iIndiceColonne<iNombreColonnes;iIndiceColonne++) { colonneDonnees = gestionnaireBD.ObtenirColonneBDPriseEnCompte(iIndiceColonne); if (colonneDonnees != null) if ( ( (iPasseRemplissage==0) && (colonneDonnees.m_iTypeValeurs == DatabaseAdmin.TYPE_VALEURS_COLONNE_ITEM) ) ||( (iPasseRemplissage==1) && (colonneDonnees.m_iTypeValeurs == DatabaseAdmin.TYPE_VALEURS_COLONNE_REEL) ) ) { sNomColonne = new String( colonneDonnees.m_sNomColonne ); if (m_contexteResolution.ObtenirTypePrisEnCompteAttribut(sNomColonne) != ResolutionContext.PRISE_EN_COMPTE_ITEM_NULLE_PART) { // Construction de la phrase de description : nombreOccurrencesAttribut = (NombreOccurrences)tableOccurrencesAttributs.get(sNomColonne); if (nombreOccurrencesAttribut != null) { sDescriptionElement = " " + String.valueOf(nombreOccurrencesAttribut.m_iOccurrencesGauche) + " left, " + String.valueOf(nombreOccurrencesAttribut.m_iOccurrencesDroite) + " right, " + String.valueOf(nombreOccurrencesAttribut.m_iOccurrencesGauche+nombreOccurrencesAttribut.m_iOccurrencesDroite) + " in total."; } else sDescriptionElement = "Error of comptabilisation !"; // Attributs qualitatifs : if (colonneDonnees.m_iTypeValeurs == DatabaseAdmin.TYPE_VALEURS_COLONNE_ITEM) { iTypeNoeud = AttributsBDModel.ELEMENT_MODEL_ATTRIBUT_QUAL; noeudCourant = attributsBD.AjouterNoeud(noeudRacine, new AttributsBDModel.AttributBDDescription( sNomColonne, iTypeNoeud, sDescriptionElement, m_contexteResolution.ObtenirInfosPostionnementFiltrage(), false )); // On r�cup�re la table des nombres d'occurrences des items de l'attribut : tableOccurrencesItems = (Hashtable)tableAttributsQualitatifs.get(sNomColonne); // On fait figurer dans la sous-arborescence chacunes des valeurs : tItems = colonneDonnees.ConstituerTableauValeurs(); if (tItems != null) // Constitution du tableau r�pertoriant les occurrences (dans la BD) pour chaque item : tOccurrences = new int[tItems.length]; for (iIndiceItem=0; iIndiceItem<tItems.length; iIndiceItem++) tOccurrences[iIndiceItem] = colonneDonnees.ObtenirNombreOccurrencesItem(tItems[iIndiceItem]); // Tri des items par occurrences : tItems = SortingTools.CompateurBiTableaux_Chaines_Entiers(tItems, tOccurrences, false); for (iIndiceItem=0; iIndiceItem<tItems.length; iIndiceItem++) if (m_contexteResolution.ObtenirTypePrisEnCompteItem(sNomColonne, tItems[iIndiceItem]) != ResolutionContext.PRISE_EN_COMPTE_ITEM_NULLE_PART) { // Construction de la phrase de description : sDescriptionElement = "Error of comptabilisation !"; if (tableOccurrencesItems != null) { nombreOccurrencesItem = (NombreOccurrences)tableOccurrencesItems.get(tItems[iIndiceItem]); if (nombreOccurrencesItem != null) { sDescriptionElement = " " + String.valueOf(nombreOccurrencesItem.m_iOccurrencesGauche) + " left, " + String.valueOf(nombreOccurrencesItem.m_iOccurrencesDroite) + " right, " + String.valueOf(nombreOccurrencesItem.m_iOccurrencesGauche+nombreOccurrencesItem.m_iOccurrencesDroite) + " in total."; } } attributsBD.AjouterNoeud(noeudCourant, new AttributsBDModel.AttributBDDescription( sNomColonne, tItems[iIndiceItem], sDescriptionElement, m_contexteResolution.ObtenirInfosPostionnementFiltrage(), false )); } } // Attributs quantitatifs : else if (colonneDonnees.m_iTypeValeurs == DatabaseAdmin.TYPE_VALEURS_COLONNE_REEL) { iTypeNoeud = AttributsBDModel.ELEMENT_MODEL_ATTRIBUT_QUANT; attributsBD.AjouterNoeud(noeudRacine, new AttributsBDModel.AttributBDDescription( sNomColonne, iTypeNoeud, sDescriptionElement, m_contexteResolution.ObtenirInfosPostionnementFiltrage(), false )); } } } } tableOccurrencesItems.clear(); tableAttributsQualitatifs.clear(); tableOccurrencesAttributs.clear(); attributsBD.ModifierNomColonne(1, "Apparitions dans les rules :"); treeTable = new JTreeTable(attributsBD); // Ajout � posteriori de certaines sp�cificit�s � la table : attributsBD.AdapterTreeTableAModele(treeTable); jScrollPaneFiltre.setViewportView(treeTable); jScrollPaneFiltre.validate(); } }