Skip to content

Commit

Permalink
Only limit number of candidates at the end, because some canidates tu…
Browse files Browse the repository at this point in the history
…rn out to be equivalent

Signed-off-by: Stefan Marr <git@stefan-marr.de>
  • Loading branch information
smarr committed Dec 23, 2017
1 parent 4595510 commit 14aa09a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/tools/superinstructions/CandidateSelector.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ public String detect() {
.filter(context -> !Arrays.asList(context.getTrace())
.contains(SequenceNode.class.getName()))
.sorted(Comparator.comparingLong(context -> contexts.get(context)).reversed())
.limit(CONSIDER_TOP_CONTEXTS)
.collect(Collectors.toList());
Set<Candidate> candidates = new HashSet<>();

Expand All @@ -156,7 +155,9 @@ public String detect() {
// Sort the candidates by their score and format the results
List<Candidate> tops =
candidates.stream().sorted(CandidateSelector::candidateByScoreAndPrint)
.limit(CONSIDER_TOP_CONTEXTS)
.collect(Collectors.toList());

StringBuilder builder = new StringBuilder();
for (Candidate top : tops) {
builder.append(top.prettyPrint()).append('\n');
Expand Down

0 comments on commit 14aa09a

Please # to comment.