SFE.GUI
Class Function

java.lang.Object
  extended by SFE.GUI.Function

public class Function
extends java.lang.Object

Function A Function includes all function information. It contains the following data: name, description, return type, arguments, local variables and body. A Function renders itself using generateCode(). A function marked with 'must=true' cannot be deleted. Initialize with: Function(program, name) Function(program, name, return-type, must)


Field Summary
 javax.swing.DefaultListModel arguments
           
 javax.swing.DefaultListModel body
           
 java.util.Vector descDoc
           
 ProgramDocument functionDoc
           
 ProgramDocument nameDoc
           
 Type returnType
           
 javax.swing.DefaultListModel variables
           
 
Constructor Summary
Function(Program program, java.lang.String name)
           
Function(Program program, java.lang.String name, Type retType, boolean must)
          Build an undeletable function
 
Method Summary
 boolean equals(java.lang.Object other)
          Compares function by name
 java.lang.String generateCode()
          Generate and return the function code
 java.lang.String getDescription()
          Get the function description
 boolean isMust()
          Is function undeletable
 java.lang.String toString()
          String representation of the function
 void updateDoc()
          Update function body document
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

nameDoc

public ProgramDocument nameDoc

returnType

public Type returnType

descDoc

public java.util.Vector descDoc

arguments

public javax.swing.DefaultListModel arguments

variables

public javax.swing.DefaultListModel variables

body

public javax.swing.DefaultListModel body

functionDoc

public ProgramDocument functionDoc
Constructor Detail

Function

public Function(Program program,
                java.lang.String name)

Function

public Function(Program program,
                java.lang.String name,
                Type retType,
                boolean must)
Build an undeletable function

Parameters:
program - The program
name - Function name
retType - return type
must - is function undeletable
Method Detail

updateDoc

public void updateDoc()
Update function body document


isMust

public boolean isMust()
Is function undeletable


equals

public boolean equals(java.lang.Object other)
Compares function by name

Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
String representation of the function

Overrides:
toString in class java.lang.Object

getDescription

public java.lang.String getDescription()
Get the function description

Returns:
String containing the description

generateCode

public java.lang.String generateCode()
Generate and return the function code

Returns:
The function code as a long string