@Test public void all_tokens() { Token token1 = new TokenImpl(range(1, 1, 1, 3), "ab", Token.Type.KEYWORD); Token token2 = new TokenImpl(range(1, 4, 1, 6), "cd", Token.Type.KEYWORD); TreeMetaDataProvider provider = new TreeMetaDataProvider(emptyList(), Arrays.asList(token1, token2)); List<Token> allTokens = provider.allTokens(); assertThat(allTokens).hasSize(2); assertThat(allTokens.get(0).text()).isEqualTo("ab"); assertThat(allTokens.get(1).text()).isEqualTo("cd"); }
public List<Token> allTokens() { return sortedTokens; }
TreeMetaDataProvider { public List<Token> allTokens() { return sortedTokens; } }
TreeMetaDataProvider { public List<Token> allTokens() { return sortedTokens; } TreeMetaDataProvider(List<Comment> comments, List<Token> tokens); }
TreeMetaDataProvider { public List<Token> allTokens() { return sortedTokens; } TreeMetaDataProvider(List<Comment> comments, List<Token> tokens); List<Comment> allComments(); List<Token> allTokens(); int indexOfFirstToken(TextRange textRange); Optional<Token> firstToken(TextRange textRange); Optional<Token> previousToken(TextRange textRange); Optional<Token> previousToken(TextRange textRange, String expectedTokenValue); Optional<Token> previousToken(TextRange textRange, Predicate<Token> expectedConditionToMatch); void updateTokenType(Token token, Token.Type newType); Token keyword(TextRange textRange); TreeMetaData metaData(TextRange textRange); }
TreeMetaDataProvider { public List<Token> allTokens() { return sortedTokens; } TreeMetaDataProvider(List<Comment> comments, List<Token> tokens); List<Comment> allComments(); List<Token> allTokens(); int indexOfFirstToken(TextRange textRange); Optional<Token> firstToken(TextRange textRange); Optional<Token> previousToken(TextRange textRange); Optional<Token> previousToken(TextRange textRange, String expectedTokenValue); Optional<Token> previousToken(TextRange textRange, Predicate<Token> expectedConditionToMatch); void updateTokenType(Token token, Token.Type newType); Token keyword(TextRange textRange); TreeMetaData metaData(TextRange textRange); static final Comparator<HasTextRange> COMPARATOR; }