forked from drocco/CrowdSourcing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnswerManager.java
More file actions
29 lines (23 loc) · 777 Bytes
/
AnswerManager.java
File metadata and controls
29 lines (23 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import java.util.ArrayList;
import java.util.HashMap;
public abstract class AnswerManager {
protected HashMap<Question, ArrayList<TurkerAnswer>> turkerAnswers = new HashMap<Question, ArrayList<TurkerAnswer>>();
public abstract int getCorrectAnswer(Question q, RatingsManager rm);
public void recordAnswer(Question q, Turker t, int answer) {
ArrayList<TurkerAnswer> answerList = turkerAnswers.get(q);
if(answerList == null){
answerList = new ArrayList<TurkerAnswer>();
turkerAnswers.put(q, answerList);
}
answerList.add(new TurkerAnswer(t,answer));
}
protected static class TurkerAnswer {
public Turker turk;
public int answer;
public TurkerAnswer(Turker turk, int answer) {
super();
this.turk = turk;
this.answer = answer;
}
}
}