Created
November 9, 2016 18:03
-
-
Save naufaldi/d5e430ca51ce7a2a4423c48e934c75ae to your computer and use it in GitHub Desktop.
Ticker For Tutorial Blog JADE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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