J methods
Definition
J methods support the definition of all J program processing. They are linked to J classes.
Declaration
A J method
called "method_name", linked to a J class called "class_name",
in the default UML profile, will be defined as follows:
class_name: default#method_name
{
// J instructions
}
Note: The metamodel editor produces this syntax, and the J programmer need only enter the instructions that make up the method body.
Example
We are going
to write a specific "print" method, linked to the "Class"
class and that displays the class name.
Class:print()
{
// the name of a class is contained in the Name attribute
StdOut.write("PRINT ", Name);
}