Skip to content
Snippets Groups Projects
Commit 7552978d authored by EL HADI Mohamed's avatar EL HADI Mohamed
Browse files

tache 7

parent 2415a7fd
No related branches found
No related tags found
No related merge requests found
No preview for this file type
File added
......@@ -4,6 +4,7 @@ import fr.univamu.l2mi.ticker.AlarmClock;
import fr.univamu.l2mi.ticker.ClockPrinter;
import fr.univamu.l2mi.ticker.CockTick;
import fr.univamu.l2mi.ticker.OnceCockAlarm;
import fr.univamu.l2mi.ticker.StopCock;
import fr.univamu.l2mi.ticker.Ticker;
public class Main {
......@@ -12,6 +13,8 @@ public class Main {
// t.add(new AlarmClock("00:00:03"));
// t.add(new OnceCockAlarm("00:00:03","12/8/2023"));
t.add(new StopCock("00:00:03", t, 30));
t.startTicking();
}
}
\ No newline at end of file
package fr.univamu.l2mi.ticker;
import java.lang.reflect.Method;
import java.time.Duration;
public class StopCock extends AlarmClock{
Ticker ticker;
int stop_time;
public StopCock(String time,Ticker ticker,int stop_time){
super(time);
this.ticker = ticker;
this.stop_time = stop_time;
}
@Override
public void notifyTick() {
super.notifyTick();
if (givenTime.isAfter(AlarmTime) && Duration.between(givenTime, AlarmTime).getSeconds()>this.stop_time){
this.ticker.stopTicking();;
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment