Skip to content

Commit

Permalink
merged my stuff with daniels bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ajtoms committed Mar 12, 2014
2 parents 2c1c8e9 + a3422f4 commit 3b368e0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<string name="place_holder_long">This is a Long String with at least a line or two. The purpose of this string is to provide a significantly long string so that the developers can test to see areas where a lot of text will be placed. That cute girl just smiled at me. That\'s always nice.</string>
<string name="place_holder_medium">This is a Medium String, just one run-on sentence long as it should be because I like runon sentences.</string>
<string name="place_holder_short">This is a Short String</string>
<string name="title_activity_result">Your Results</string>
<string name="title_activity_result">Phone Results</string>
<string name="restart">Restart?</string>
<string name="title_activity_startup">My Next Phone</string>

Expand Down
5 changes: 5 additions & 0 deletions src/ca/unbc/cpsc472/mynextphone/QuestionActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ public void onSaveInstanceState(Bundle outState){
}
}

public void onDestroy() {
super.onDestroy();
qMan.recycle();
}

/**
* This method grabs a brand new Question from our storage.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ public HashSet<Fact> getFactsLeadingToResult(int resultId) throws Exception{
int i = cursor.getInt(cursor.getColumnIndex(factColumns[0]));
facts.add(this.getFactForFactId(i, 1));
}while(cursor.moveToNext());
cursor.close();

while(facts.addAll(this.getFactIdsLeadingToFactId(facts)));
return facts;
Expand Down
6 changes: 6 additions & 0 deletions src/ca/unbc/cpsc472/mynextphone/models/QuestionManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ private InferenceEngine getEngine() throws Exception {
return engine;
}

public void recycle() {
helper.close();
}

/**
* Generates a random question to display in this QuestionActivity.
*
Expand Down Expand Up @@ -143,6 +147,8 @@ public void restoreState(Bundle savedState) {
// Fetch the facts from the db for their ids
facts.add(helper.getFactForFactId(workingMemIds[i], workingMemFlags[i] ? 1 : 0));
}
getEngine().addFactsToMem(facts);
getEngine().updateMem();
}
catch(Exception ex) {
Log.e(this.getClass().getName(), "Unable to restore working mem from saved state");
Expand Down

0 comments on commit 3b368e0

Please sign in to comment.