Where am I and how do I get to…?

In AnyLogic you are not writing the full code of Java classes from the beginning to the end. Instead you are entering pieces of code and expressions in numerous small edit boxes in the properties of various model elements. Therefore it is important to always understand where exactly are you writing the code (which class and method it belongs to) and how can you access other model elements from there.


Most of the code you write when you develop models is the code of an agent type, more precisely it is the code of one of the agent type methods. No matter whether you are defining an action of an event, setting parameter of an embedded object, or writing a startup code – you can assume you are writing the code of the current agent type. Therefore the following rules apply (see the Figure):