Parameters

The parameters are a list of parameters for the method. A parameter declaration has the following syntax.

name[, name, name...] : type [usage];

The usage value can be constant, input, io (input-output), or output. If you do not specify a usage, a default of constant is assumed.

The parameter usages are as follows.

You can define parameters only for conditions that are not constraints, and the parameters must be constant parameters. (For more details, see "Adding Conditions to Classes or Primitive Types", in Chapter 4 of the JADE Development Environment User’s Guide, and "condition Option", later in this chapter.)

For details about promoting a local variable to be a parameter of the current method, see "Promoting a Local Variable to be a Parameter of the Current Method", in Chapter 4 of the JADE Development Environment User’s Guide.

As the name implies, constant parameters cannot be updated or modified in any way within the body of the method. Specifically, the following restrictions apply to constant parameters.

The following table lists the use of a primitive type parameter in a method.

Usage Value Passed into Method Parameter Value Can Be Updated in Method
constant Yes No
input Yes Cannot be updated by assignment, but can be updated within an updating primitive type method by using the self system variable
output No Yes
io Yes Yes

The following table lists the use of a parameter containing an object reference in a method.

Usage Reference Passed into Method Object Referenced By Parameter Can Be Updated Parameter Can Be Assigned New Object Reference
constant Yes No No
input Yes Yes No
output No Not applicable Yes
io Yes Yes Yes

When a parameter is an object reference, the usage of a parameter also determines the type of reference that can be passed by using the parameter, as listed in the following table.

Usage Types that Can Be Passed to Method Reason
constant Reference of the same type as the parameter or any of its subclasses Equivalent to the calling method assigning a value to the parameter in the method being called
input Reference of the same type as the parameter or any of its subclasses Equivalent to the calling method assigning a value to the parameter in the method being called
output Reference of the same type as the parameter or any of its superclasses Equivalent to the method being called assigning a value to the variable in the calling method
io Reference passed must be of the same type as the parameter Combination of input and output, so an exact match is required

For details about pseudo types and passing variable parameters to methods, see "Pseudo Types" and "Passing Variable Parameters to Methods", respectively, later in this chapter.