org.sourceflow.csharp
Class CSharpEnumeration

java.lang.Object
  extended byorg.sourceflow.CodeElement
      extended byorg.sourceflow.CodeContainer
          extended byorg.sourceflow.csharp.CSharpType
              extended byorg.sourceflow.csharp.CSharpEnumeration
All Implemented Interfaces:
java.lang.Comparable

public class CSharpEnumeration
extends org.sourceflow.csharp.CSharpType

A class generating a C# enumeration declaration.


Field Summary
static int INTERNAL
          The internal access modifier constant.
protected  org.sourceflow.csharp.CSharpEnumeration.Constant last
          The last enumeration constant added.
static int NEW
          The new 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
CSharpEnumeration(int modifiers, java.lang.String name)
          Creates a new enumeration code generator with the specified modifiers.
CSharpEnumeration(java.lang.String name)
          Creates a new enumeration code generator with public access.
 
Method Summary
 void addComment(CSharpComment comment)
          Sets the type comment.
 void addConstant(java.lang.String name)
          Adds a constant to the enumeration.
 void addConstant(java.lang.String name, java.lang.String value)
          Adds a constant to the enumeration.
 void addConstant(java.lang.String name, java.lang.String value, CSharpComment comment)
          Adds a constant to the enumeration.
 int category()
          Returns a numeric category number for the code element.
 void print(java.io.PrintWriter out, CodeStyle style, int indent)
          Prints the code element to the specified output stream.
protected  void print(java.io.PrintWriter out, CodeStyle style, int indent, java.lang.String type, boolean compact)
          Prints the type to the specified stream.
 java.lang.String toString()
          Returns the type name.
 
Methods inherited from class org.sourceflow.CodeContainer
addElement, printContents, size
 
Methods inherited from class org.sourceflow.CodeElement
compareTo, printSeparator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, 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. May only be used when declared inside another type.

See Also:
Constant Field Values

PROTECTED

public static final int PROTECTED
The protected access modifier constant. May only be used when declared inside another type.

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. May only be used when declared inside another type.

See Also:
Constant Field Values

NEW

public static final int NEW
The new modifier constant. May only be used when declared inside another type.

See Also:
Constant Field Values

last

protected org.sourceflow.csharp.CSharpEnumeration.Constant last
The last enumeration constant added.

Constructor Detail

CSharpEnumeration

public CSharpEnumeration(java.lang.String name)
Creates a new enumeration code generator with public access.

Parameters:
name - the enumeration name

CSharpEnumeration

public CSharpEnumeration(int modifiers,
                         java.lang.String name)
Creates a new enumeration code generator with the specified modifiers.

Parameters:
modifiers - the modifier flag constants
name - the enumeration name
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

addConstant

public void addConstant(java.lang.String name)
Adds a constant to the enumeration.

Parameters:
name - the constant name

addConstant

public void addConstant(java.lang.String name,
                        java.lang.String value)
Adds a constant to the enumeration.

Parameters:
name - the constant name
value - the constant value

addConstant

public void addConstant(java.lang.String name,
                        java.lang.String value,
                        CSharpComment comment)
Adds a constant to the enumeration.

Parameters:
name - the constant name
value - the constant value, or null
comment - the constant comment

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

toString

public java.lang.String toString()
Returns the type name.

Returns:
the type name

addComment

public void addComment(CSharpComment comment)
Sets the type comment. This method will remove any previous type comment.

Parameters:
comment - the new type comment

print

protected void print(java.io.PrintWriter out,
                     CodeStyle style,
                     int indent,
                     java.lang.String type,
                     boolean compact)
Prints the type to the specified stream.

Parameters:
out - the output stream
style - the code style to use
indent - the indentation level
type - the type name
compact - the compact printing flag