RECODER 0.92

recoder.java
Class Comment

java.lang.Object
  extended by recoder.java.JavaSourceElement
      extended by recoder.java.Comment
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, SourceElement
Direct Known Subclasses:
DocComment, SingleLineComment

public class Comment
extends JavaSourceElement

A comment, possibly with multiple lines.

Author:
AL
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface recoder.java.SourceElement
SourceElement.Position
 
Field Summary
 
Fields inherited from class recoder.java.JavaSourceElement
factory
 
Constructor Summary
  Comment()
          Create a new empty comment.
protected Comment(Comment proto)
          Comment.
  Comment(java.lang.String text)
          Create a new comment with the given content.
  Comment(java.lang.String text, boolean prefixed)
          Create a new comment with the given content.
 
Method Summary
 void accept(SourceVisitor v)
          Receive a visitor, for instance a pretty printer.
 Comment deepClone()
          Deep clone.
 ProgramElement getParent()
          Get parent of the comment.
 java.lang.String getText()
          Get the comment text.
 boolean isContainerComment()
           
 boolean isPrefixed()
          Check if this comment should be prefixed in front of the parent element, or if it should follow it.
 void setContainerComment(boolean isContainerComment)
          Define if this comment should be a container comment.
 void setParent(ProgramElement p)
          Set parent of the comment.
 void setPrefixed(boolean prefixed)
          Define if this comment should be prefixed in front of the parent element, or if it should follow it.
 void setText(java.lang.String text)
          Set text, including all markers.
 java.lang.String toString()
           
 
Methods inherited from class recoder.java.JavaSourceElement
getEndPosition, getFactory, getFirstElement, getLastElement, getRelativePosition, getStartPosition, setEndPosition, setRelativePosition, setStartPosition, toSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Comment

public Comment()
Create a new empty comment. The comment contains an empty string, the slash-asterics markers are not created.


Comment

public Comment(java.lang.String text)
Create a new comment with the given content. No extra comment markers are created.

Parameters:
text - the text of the comment.

Comment

public Comment(java.lang.String text,
               boolean prefixed)
Create a new comment with the given content. No extra comment markers are created.

Parameters:
text - the text of the comment.

Comment

protected Comment(Comment proto)
Comment.

Parameters:
proto - a comment.
Method Detail

deepClone

public Comment deepClone()
Deep clone.

Returns:
the object.

isPrefixed

public boolean isPrefixed()
Check if this comment should be prefixed in front of the parent element, or if it should follow it.

Returns:
the boolean value.

isContainerComment

public boolean isContainerComment()

setPrefixed

public void setPrefixed(boolean prefixed)
Define if this comment should be prefixed in front of the parent element, or if it should follow it. Implicitly sets isContainerComment to false.

Parameters:
prefixed - the boolean value.

setContainerComment

public void setContainerComment(boolean isContainerComment)
Define if this comment should be a container comment. Implicitly sets isPrefixed to false.

Parameters:
isContainerComment -

setParent

public void setParent(ProgramElement p)
Set parent of the comment.

Parameters:
p - a program element.

getParent

public ProgramElement getParent()
Get parent of the comment.

Returns:
the parent element.

getText

public java.lang.String getText()
Get the comment text.

Returns:
the string with the complete content.

setText

public void setText(java.lang.String text)
Set text, including all markers. The text must contain all necessary leading and closing tokens.

Parameters:
text - a string.

accept

public void accept(SourceVisitor v)
Description copied from interface: SourceElement
Receive a visitor, for instance a pretty printer.

Parameters:
v - a source visitor.

toString

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

RECODER 0.92