DOCUMENTATION TUTORIALS DOWNLOAD NEWS CONTRIBUTE

Developing Operators

Operators in the GAML language are used to compose complex expressions. An operator performs a function on one, two, or n operands (which are other expressions and thus may be themselves composed of operators) and returns the result of this function. Developing a new operator allows, then, to add a new function to GAML.

Implementation

A new operator can be any Java method that:

The method:

Annotations

@operator

This annotation represents an “operator” in GAML, and is used to define its name(s) as well as some meta-data that will be used during the validation process.

This annotation contains:

@doc

It provides a unified way of attaching documentation to the various GAML elements tagged by the other annotations. The documentation is automatically assembled at compile time and also used at runtime in GAML editors.

All these annotations are defined in the GamlAnnotations.java file of the msi.gama.processor plug-in.