If you're like many Java developers, you might find point-and-click interfaces a bit lame. Personally, I've changed my tune in this, and I now define all of my ABM models from the editor, saving Java for truly specialized tasks. But even without generation of agent behavior, metaABM can be a really valuable tool, as the GIS example shows. The way to look at metaABM is as a way to compose your overall model and automate the tedious parts. Apart from Java generated code, metaABM maintains a number of very useful artifacts. For example, the Repast Simphony target maintains model.score and all of the model.rs component. Generally, metaABM should save time and hassle while making your models far more transparant even if you never use Act to define agent behavior.
You can mix and match Act behavior with Java and generated code with POJOs. One way to do this is through using protected regions. Select the Statepop.1 Agent (you can change the name to whatever you want) and choose "Generate Protected" from the "Mode" property. Open "Acts", right-click on it, and choose "Create Target: Schedule".
Open up the relevant java file and navigate to the "doSomething" method. You can put whatever you want within the PROTETED REGION comments and those changes will be preserved when the model is regenerated. You can create a schedule, rule or watcher, maintain custom code for the actual implementations, and still have the model adapt to changes in the underlying data structure -- if for example you want to import a modified shape file.
Or we could create a "Method" act with hand-written Java code. This option is nice because all code is contained within the metaabm file.
Another approach which can be more robust is to generate the basic model stubs (like an abstract base class except that it isn't abstract) and then override your model with implementations. MetaABM and Metascape add-ons provide support for generic skeletons, interfaces and even JUnit Tests cases.
To accomplish this, you'll want to create the base classes and then either change the name of the generated classes, or change the names of the classes in the .metaabm file to the classes that are implementing the behavior. Then, be sure to change the imlementation mode to "Load" so that the implementing classes are not overwritten.
Of course, any time that you use Java and target platform specific code such as Repast calls, you lose the ability to generate cross-platform and cross-target code. So while you can use metaABM without ever touching Acts, you should consider using them whenever possible. To get an idea of the power of Acts, you might take a look at the designing a model tutorial. We'd also love to hear your feedback on what works well in the above process and what doesn't.
All contents © Copyright 2008 Metascape, LLC. All rights reserved.