org.sourceflow.csharp
Class CSharpUsing

java.lang.Object
  extended byorg.sourceflow.CodeElement
      extended byorg.sourceflow.csharp.CSharpUsing
All Implemented Interfaces:
java.lang.Comparable

public class CSharpUsing
extends CodeElement

A class generating a C# using declaration.


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.
 void printSeparator(java.io.PrintWriter out, CodeElement prev)
          Prints a separator line between this element and the previous element in a container.
 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.

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.

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

printSeparator

public void printSeparator(java.io.PrintWriter out,
                           CodeElement prev)
Prints a separator line between this element and the previous element in a container. This method will NOT be called for the first element in a container, as it has no previous element. This method prints a single newline only if the previous element had another category number.

Overrides:
printSeparator in class CodeElement
Parameters:
out - the output stream
prev - the previous code element