public bool InsertWord(String sNewWord) { Debug.Assert(sNewWord.Length > 0); LengthGroup oLengthGroup = FindLengthGroup(sNewWord.Length); if (oLengthGroup != null) { return(oLengthGroup.InsertWord(sNewWord)); } LengthGroup oNewLengthGroup = new LengthGroup(sNewWord); LengthGroups.Add(oNewLengthGroup); return(true); }
public bool AddWord(String sWord) { if (WordExists(sWord)) { //Form1.LogError("Word " + sWord + " already exists in " + Name); return(false); } for (int i = 0; i < LengthGroups.Count; i++) { if (sWord.Length == LengthGroups[i].Length) { return(LengthGroups[i].AddWord(sWord)); } } LengthGroup oLengthGroup = new LengthGroup(sWord); LengthGroups.Add(oLengthGroup); return(true); }