public void Add(WordContainer container) {

			for (int i = 0; i < Children.Count; i++) {
			
				if (Children [i].IsParentOf (container)) {
				
					Children [i].Add (container);

					return;
				
				}
		
				if (Children [i].IsChildOf (container)) {
				
					container.Add (Children [i]);
					Children.RemoveAt (i);
					i--;

				}

			}

			Children.Add (container);

		}
Exemplo n.º 2
0
        public bool IsChildOf(WordContainer newWord)
        {
            if (newWord.Word.Value.Length > Word.Value.Length)
            {
                return(false);
            }

            return(newWord.Word.Value == Word.Value.Substring(0, newWord.Word.Value.Length));
        }
Exemplo n.º 3
0
        public bool IsParentOf(WordContainer newWord)
        {
            if (newWord.Word.Value.Length < Word.Value.Length)
            {
                return(false);
            }

            return(Word.Value == newWord.Word.Value.Substring(0, Word.Value.Length));
        }
		public bool IsChildOf(WordContainer newWord) {

			if (newWord.Word.Value.Length > Word.Value.Length ) {
			
				return false;

			}

			return newWord.Word.Value == Word.Value.Substring(0,newWord.Word.Value.Length);

		}
		public bool IsParentOf(WordContainer newWord) {
		
			if (newWord.Word.Value.Length < Word.Value.Length ) {

				return false;

			}

			return Word.Value == newWord.Word.Value.Substring(0,Word.Value.Length);

		}
Exemplo n.º 6
0
        public IList <WordContainer> Matches(WordContainer word)
        {
            IList <WordContainer> matches = new List <WordContainer> ();

            foreach (WordContainer child in Children)
            {
                if (word.IsChildOf(child))
                {
                    return(child.Matches(word));
                }
                else if (word.Word.Value == child.Word.Value)
                {
                    matches.Add(word);
                }
            }

            return(matches);
        }
Exemplo n.º 7
0
        public void Add(WordContainer container)
        {
            for (int i = 0; i < Children.Count; i++)
            {
                if (Children [i].IsParentOf(container))
                {
                    Children [i].Add(container);

                    return;
                }

                if (Children [i].IsChildOf(container))
                {
                    container.Add(Children [i]);
                    Children.RemoveAt(i);
                    i--;
                }
            }

            Children.Add(container);
        }
		public IList<WordContainer> Matches(WordContainer word) {
		
			IList<WordContainer> matches = new List<WordContainer> ();

			foreach (WordContainer child in Children) {
			
				if (word.IsChildOf (child)) {

					return child.Matches (word);

				} else if (word.Word.Value == child.Word.Value) {
				
					matches.Add (word);

				}
			
			}

			return matches;

		}
Exemplo n.º 9
0
 public DefaultDictionary()
 {
     m_tree = new WordContainer(new DefaultWord("", null, 0));
 }
Exemplo n.º 10
0
		public DefaultDictionary ()
		{
			m_tree = new WordContainer (new DefaultWord ("", null, 0));
		}