More refactoring (added early returns)

Signed-off-by: Jonathan Philip Knoblauch <JonathanPhilip.Knoblauch@bosch-si.com>
This commit is contained in:
Jonathan Philip Knoblauch
2016-10-04 10:16:08 +02:00
parent fa3cee62bf
commit 8c7af7d28d
3 changed files with 22 additions and 13 deletions

View File

@@ -92,9 +92,12 @@ public class RsqlParserValidationOracle implements RsqlValidationOracle {
}
private static Collection<? extends SuggestToken> getLogicalOperatorSuggestion(final String rsqlQuery) {
final int currentQueryLength = rsqlQuery.length();
// only return and/or suggestion when there is a space at the end
if (!rsqlQuery.endsWith(" ")) {
return Collections.emptyList();
}
if (rsqlQuery.endsWith(" ")) {
final int currentQueryLength = rsqlQuery.length();
// only return and/or suggestion when there is a space at the end
final Collection<String> tokenImages = TokenDescription.getTokenImage(TokenDescription.LOGICAL_OP);
final List<SuggestToken> logicalOps = new ArrayList<>(tokenImages.size());
for (final String tokenImage : tokenImages) {