Skip to content

Instantly share code, notes, and snippets.

@573
Created October 23, 2012 15:50
Show Gist options
  • Save 573/3939593 to your computer and use it in GitHub Desktop.
Save 573/3939593 to your computer and use it in GitHub Desktop.
The simple/agent/Agent.java file (JPF)
package simple.agent;
import static org.apache.log4j.Logger.getLogger;
import org.apache.log4j.Logger;
import repast.simphony.engine.schedule.ScheduledMethod;
import simple.extra.RepastUtils;
public class Agent {
private final Logger log = getLogger(Agent.class);
private static short RUN = 1;
public Agent() {
log.debug(Agent.class);
}
@ScheduledMethod(//
start = 1, //
interval = 1.0, //
priority = 999 //
)
public void calledEachStep() {
log.trace(RUN++);
}
/**
* Tests calling a method that is not explicitly mentioned in the score
* file, no problem when this self is a plugin, to test if problem when this
* self is inside a jar file
*/
@ScheduledMethod(//
start = 1, //
interval = 1.0, //
priority = 998 //
)
public void mInClassNotInScore() {
log.trace(RepastUtils.getCurrentSimulationTick());
}
/**
* TODO Test calling a method from another plugin
*/
@ScheduledMethod(//
start = 1, //
interval = 1.0, //
priority = 997 //
)
public void mInAnotherPlugin() {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment