The <imports>
tag is used to
specify, which classes and packages can be used by Java expressions throughout an
agent or capability definition file.
The import section with an ADF resembles very much the Java import section of
a class file. A Jadex import statement has the same syntax as in Java allowing
single classes as well as whole packages being included.
The imports are used for searching Java classes as well as non-Java agent
artifacts such as agent.xml
or capability.xml
files.
It is not necessary to declare an import statement for the actual package
of the ADF as this is automatically considered.
... <imports> <!-- Import only the HashMap class. --> <import>java.util.HashMap</import> <!-- Import all classes of the awt package. --> <import>java.awt.*</import> <!-- Import a movement package containing, e.g., a Move capability. --> <import>movement.*</import> ... </imports> <capabilities> <!-- Use the imported movement.Move capability. --> <capability name="movecap" file="Move"/> </capabilities> <beliefs> <!-- Use the imported java.util.HashMap. --> <belief name="data"> <fact>new HashMap()</fact> </belief> <!-- Use the imported java.awt.Frame. --> <belief name="gui"> <fact>new Frame()</fact> </belief> </beliefs> ...
Figure 4.2. Example import declaration and usage