net.percederberg.grammatica.code.csharp
Class CSharpUsing

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

public class CSharpUsing
extends CodeElement

A class generating a C# using declaration.

Version:
1.0
Author:
Per Cederberg,

Constructor Summary
CSharpUsing(java.lang.String namespace)
          Creates a new C# using declaration.
 
Method Summary
 int category()
          Returns a numeric category number for the code element.
 int compareTo(java.lang.Object obj)
          Compares this object to another one.
 boolean equals(java.lang.Object obj)
          Returns true if this object is equal to another.
 void print(java.io.PrintWriter out, CodeStyle style, int indent)
          Prints the code element to the specified output stream.
 java.lang.String toString()
          Returns the namespace to use.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CSharpUsing

public CSharpUsing(java.lang.String namespace)
Creates a new C# using declaration.

Parameters:
namespace - the namespace being used
Method Detail

compareTo

public int compareTo(java.lang.Object obj)
Compares this object to another one. The comparison is based primarily on the code element category, and secondarily on the namespace.

Specified by:
compareTo in interface java.lang.Comparable
Overrides:
compareTo in class CodeElement
Parameters:
obj - the object to compare to
Returns:
negative if this object preceeds the other one, zero (0) if the objects are equal, or positive if this object succeeds the other one

equals

public boolean equals(java.lang.Object obj)
Returns true if this object is equal to another.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare to
Returns:
true if the objects are equal, or false otherwise

toString

public java.lang.String toString()
Returns the namespace to use.

Overrides:
toString in class java.lang.Object
Returns:
the namespace to use

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