public void addOrUpdate(ScoreTerm scoreTerm) { if (this.size() < limit) { // there is still space in the queue this.add(scoreTerm); } else { // otherwise update the smallest in the queue in place and update the queue ScoreTerm scoreTermTop = this.top(); if (scoreTermTop.score < scoreTerm.score) { scoreTermTop.update(scoreTerm.field, scoreTerm.word, scoreTerm.score); this.updateTop(); } } } }
public void addOrUpdate(ScoreTerm scoreTerm) { if (this.size() < limit) { // there is still space in the queue this.add(scoreTerm); } else { // otherwise update the smallest in the queue in place and update the queue ScoreTerm scoreTermTop = this.top(); if (scoreTermTop.score < scoreTerm.score) { scoreTermTop.update(scoreTerm.field, scoreTerm.word, scoreTerm.score); this.updateTop(); } } } }
public void addOrUpdate(ScoreTerm scoreTerm) { if (this.size() < limit) { // there is still space in the queue this.add(scoreTerm); } else { // otherwise update the smallest in the queue in place and update the queue ScoreTerm scoreTermTop = this.top(); if (scoreTermTop.score < scoreTerm.score) { scoreTermTop.update(scoreTerm.field, scoreTerm.word, scoreTerm.score); this.updateTop(); } } } }
public void addOrUpdate(ScoreTerm scoreTerm) { if (this.size() < limit) { // there is still space in the queue this.add(scoreTerm); } else { // otherwise update the smallest in the queue in place and update the queue ScoreTerm scoreTermTop = this.top(); if (scoreTermTop.score < scoreTerm.score) { scoreTermTop.update(scoreTerm.field, scoreTerm.word, scoreTerm.score); this.updateTop(); } } } }
public void addOrUpdate(ScoreTerm scoreTerm) { if (this.size() < limit) { // there is still space in the queue this.add(scoreTerm); } else { // otherwise update the smallest in the queue in place and update the queue ScoreTerm scoreTermTop = this.top(); if (scoreTermTop.score < scoreTerm.score) { scoreTermTop.update(scoreTerm.field, scoreTerm.word, scoreTerm.score); this.updateTop(); } } } }