Beispiel #1
0
        ///<Summary> method : append()
        //create a new wordline object with the new word and append it to the theWordsList
        ///</Summary>
        public void append(string newWord, string newMeaning)
        {
            //sw = new StreamWriter("c:\\temp\\WordBank.txt");
            //word = wordFromFile;
            string wordString;
            int    initMark = 0;

            wordString = newWord + ";" + newMeaning + ";" + initMark.ToString();
            Wordline wl = new Wordline(wordString);

            theWordsList.Add(wl);
        }
Beispiel #2
0
        ///<Summary> method : vocabulary()
        //the constructor of vocabulary
        ///</Summary>
        public vocabulary()
        {
            sr           = new StreamReader("c:\\temp\\WordBank0.txt");
            theWordsList = new ArrayList();

            string wordString;

            while ((wordString = sr.ReadLine()) != null)
            {
                Wordline wl = new Wordline(wordString);
                theWordsList.Add(wl);
            }

            sr.Close();
            sr = null;

            currentIndex = 0;
        }
Beispiel #3
0
        ///<Summary> method : readWord()
        //get word from theWordsList
        ///</Summary>
        public string readWord()
        {
            string word = "";

            currentMeaning = "";


            if (currentIndex < theWordsList.Count)
            {
                Wordline wl = (Wordline)theWordsList[currentIndex];
                word           = wl.getWord();
                currentMeaning = wl.getMeaning();
                currentIndex++;
            }
            else
            {
                word = null;
            }
            return(word);
        }