net.percederberg.grammatica.code.csharp
Class CSharpComment

java.lang.Object
  |
  +--net.percederberg.grammatica.code.CodeElement
        |
        +--net.percederberg.grammatica.code.csharp.CSharpComment
All Implemented Interfaces:
java.lang.Comparable

public class CSharpComment
extends CodeElement

A class generating a C# comment.

Version:
1.0
Author:
Per Cederberg,

Field Summary
static int BLOCK
          The block comment type.
static int DOCUMENTATION
          The documentation comment type.
static int SINGLELINE
          The single line comment type.
 
Constructor Summary
CSharpComment(int type, java.lang.String comment)
          Creates a new comment of the specified type.
CSharpComment(java.lang.String comment)
          Creates a new documentation comment with no indentation.
 
Method Summary
 int category()
          Returns a numeric category number for the code element.
 void print(java.io.PrintWriter out, CodeStyle style, int indent)
          Prints the comment to the specified stream.
 
Methods inherited from class net.percederberg.grammatica.code.CodeElement
compareTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOCUMENTATION

public static final int DOCUMENTATION
The documentation comment type.

See Also:
Constant Field Values

BLOCK

public static final int BLOCK
The block comment type.

See Also:
Constant Field Values

SINGLELINE

public static final int SINGLELINE
The single line comment type. Note that this may be used even if the comment spans several lines, as the // characters will be duplicated for each line.

See Also:
Constant Field Values
Constructor Detail

CSharpComment

public CSharpComment(java.lang.String comment)
Creates a new documentation comment with no indentation.

Parameters:
comment - the comment text

CSharpComment

public CSharpComment(int type,
                     java.lang.String comment)
Creates a new comment of the specified type.

Parameters:
type - the comment type
comment - the comment text
See Also:
DOCUMENTATION, BLOCK, SINGLELINE
Method Detail

category

public int category()
Returns a numeric category number for the code element. A lower category number implies that the code element should be placed before code elements with a higher category number within a declaration.

Specified by:
category in class CodeElement
Returns:
the category number

print

public void print(java.io.PrintWriter out,
                  CodeStyle style,
                  int indent)
Prints the comment to the specified stream.

Specified by:
print in class CodeElement
Parameters:
out - the output stream
style - the code style to use
indent - the indentation level