A RePast Tutorial by John T. Murphy, University of Arizona & Arizona State University (contact)
Having made this change, we will now get to the first (mildly) exciting step: compiling and running. Naturally the model won't do anything, but it should compile and display part of the GUI.
To take this step we will need to fill in the Main method of the CarrySpaceModel object. Take note of the lines added:
// CarryDropModel
package demo;
import uchicago.src.sim.engine.Schedule;
import uchicago.src.sim.engine.SimInit;
import uchicago.src.sim.engine.SimModelImpl;
public class CarryDropModel extends SimModelImpl {
private int numAgents;
private int worldXSize;
private int worldYSize;
private Schedule schedule;
public String getName(){
return "Carry And Drop";
}
public void setup(){
}
public void begin(){
buildModel();
buildSchedule();
buildDisplay();
}
public void buildModel(){
}
public void buildSchedule(){
}
public void buildDisplay(){
}
public Schedule getSchedule(){
return schedule;
}
public String[] getInitParam(){
String[] initParams = { "NumAgents" , "WorldXSize", "WorldYSize" };
return initParams;
}
public int getNumAgents(){
return numAgents;
}
public void setNumAgents(int na){
numAgents = na;
}
public int getWorldXSize(){
return worldXSize;
}
public void setWorldXSize(int wxs){
worldXSize = wxs;
}
public int getWorldYSize(){
return worldYSize;
}
public void setWorldYSize(int wys){
worldYSize = wys;
}
public static void main(String[] args) {
SimInit init = new SimInit();
CarryDropModel model = new CarryDropModel();
init.loadModel(model, "", false);
}
}
// CarryDropAgent
package demo;
public class CarryDropAgent {
}
// CarryDropSpace
package demo;
public class CarryDropSpace {
}
The three lines can be explained as follows:
This model will compile and run- again, it doesn't do anything, but RePast is running and you should see the RePast control bar and the GUI in which you can enter new user parameters.
Previous: User-Settable Parameters
Next: Default Values for User-Settable Parameters
Go to Table of Contents
A RePast Tutorial by John T. Murphy, University of Arizona & Arizona State University (contact)