forked from drocco/CrowdSourcing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRatingsManager.java
More file actions
31 lines (24 loc) · 853 Bytes
/
RatingsManager.java
File metadata and controls
31 lines (24 loc) · 853 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
30
31
import java.util.ArrayList;
import java.util.HashMap;
public abstract class RatingsManager {
protected HashMap<Turker,ArrayList<QuestionAnswer>> questionAnswers = new HashMap<Turker,ArrayList<QuestionAnswer>>();
public abstract float getTurkerRating(Turker t, AnswerManager am);
public abstract float getTurkerConfidence(Turker t);
public void recordAnswer(Turker t, Question q, int answer) {
ArrayList<QuestionAnswer> answerList = questionAnswers.get(t);
if(answerList == null){
answerList = new ArrayList<QuestionAnswer>();
questionAnswers.put(t, answerList);
}
answerList.add(new QuestionAnswer(q,answer));
}
protected static class QuestionAnswer {
public Question question;
public int answer;
public QuestionAnswer(Question q, int answer) {
super();
this.question = q;
this.answer = answer;
}
}
}