Skip to content

Instantly share code, notes, and snippets.

@naufaldi
Created November 9, 2016 18:03
Show Gist options
  • Save naufaldi/d5e430ca51ce7a2a4423c48e934c75ae to your computer and use it in GitHub Desktop.
Save naufaldi/d5e430ca51ce7a2a4423c48e934c75ae to your computer and use it in GitHub Desktop.
Ticker For Tutorial Blog JADE
package programtimmer;
import jade.core.Agent;
import jade.core.behaviours.TickerBehaviour;
public class ticker extends TickerBehaviour {
int waktu;
public ticker(Agent a, long period, int waktu) {
super(a, period);
this.waktu = waktu;
}
protected void onTick() {
if (waktu == 0) {
System.out.println("Time is up");
myAgent.doDelete(); // memberhentikan
} else {
System.out.println(waktu);
waktu--;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment