March 2015
Intermediate to advanced
236 pages
5h 26m
English
Similarly, extract the code that calculates the total weighting of all matches:
| iloveyouboss/22/src/iloveyouboss/Profile.java | |
| | public boolean matches(Criteria criteria) { |
* | calculateScore(criteria); |
| | |
| | boolean kill = false; |
| | for (Criterion criterion: criteria) { |
| | boolean match = criterion.matches(answerMatching(criterion)); |
| | if (!match && criterion.getWeight() == Weight.MustMatch) { |
| | kill = true; |
| | } |
| | } |
| | if (kill) |
| | return false; |
| | return anyMatches(criteria); |
| | } |
| | |
* | private void calculateScore(Criteria criteria) { |
* | score = 0; |
* | for (Criterion criterion: criteria) |
* | if (criterion.matches(answerMatching(criterion))) |
* | score += criterion.getWeight().getValue(); |
* | } |
Double hmm. You might be wondering ...
Read now
Unlock full access