org.aspectj.org.eclipse.jdt.internal.formatter.comment
Class CommentRange

java.lang.Object
  extended by Position
      extended by org.aspectj.org.eclipse.jdt.internal.formatter.comment.CommentRange
All Implemented Interfaces:
ICommentAttributes, IHtmlTagDelimiters

public class CommentRange
extends Position
implements ICommentAttributes, IHtmlTagDelimiters

Range in a comment region in comment region coordinates.

Since:
3.0

Field Summary
 
Fields inherited from interface org.aspectj.org.eclipse.jdt.internal.formatter.comment.ICommentAttributes
COMMENT_BLANKLINE, COMMENT_BREAK, COMMENT_CLOSE, COMMENT_CODE, COMMENT_FIRST_TOKEN, COMMENT_HTML, COMMENT_IMMUTABLE, COMMENT_NEWLINE, COMMENT_OPEN, COMMENT_PARAGRAPH, COMMENT_PARAMETER, COMMENT_ROOT, COMMENT_SEPARATOR, COMMENT_STARTS_WITH_RANGE_DELIMITER
 
Fields inherited from interface org.aspectj.org.eclipse.jdt.internal.formatter.comment.IHtmlTagDelimiters
HTML_CLOSE_PREFIX, HTML_TAG_POSTFIX, HTML_TAG_PREFIX
 
Constructor Summary
CommentRange(int position, int count)
          Creates a new comment range.
 
Method Summary
protected  boolean hasAttribute(int attribute)
          Is the attribute attribute true?
protected  boolean isClosingTag(char[] token, char[] tag)
          Does this comment range contain a closing HTML tag?
protected  boolean isOpeningTag(char[] token, char[] tag)
          Does this comment range contain an opening HTML tag?
protected  void markHtmlTag(char[][] tags, char[] token, int attribute, boolean open, boolean close)
          Mark the comment range with the occurred HTML tags.
protected  void markPrefixTag(char[][] tags, char prefix, char[] token, int attribute)
          Mark the comment range with the occurred tags.
protected  int markTagRange(char[] token, char[] tag, int level, int key, boolean html)
          Marks the comment range with the HTML range tag.
 void move(int delta)
          Moves this comment range.
protected  void setAttribute(int attribute)
          Set the attribute attribute to true.
 java.lang.String toString()
           
 void trimBegin(int delta)
          Trims this comment range at the beginning.
 void trimEnd(int delta)
          Trims this comment range at the end.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CommentRange

public CommentRange(int position,
                    int count)
Creates a new comment range.

Parameters:
position - offset of the range
count - length of the range
Method Detail

hasAttribute

protected final boolean hasAttribute(int attribute)
Is the attribute attribute true?

Parameters:
attribute - the attribute to get
Returns:
true iff this attribute is true, false otherwise

isClosingTag

protected final boolean isClosingTag(char[] token,
                                     char[] tag)
Does this comment range contain a closing HTML tag?

Parameters:
token - token belonging to the comment range
tag - the HTML tag to check
Returns:
true iff this comment range contains a closing html tag, false otherwise

isOpeningTag

protected final boolean isOpeningTag(char[] token,
                                     char[] tag)
Does this comment range contain an opening HTML tag?

Parameters:
token - token belonging to the comment range
tag - the HTML tag to check
Returns:
true iff this comment range contains an opening html tag, false otherwise

markHtmlTag

protected final void markHtmlTag(char[][] tags,
                                 char[] token,
                                 int attribute,
                                 boolean open,
                                 boolean close)
Mark the comment range with the occurred HTML tags.

Parameters:
tags - the HTML tags to test for their occurrence
token - token belonging to the comment range
attribute - attribute to set if a HTML tag is present
open - true iff opening tags should be marked, false otherwise
close - true iff closing tags should be marked, false otherwise

markPrefixTag

protected final void markPrefixTag(char[][] tags,
                                   char prefix,
                                   char[] token,
                                   int attribute)
Mark the comment range with the occurred tags.

Parameters:
tags - the tags to test for their occurrence
prefix - the prefix which is common to all the tags to test
token - the token belonging to the comment range
attribute - attribute to set if a tag is present

markTagRange

protected final int markTagRange(char[] token,
                                 char[] tag,
                                 int level,
                                 int key,
                                 boolean html)
Marks the comment range with the HTML range tag.

Parameters:
token - the token belonging to the comment range
tag - the HTML tag which confines the HTML range
level - the nesting level of the current HTML range
key - the key of the attribute to set if the comment range is in the HTML range
html - true iff the HTML tags in this HTML range should be marked too, false otherwise
Returns:
the new nesting level of the HTML range

move

public final void move(int delta)
Moves this comment range.

Parameters:
delta - the delta to move the range

setAttribute

protected final void setAttribute(int attribute)
Set the attribute attribute to true.

Parameters:
attribute - the attribute to set.

trimBegin

public final void trimBegin(int delta)
Trims this comment range at the beginning.

Parameters:
delta - amount to trim the range

trimEnd

public final void trimEnd(int delta)
Trims this comment range at the end.

Parameters:
delta - amount to trim the range

toString

public java.lang.String toString()