[sword-svn] r156 - in trunk: app/src/org/crosswire/flashcards src/org/crosswire/flashcards
Apache
apache at www.crosswire.org
Wed Nov 19 15:34:18 MST 2008
Author:
Date: 2008-11-19 15:34:17 -0700 (Wed, 19 Nov 2008)
New Revision: 156
Modified:
trunk/app/src/org/crosswire/flashcards/LessonManager.java
trunk/src/org/crosswire/flashcards/Quizer.java
Log:
Modified: trunk/app/src/org/crosswire/flashcards/LessonManager.java
===================================================================
--- trunk/app/src/org/crosswire/flashcards/LessonManager.java 2008-09-11 12:37:18 UTC (rev 155)
+++ trunk/app/src/org/crosswire/flashcards/LessonManager.java 2008-11-19 22:34:17 UTC (rev 156)
@@ -43,7 +43,7 @@
public static final String LESSON_ROOT = "lessons";
private static final String DIR_PROJECT = ".flashcards";
- private static LessonManager instance = new LessonManager();
+ private static LessonManager instance = null;
/**
* An ordered list of <code>lessonSets</code>
@@ -53,11 +53,15 @@
private String homeProjectPath = null;
public static LessonManager instance() {
+ if (instance == null) instance = new LessonManager();
return instance;
}
+ public LessonManager(String jarsPath) {
+ loadLessonSetsFromJarDir(jarsPath);
+ }
- private LessonManager() {
+ public LessonManager() {
try {
homeProjectPath = System.getProperty("user.home") + File.separator + DIR_PROJECT;
homeLessonDir = new File(homeProjectPath + File.separator + LESSON_ROOT);
Modified: trunk/src/org/crosswire/flashcards/Quizer.java
===================================================================
--- trunk/src/org/crosswire/flashcards/Quizer.java 2008-09-11 12:37:18 UTC (rev 155)
+++ trunk/src/org/crosswire/flashcards/Quizer.java 2008-11-19 22:34:17 UTC (rev 156)
@@ -74,7 +74,8 @@
public void loadLesson(Lesson lesson) {
Vector cards = lesson.getFlashcards();
for (int i = 0; i < cards.size(); i++) {
- words.addElement(new WordEntry( (FlashCard) cards.elementAt(i)));
+ FlashCard f = (FlashCard) cards.elementAt(i);
+ words.addElement(new WordEntry(f));
}
// let's combine duplicate words
for (int i = 0; i < words.size() - 1; i++) {
@@ -186,9 +187,11 @@
int wordNum = getRandomInt(ret.size());
ret.setElementAt(lastWord.flashCard.getBack(), wordNum);
}
+System.out.println("Answer is offset: "+ret.indexOf(lastWord.flashCard.getBack()));
return ret;
}
+
public int getTotalAsked() {
return totalAsked;
}
More information about the sword-cvs
mailing list