~ubuntu-branches/ubuntu/lucid/gbrainy/lucid

« back to all changes in this revision

Viewing changes to src/Core/Main/Verbal/AnalogiesQuestionAnswer.cs

  • Committer: Bazaar Package Importer
  • Author(s): Robert Ancell
  • Date: 2010-01-12 11:21:24 UTC
  • mfrom: (13.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20100112112124-o4ztomxa0xfh2ulj
Tags: 1.30-1ubuntu1
* debian/control:
  - Revert build-depends to lucid versions

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2009 Jordi Mas i Hernàndez <jmas@softcatala.org>
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or
 
5
 * modify it under the terms of the GNU General Public License as
 
6
 * published by the Free Software Foundation; either version 2 of the
 
7
 * License, or (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
 * General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public
 
15
 * License along with this program; if not, write to the
 
16
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
17
 * Boston, MA 02111-1307, USA.
 
18
 */
 
19
 
 
20
using System;
 
21
using System.IO;
 
22
using System.Collections.Generic;
 
23
 
 
24
using Mono.Unix;
 
25
using Cairo;
 
26
 
 
27
namespace gbrainy.Core.Main.Verbal
 
28
{
 
29
        public class AnalogiesQuestionAnswer : Analogies
 
30
        {
 
31
                static protected Dictionary <int, Analogy> analogies;
 
32
                static protected ArrayListIndicesRandom analogies_indices;
 
33
                static protected int analogies_index = 0;
 
34
 
 
35
                public AnalogiesQuestionAnswer ()
 
36
                {
 
37
                        if (analogies == null)
 
38
                                analogies = AnalogiesFactory.Get (Analogy.Type.QuestionAnswer);
 
39
                }
 
40
 
 
41
                public override string Name {
 
42
                        get { return Catalog.GetString ("Question and answer");}
 
43
                }
 
44
 
 
45
                public override ArrayListIndicesRandom Indices {
 
46
                        get { return analogies_indices; }
 
47
                        set { analogies_indices = value; }
 
48
                }
 
49
 
 
50
                public override int CurrentIndex {
 
51
                        get { return analogies_index; }
 
52
                        set { analogies_index = value; }
 
53
                }
 
54
 
 
55
                public override Dictionary <int, Analogy> List {
 
56
                        get { return analogies; }
 
57
                }
 
58
 
 
59
                public override void Initialize ()
 
60
                {
 
61
                        current = GetNext ();
 
62
 
 
63
                        if (current == null)
 
64
                                return;
 
65
 
 
66
                        if (current.answers != null) 
 
67
                                right_answer = current.answers [current.right];
 
68
                }
 
69
        }
 
70
}