Annotation Syntax and Placement

1 Annotation Choice

Annotation elements can also be structured as redeclarations. Here is an example of a level-three nested choices redeclaration annotation using short class definitions in the redeclarations:



2 Class Annotations

The Resistor2 example below illustrates that annotation elements can occur anywhere among the list of elements in a class. The public keyword is used to end the equation section before starting the annotation, otherwise the annotation becomes associated with the equation section:


2.1 Electrical units


2.2 Electrical Connectors


2.3 Resistor2



Class annotations for classes defined by short class definitions are placed at the end of the declaration. For example, the
Icon annotation is placed at the end of the Velocity declaration below, after the optional string comment:




Annotations can also be used to attach documentation information to a package:



3 Variable Annotations

A variable annotation associates information with a declared variable. Such an annotation is placed at the end of the variable declaration after the optional string comment.


3.1 Electrical Connectors


3.2 Variable Annotation Example


4 Import Annotations

As for variable annotations, import annotations are placed at the end of the import statement after the optional string comment, e.g.:



5 Equation Annotations

The most common form of equation annotation is annotations to connect equations. It is natural to associate graphical attributes such as lines with a certain position, length, and color to such equations. Notice that the declaration is placed at the end, after the optional comment, as in Variable and Import Annotations.



6 Statement and Algorithm Annotations

Statements can also be annotated, even though the need is less obvious than for connection equations. As for equations, statement annotations are placed at the end of the statement after the optional string comment, e.g.: