Beispiel #1
0
 private term(term t1, term t2)
 {
     Kind    = TermKind.Apply;
     _atom   = default(atom);
     _applyF = new Box <term>(t1);
     _applyX = new Box <term>(t2);
 }
Beispiel #2
0
 private term(TermKind kind, atom a)
 {
     Kind    = kind;
     _atom   = a;
     _applyF = new Box <term>(default(term));
     _applyX = new Box <term>(default(term));
 }
Beispiel #3
0
        public void LoadAnswers(TermKind from, TermKind to)
        {
            FromTerm = from;
            ToTerm   = to;

            questions.Clear();
            string[] input = new string[0];

            if (File.Exists(AnswerDataFileName))
            {
                input = File.ReadAllLines(AnswerDataFileName);
            }

            for (int i = 0; i < questionData.Count; ++i)
            {
                QuestionData qd = questionData[i];
                Question     q  = new Question();

                GetQuestionAnswerData(from, qd, out q.QuestionStyle, out q.QuestionString);
                GetQuestionAnswerData(to, qd, out q.AnswerStyle, out q.AnswerString);

                if (i < input.Length)
                {
                    q.LoadAnswers(input[i]);
                }

                questions.Add(q);
            }
        }
Beispiel #4
0
 void GetQuestionAnswerData(TermKind termKind, QuestionData qd, out TermStyle termStyle, out string termString)
 {
     if (termKind == TermKind.ChineseCharacter)
     {
         if (string.IsNullOrWhiteSpace(qd.ChineseImageFileName))
         {
             termStyle  = TermStyle.Text;
             termString = qd.ChineseText;
         }
         else
         {
             termStyle  = TermStyle.Picture;
             termString = Path.Combine(directory, qd.ChineseImageFileName);
         }
     }
     else if (termKind == TermKind.ChineseSound)
     {
         termStyle  = TermStyle.Sound;
         termString = Path.Combine(directory, qd.SoundFileName);
     }
     else if (termKind == TermKind.EnglishWord)
     {
         termStyle  = TermStyle.Text;
         termString = qd.EnglishText;
     }
     else
     {
         throw new ArgumentException("termKind");
     }
 }
Beispiel #5
0
        private string TermText(TermKind termKind)
        {
            switch (termKind)
            {
            case TermKind.ChineseCharacter:
                return("chin");

            case TermKind.ChineseSound:
                return("sound");

            case TermKind.EnglishWord:
            default:
                return("eng");
            }
        }
Beispiel #6
0
        public void LoadAnswers(TermKind from, TermKind to)
        {
            FromTerm = from;
            ToTerm = to;

            questions.Clear();
            string[] input = new string[0];

            if (File.Exists(AnswerDataFileName)) {
                input = File.ReadAllLines(AnswerDataFileName);
            }

            for (int i = 0; i < questionData.Count; ++i) {
                QuestionData qd = questionData[i];
                Question q = new Question();

                GetQuestionAnswerData(from, qd, out q.QuestionStyle, out q.QuestionString);
                GetQuestionAnswerData(to, qd, out q.AnswerStyle, out q.AnswerString);

                if (i < input.Length) {
                    q.LoadAnswers(input[i]);
                }

                questions.Add(q);
            }
        }
Beispiel #7
0
 private string TermText(TermKind termKind)
 {
     switch (termKind) {
         case TermKind.ChineseCharacter:
             return "chin";
         case TermKind.ChineseSound:
             return "sound";
         case TermKind.EnglishWord:
         default:
             return "eng";
     }
 }
Beispiel #8
0
 void GetQuestionAnswerData(TermKind termKind, QuestionData qd, out TermStyle termStyle, out string termString)
 {
     if (termKind == TermKind.ChineseCharacter) {
         if (string.IsNullOrWhiteSpace(qd.ChineseImageFileName)) {
             termStyle = TermStyle.Text;
             termString = qd.ChineseText;
         }
         else {
             termStyle = TermStyle.Picture;
             termString = Path.Combine(directory, qd.ChineseImageFileName);
         }
     }
     else if (termKind == TermKind.ChineseSound) {
         termStyle = TermStyle.Sound;
         termString = Path.Combine(directory, qd.SoundFileName);
     }
     else if (termKind == TermKind.EnglishWord) {
         termStyle = TermStyle.Text;
         termString = qd.EnglishText;
     }
     else {
         throw new ArgumentException("termKind");
     }
 }
Beispiel #9
0
 public NameClause(TermKind kind, string filter, bool substring)
 {
     Kind      = kind;
     Filter    = filter;
     Substring = substring;
 }
Beispiel #10
0
 internal Term(string name, TermKind kind)
 {
     Name = name;
     Kind = kind;
 }