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

java.lang.Object
  extended by org.aspectj.org.eclipse.jdt.internal.formatter.comment.CommentLine
All Implemented Interfaces:
IBorderAttributes
Direct Known Subclasses:
MultiCommentLine, SingleCommentLine

public abstract class CommentLine
extends java.lang.Object
implements IBorderAttributes

General comment line in a comment region.

Since:
3.0

Field Summary
protected static java.lang.String NON_FORMAT_START_PREFIX
          Prefix of non-formattable comment lines
 
Fields inherited from interface org.aspectj.org.eclipse.jdt.internal.formatter.comment.IBorderAttributes
BORDER_LOWER, BORDER_UPPER
 
Constructor Summary
protected CommentLine(CommentRegion parent)
          Creates a new comment line.
 
Method Summary
protected abstract  void adapt(CommentLine previous)
          Adapts the line attributes from the previous line in the comment region.
protected  void append(CommentRange range)
          Appends the specified comment range to this comment line.
protected  CommentRange formatLine(CommentLine predecessor, CommentRange last, java.lang.String indentation, int line)
          Formats this comment line as content line.
protected  void formatLowerBorder(CommentRange range, java.lang.String indentation, int length)
          Formats this comment line as end line having a lower border consisting of content line prefixes.
protected  void formatUpperBorder(CommentRange range, java.lang.String indentation, int length)
          Formats this comment line as start line having an upper border consisting of content line prefixes.
protected abstract  java.lang.String getContentPrefix()
          Returns the line prefix of content lines.
protected abstract  java.lang.String getEndingPrefix()
          Returns the line prefix of end lines.
protected  CommentRange getFirst()
          Returns the first comment range in this comment line.
protected  java.lang.String getIndentationReference()
          Returns the indentation reference string for this line.
protected  CommentRange getLast()
          Returns the last comment range in this comment line.
protected  CommentRegion getParent()
          Returns the parent comment region of this comment line.
protected  int getSize()
          Returns the number of comment ranges in this comment line.
protected abstract  java.lang.String getStartingPrefix()
          Returns the line prefix of start lines.
protected  boolean hasAttribute(int attribute)
          Is the attribute attribute true?
protected abstract  void scanLine(int line)
          Scans this comment line for comment range boundaries.
protected  void setAttribute(int attribute)
          Set the attribute attribute to true.
protected  void tokenizeLine(int line)
          Tokenizes this comment line into comment ranges
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NON_FORMAT_START_PREFIX

protected static final java.lang.String NON_FORMAT_START_PREFIX
Prefix of non-formattable comment lines

See Also:
Constant Field Values
Constructor Detail

CommentLine

protected CommentLine(CommentRegion parent)
Creates a new comment line.

Parameters:
parent - comment region to create the comment line for
Method Detail

adapt

protected abstract void adapt(CommentLine previous)
Adapts the line attributes from the previous line in the comment region.

Parameters:
previous - the previous comment line in the comment region

append

protected void append(CommentRange range)
Appends the specified comment range to this comment line.

Parameters:
range - comment range to append to this line

formatLine

protected CommentRange formatLine(CommentLine predecessor,
                                  CommentRange last,
                                  java.lang.String indentation,
                                  int line)
Formats this comment line as content line.

Parameters:
predecessor - the predecessor comment line in the comment region
last - the most recently processed comment range
indentation - the indentation of the comment region
line - the index of this comment line in the comment region
Returns:
the first comment range in this comment line

formatLowerBorder

protected void formatLowerBorder(CommentRange range,
                                 java.lang.String indentation,
                                 int length)
Formats this comment line as end line having a lower border consisting of content line prefixes.

Parameters:
range - last comment range of the last comment line in the comment region
indentation - the indentation of the comment region
length - the maximal length of text in this comment region measured in average character widths

formatUpperBorder

protected void formatUpperBorder(CommentRange range,
                                 java.lang.String indentation,
                                 int length)
Formats this comment line as start line having an upper border consisting of content line prefixes.

Parameters:
range - the first comment range in the comment region
indentation - the indentation of the comment region
length - the maximal length of text in this comment region measured in average character widths

getContentPrefix

protected abstract java.lang.String getContentPrefix()
Returns the line prefix of content lines.

Returns:
line prefix of content lines

getEndingPrefix

protected abstract java.lang.String getEndingPrefix()
Returns the line prefix of end lines.

Returns:
line prefix of end lines

getFirst

protected final CommentRange getFirst()
Returns the first comment range in this comment line.

Returns:
the first comment range

getIndentationReference

protected java.lang.String getIndentationReference()
Returns the indentation reference string for this line.

Returns:
the indentation reference string for this line

getLast

protected final CommentRange getLast()
Returns the last comment range in this comment line.

Returns:
the last comment range

getParent

protected final CommentRegion getParent()
Returns the parent comment region of this comment line.

Returns:
the parent comment region

getSize

protected final int getSize()
Returns the number of comment ranges in this comment line.

Returns:
the number of ranges in this line

getStartingPrefix

protected abstract java.lang.String getStartingPrefix()
Returns the line prefix of start lines.

Returns:
line prefix of start lines

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.

scanLine

protected abstract void scanLine(int line)
Scans this comment line for comment range boundaries.

Parameters:
line - the index of this line in the comment region

setAttribute

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

Parameters:
attribute - the attribute to set.

tokenizeLine

protected void tokenizeLine(int line)
Tokenizes this comment line into comment ranges

Parameters:
line - the index of this line in the comment region

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object