/// <summary> /// /// </summary> /// <param name="mot"></param> private void StockeMot(CMot mot) { string strUpper = mot.MotPourRecherche; if (m_strIndex != "" && strUpper == m_strIndex) { if (!m_listeMots.Contains(mot)) { m_listeMots.Add(mot); } } if (strUpper.Length > m_nPositionArbre) { string strIndex = strUpper.Substring(0, m_nPositionArbre + 1); if (m_nIndexDeep == 0 && !m_listeMots.Contains(mot)) { m_listeMots.Add(mot); } else { CArbreVocabulaire sousArbre = (CArbreVocabulaire)m_tableSousArbres[strIndex]; if (sousArbre == null) { sousArbre = new CArbreVocabulaire(m_nIndexDeep - 1, m_nPositionArbre + 1, strIndex); m_tableSousArbres[strIndex] = sousArbre; } sousArbre.StockeMot(mot); } } }
//------------------------------------------------ protected CMot GetMotProtected(string strMot) { if (strMot.Trim() == "") { return(null); } if (strMot.Length > m_nPositionArbre && m_nIndexDeep > 0) { string strIndex = strMot.Substring(0, m_nPositionArbre + 1); CArbreVocabulaire sousArbre = (CArbreVocabulaire)m_tableSousArbres[strIndex]; if (sousArbre == null) { return(null); } return(sousArbre.GetMot(strMot)); } ArrayList arrToReturn = new ArrayList(); foreach (CMot mot in GetTousLesMots()) { if (mot.MotPourRecherche == strMot) { return(mot); } } return(null); }
public ArrayList GetMots(string strDebut) { if (strDebut.Trim() == "") { if (m_bTouteLaListeSurChaineVide) { ArrayList lstMots = new ArrayList(); foreach (CMot mot in GetTousLesMots()) { lstMots.Add(mot.Mot); } return(lstMots); } return(new ArrayList()); } strDebut = ConvertToRecherche(strDebut); if (strDebut.Length > m_nPositionArbre && m_nIndexDeep > 0) { string strIndex = strDebut.Substring(0, m_nPositionArbre + 1); CArbreVocabulaire sousArbre = (CArbreVocabulaire)m_tableSousArbres[strIndex]; if (sousArbre == null) { return(new ArrayList()); } return(sousArbre.GetMots(strDebut)); } ArrayList arrToReturn = new ArrayList(); foreach (CMot mot in GetTousLesMots()) { if (mot.MotPourRecherche.Length >= strDebut.Length && mot.MotPourRecherche.Substring(0, strDebut.Length) == strDebut) { arrToReturn.Add(mot.Mot); } } arrToReturn.Sort(); return(arrToReturn); }
public virtual void Init(CArbreVocabulaire arbreVocabulaire) { m_arbre = arbreVocabulaire; }
public CMot(string strMot, string strValeurStockee) { m_strMotPourRecherche = CArbreVocabulaire.ConvertToRecherche(strMot); m_strMot = strMot; m_strValeurStockee = strValeurStockee; }