net.percederberg.grammatica.code.csharp
Class CSharpConstructor

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

public class CSharpConstructor
extends CodeElement

A class generating a C# constructor declaration.

Version:
1.0
Author:
Per Cederberg,

Field Summary
static int EXTERN
          The extern modifier constant.
static int INTERNAL
          The internal access modifier constant.
static int PRIVATE
          The private access modifier constant.
static int PROTECTED
          The protected access modifier constant.
static int PROTECTED_INTERNAL
          The protected internal access modifier constant.
static int PUBLIC
          The public access modifier constant.
 
Constructor Summary
CSharpConstructor()
          Creates a new empty constructor.
CSharpConstructor(int modifiers, java.lang.String args)
          Creates a new constructor with the specified arguments.
CSharpConstructor(java.lang.String args)
          Creates a new constructor with the specified arguments.
 
Method Summary
 void addCode(java.lang.String codeLines)
          Adds one or more lines of actual code.
 void addComment(CSharpComment comment)
          Sets a comment for this constructor.
 void addInitializer(java.lang.String initializer)
          Adds an initializer call, i.e. a call to another constructor.
 int category()
          Returns a numeric category number for the code element.
 CSharpClass getCSharpClass()
          Returns the class for this constructor, or null.
 void print(java.io.PrintWriter out, CodeStyle style, int indent)
          Prints the code element to the specified output 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

PUBLIC

public static final int PUBLIC
The public access modifier constant.

See Also:
Constant Field Values

PROTECTED_INTERNAL

public static final int PROTECTED_INTERNAL
The protected internal access modifier constant.

See Also:
Constant Field Values

PROTECTED

public static final int PROTECTED
The protected access modifier constant.

See Also:
Constant Field Values

INTERNAL

public static final int INTERNAL
The internal access modifier constant.

See Also:
Constant Field Values

PRIVATE

public static final int PRIVATE
The private access modifier constant.

See Also:
Constant Field Values

EXTERN

public static final int EXTERN
The extern modifier constant.

See Also:
Constant Field Values
Constructor Detail

CSharpConstructor

public CSharpConstructor()
Creates a new empty constructor.


CSharpConstructor

public CSharpConstructor(java.lang.String args)
Creates a new constructor with the specified arguments.

Parameters:
args - the argument list, excluding parenthesis

CSharpConstructor

public CSharpConstructor(int modifiers,
                         java.lang.String args)
Creates a new constructor with the specified arguments.

Parameters:
modifiers - the modifier flags
args - the argument list, excluding parenthesis
Method Detail

getCSharpClass

public CSharpClass getCSharpClass()
Returns the class for this constructor, or null.

Returns:
the class for this constructor, or null if none has been assigned

addInitializer

public void addInitializer(java.lang.String initializer)
Adds an initializer call, i.e. a call to another constructor.

Parameters:
initializer - the initializer call

addCode

public void addCode(java.lang.String codeLines)
Adds one or more lines of actual code.

Parameters:
codeLines - the lines of Java code to add

addComment

public void addComment(CSharpComment comment)
Sets a comment for this constructor.

Parameters:
comment - the new constructor comment

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 code element to the specified output stream.

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