org.sourceflow.visualbasic
Class VisualBasicMethod

java.lang.Object
  extended byorg.sourceflow.CodeElement
      extended byorg.sourceflow.visualbasic.VisualBasicMethod
All Implemented Interfaces:
java.lang.Comparable

public class VisualBasicMethod
extends CodeElement

A class generating a Visual Basic method declaration.


Field Summary
static int FRIEND
          The friend access modifier constant.
static int MUST_OVERRIDE
          The must override modifier constant.
static int NOT_OVERRIDABLE
          The not overridable modifier constant.
static int OVERLOADS
          The overloads modifier constant.
static int OVERRIDABLE
          The overridable modifier constant.
static int OVERRIDES
          The overrides modifier constant.
static int PRIVATE
          The private access modifier constant.
static int PROTECTED
          The protected access modifier constant.
static int PROTECTED_FRIEND
          The protected friend access modifier constant.
static int PUBLIC
          The public access modifier constant.
static int SHADOWS
          The shadows modifier constant.
static int SHARED
          The shared modifier constant.
 
Constructor Summary
VisualBasicMethod(int modifiers, java.lang.String name, java.lang.String args, java.lang.String returnType)
          Creates a new method with the specified arguments.
VisualBasicMethod(java.lang.String name)
          Creates a new method with the specified name.
VisualBasicMethod(java.lang.String name, java.lang.String args)
          Creates a new method with the specified name and arguments.
VisualBasicMethod(java.lang.String name, java.lang.String args, java.lang.String returnType)
          Creates a new method with the specified arguments.
 
Method Summary
 void addCode(java.lang.String codeLines)
          Adds one or more lines of actual code.
 void addComment(VisualBasicComment comment)
          Sets a comment for this method.
 boolean canPrintCode()
          Checks if the method source code can the printed.
 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.
 void setPrintCode(boolean value)
          Sets the print code flag.
 java.lang.String toString()
          Returns the method name.
 
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_FRIEND

public static final int PROTECTED_FRIEND
The protected friend access modifier constant.

See Also:
Constant Field Values

PROTECTED

public static final int PROTECTED
The protected access modifier constant.

See Also:
Constant Field Values

FRIEND

public static final int FRIEND
The friend access modifier constant.

See Also:
Constant Field Values

PRIVATE

public static final int PRIVATE
The private access modifier constant. Cannot be combined with virtual, overrides, or must override.

See Also:
Constant Field Values

SHARED

public static final int SHARED
The shared modifier constant. Cannot be combined with overridable, overrides, or must override.

See Also:
Constant Field Values

SHADOWS

public static final int SHADOWS
The shadows modifier constant. Cannot be combined with overrides.

See Also:
Constant Field Values

OVERRIDABLE

public static final int OVERRIDABLE
The overridable modifier constant. Cannot be combined with private, shared, overrides, or must override.

See Also:
Constant Field Values

NOT_OVERRIDABLE

public static final int NOT_OVERRIDABLE
The not overridable modifier constant. Cannot be combined with must override.

See Also:
Constant Field Values

OVERRIDES

public static final int OVERRIDES
The overrides modifier constant. Cannot be combined with private, shared, overridable, or shadows.

See Also:
Constant Field Values

MUST_OVERRIDE

public static final int MUST_OVERRIDE
The must override modifier constant. Cannot be combined with private, shared, overridable, not overridable, or extern.

See Also:
Constant Field Values

OVERLOADS

public static final int OVERLOADS
The overloads modifier constant.

See Also:
Constant Field Values
Constructor Detail

VisualBasicMethod

public VisualBasicMethod(java.lang.String name)
Creates a new method with the specified name. The method will not take any arguments and will return void.

Parameters:
name - the method name

VisualBasicMethod

public VisualBasicMethod(java.lang.String name,
                         java.lang.String args)
Creates a new method with the specified name and arguments. The method will return void.

Parameters:
name - the method name
args - the argument list, excluding parenthesis

VisualBasicMethod

public VisualBasicMethod(java.lang.String name,
                         java.lang.String args,
                         java.lang.String returnType)
Creates a new method with the specified arguments.

Parameters:
name - the method name
args - the argument list, excluding parenthesis
returnType - the return type

VisualBasicMethod

public VisualBasicMethod(int modifiers,
                         java.lang.String name,
                         java.lang.String args,
                         java.lang.String returnType)
Creates a new method with the specified arguments.

Parameters:
modifiers - the modifier flags to use
name - the method name
args - the argument list, excluding parenthesis
returnType - the return type
Method Detail

toString

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

Returns:
the method name

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(VisualBasicComment comment)
Sets a comment for this method.

Parameters:
comment - the new method 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

canPrintCode

public boolean canPrintCode()
Checks if the method source code can the printed. This method will return false if the method is must override or if the print code flag is set to false.

Returns:
true if method source code can be printed, or false otherwise

setPrintCode

public void setPrintCode(boolean value)
Sets the print code flag.

Parameters:
value - the new print code flag value

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