List<MatchProposal> matches = new ArrayList<MatchProposal>();
for(ShingleCloudMatch sm : sCloud.getMatches()){
if(sm.hasUpperBound() && maxNumberOfMatches > matches.size()){
// create proposal
MatchProposal proposal = new MatchProposal(sm.getUpperBound().getId());
proposal.setDirectRating(sm.getRating() * 100);
if(sCloud.getNeedleShingles().size() > 0)
proposal.setIndirectRating(sm.getContainmentInNeedle());
// add proposal if rating is good enough
if(proposal.getIndirectRating() >= threshold){
String text = docContainer.getElementAsStringFor(sm.getUpperBound().getId(), DocumentContainer.DERIVED);
proposal.setText(text);
// find notes on paragraph
List<TCNote> notes = DBManager.getInstance().getNotesFor(TCNote.TYPE_PARAGRAPH, proposal.getId());
proposal.setNotes(notes);
matches.add(proposal);
}
}
}