Esempio n. 1
0
  public boolean matches(Criteria criteria) {
    score = 0;

    boolean kill = false;
    boolean anyMatches = false;
    for (Criterion criterion : criteria) {
      Answer answer = answers.get(criterion.getAnswer().getQuestionText());
      boolean match =
          criterion.getWeight() == Weight.DontCare || answer.match(criterion.getAnswer());
      if (!match && criterion.getWeight() == Weight.MustMatch) {
        kill = true;
      }
      if (match) {
        score += criterion.getWeight().getValue();
      }
      anyMatches |= match;
      // ...
    }
    if (kill) return false;
    return anyMatches;
  }
Esempio n. 2
0
 public void add(Answer answer) {
   answers.put(answer.getQuestionText(), answer);
 }