com.sonar.sslr.api
Class Comments

java.lang.Object
  extended by com.sonar.sslr.api.Comments
All Implemented Interfaces:
Iterable<Token>

public class Comments
extends Object
implements Iterable<Token>

Utility class to manipulate comment tokens


Constructor Summary
Comments(com.google.common.collect.ListMultimap<Integer,Token> comments)
           
Comments(com.google.common.collect.ListMultimap<Integer,Token> comments, CommentAnalyser analyser)
           
 
Method Summary
 Token getCommentAtLine(int line)
          Deprecated. see getCommentTokensAtLine(int)
 List<Token> getCommentTokensAtLine(int line)
           
 SortedSet<Integer> getLinesOfComment()
          Get the sorted list of lines containing at least a comment
 boolean hasCommentTokensAtLine(int line)
           
 boolean isBlank(String commentValue)
           
 boolean isBlankComment(int line)
          Deprecated. see #isBlank(int)
static boolean isBlankComment(String comment)
          Deprecated. see isBlank(String)
 boolean isThereCommentAtLine(int commentLine)
          Deprecated. see hasCommentTokensAtLine(int)
 boolean isThereCommentBeforeLine(int line)
          Deprecated. since 1.13 use trivia instead
 Iterator<Token> iterator()
          Iterates over the collection of comment tokens
 int size()
          Return the number of comment tokens
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Comments

public Comments(com.google.common.collect.ListMultimap<Integer,Token> comments)

Comments

public Comments(com.google.common.collect.ListMultimap<Integer,Token> comments,
                CommentAnalyser analyser)
Method Detail

iterator

public Iterator<Token> iterator()
Iterates over the collection of comment tokens

Specified by:
iterator in interface Iterable<Token>

getLinesOfComment

public SortedSet<Integer> getLinesOfComment()
Get the sorted list of lines containing at least a comment


size

public int size()
Return the number of comment tokens


hasCommentTokensAtLine

public boolean hasCommentTokensAtLine(int line)
Parameters:
line - the line where we expect to find some comment tokens
Returns:
true if there is at least one comment token at provided line

getCommentTokensAtLine

public List<Token> getCommentTokensAtLine(int line)
Parameters:
line - the line where we expect to find some comment tokens
Returns:
the list of comment tokens on this line

isBlank

public boolean isBlank(String commentValue)
Parameters:
commentValue - the value of the comment
Returns:
true if the value is considered to be a blank comment

isBlankComment

@Deprecated
public static boolean isBlankComment(String comment)
Deprecated. see isBlank(String)


isBlankComment

@Deprecated
public boolean isBlankComment(int line)
Deprecated. see #isBlank(int)


getCommentAtLine

@Deprecated
public Token getCommentAtLine(int line)
Deprecated. see getCommentTokensAtLine(int)


isThereCommentBeforeLine

public boolean isThereCommentBeforeLine(int line)
Deprecated. since 1.13 use trivia instead

Parameters:
line - the line above which some non-blank comment tokens are expected to be found
Returns:
true if there is a list one non-blank comment tokens before the provided line

isThereCommentAtLine

@Deprecated
public boolean isThereCommentAtLine(int commentLine)
Deprecated. see hasCommentTokensAtLine(int)



Copyright © 2009-2014 SonarSource. All Rights Reserved.