@Test public void should_return_null_when_no_proposalSets_given() throws Exception { List<RobotCompletionProposalSet> sets = new ArrayList<RobotCompletionProposalSet>(); ICompletionProposal[] actual = filter.extractMostRelevantProposals(sets); assertNull(actual); }
@Override public ICompletionProposal[] extractMostRelevantProposals(List<RobotCompletionProposalSet> proposalSets2) { PriorityDeque<RobotCompletionProposalSet> proposalSets = removeEmptyProposalSets(proposalSets2); int lowestPriority = proposalSets.peekLowestPriority(); boolean isEmpty = lowestPriority == -1; if (isEmpty) { return null; } if (lowestPriority < NOT_BASED_ON_INPUT_MASK) { proposalSets.clear(NOT_BASED_ON_INPUT_MASK, proposalSets.getNumberOfPriorityLevels() - 1); } List<RobotCompletionProposal> proposals = new ArrayList<RobotCompletionProposal>(); for (RobotCompletionProposalSet proposalSet : proposalSets) { proposals.addAll(proposalSet.getProposals()); } return proposals.toArray(new ICompletionProposal[proposals.size()]); }
RelevantProposalsFilter implements IRelevantProposalsFilter { @Override public ICompletionProposal[] extractMostRelevantProposals(List<RobotCompletionProposalSet> proposalSets2) { PriorityDeque<RobotCompletionProposalSet> proposalSets = removeEmptyProposalSets(proposalSets2); int lowestPriority = proposalSets.peekLowestPriority(); boolean isEmpty = lowestPriority == -1; if (isEmpty) { return null; } if (lowestPriority < NOT_BASED_ON_INPUT_MASK) { proposalSets.clear(NOT_BASED_ON_INPUT_MASK, proposalSets.getNumberOfPriorityLevels() - 1); } List<RobotCompletionProposal> proposals = new ArrayList<RobotCompletionProposal>(); for (RobotCompletionProposalSet proposalSet : proposalSets) { proposals.addAll(proposalSet.getProposals()); } return proposals.toArray(new ICompletionProposal[proposals.size()]); } }
RelevantProposalsFilter implements IRelevantProposalsFilter { @Override public ICompletionProposal[] extractMostRelevantProposals(List<RobotCompletionProposalSet> proposalSets2) { PriorityDeque<RobotCompletionProposalSet> proposalSets = removeEmptyProposalSets(proposalSets2); int lowestPriority = proposalSets.peekLowestPriority(); boolean isEmpty = lowestPriority == -1; if (isEmpty) { return null; } if (lowestPriority < NOT_BASED_ON_INPUT_MASK) { proposalSets.clear(NOT_BASED_ON_INPUT_MASK, proposalSets.getNumberOfPriorityLevels() - 1); } List<RobotCompletionProposal> proposals = new ArrayList<RobotCompletionProposal>(); for (RobotCompletionProposalSet proposalSet : proposalSets) { proposals.addAll(proposalSet.getProposals()); } return proposals.toArray(new ICompletionProposal[proposals.size()]); }  }
RelevantProposalsFilter implements IRelevantProposalsFilter { @Override public ICompletionProposal[] extractMostRelevantProposals(List<RobotCompletionProposalSet> proposalSets2) { PriorityDeque<RobotCompletionProposalSet> proposalSets = removeEmptyProposalSets(proposalSets2); int lowestPriority = proposalSets.peekLowestPriority(); boolean isEmpty = lowestPriority == -1; if (isEmpty) { return null; } if (lowestPriority < NOT_BASED_ON_INPUT_MASK) { proposalSets.clear(NOT_BASED_ON_INPUT_MASK, proposalSets.getNumberOfPriorityLevels() - 1); } List<RobotCompletionProposal> proposals = new ArrayList<RobotCompletionProposal>(); for (RobotCompletionProposalSet proposalSet : proposalSets) { proposals.addAll(proposalSet.getProposals()); } return proposals.toArray(new ICompletionProposal[proposals.size()]); }  @Override ICompletionProposal[] extractMostRelevantProposals(List<RobotCompletionProposalSet> proposalSets2); }
RelevantProposalsFilter implements IRelevantProposalsFilter { @Override public ICompletionProposal[] extractMostRelevantProposals(List<RobotCompletionProposalSet> proposalSets2) { PriorityDeque<RobotCompletionProposalSet> proposalSets = removeEmptyProposalSets(proposalSets2); int lowestPriority = proposalSets.peekLowestPriority(); boolean isEmpty = lowestPriority == -1; if (isEmpty) { return null; } if (lowestPriority < NOT_BASED_ON_INPUT_MASK) { proposalSets.clear(NOT_BASED_ON_INPUT_MASK, proposalSets.getNumberOfPriorityLevels() - 1); } List<RobotCompletionProposal> proposals = new ArrayList<RobotCompletionProposal>(); for (RobotCompletionProposalSet proposalSet : proposalSets) { proposals.addAll(proposalSet.getProposals()); } return proposals.toArray(new ICompletionProposal[proposals.size()]); }  @Override ICompletionProposal[] extractMostRelevantProposals(List<RobotCompletionProposalSet> proposalSets2);  }