131 lines
3.0 KiB
Java
131 lines
3.0 KiB
Java
package a6;
|
|
|
|
public class Timer {
|
|
|
|
public class TimerList
|
|
{
|
|
private ListHead entry = new ListHead();
|
|
private ListHead attachEntry;
|
|
private int timerType = 0;
|
|
private int milli_seconds = 0;
|
|
private long expires = 0;
|
|
|
|
private ITimerFunc timerFunc;
|
|
private ITimerAfterFunc timerAfterFunc;
|
|
private XParams param;
|
|
}
|
|
|
|
@FunctionalInterface
|
|
public interface ITimerFunc
|
|
{
|
|
public void OnTimer(XParams param);
|
|
}
|
|
|
|
@FunctionalInterface
|
|
public interface ITimerAfterFunc
|
|
{
|
|
public void OnTimerAfter(XParams param);
|
|
}
|
|
|
|
private int freeTimerNum = 0;
|
|
private ListHead freeTimer = new ListHead();
|
|
|
|
public void init() {
|
|
|
|
}
|
|
|
|
public void unInit() {
|
|
|
|
}
|
|
|
|
public void update() {
|
|
|
|
}
|
|
|
|
public TimerList addDeadLineTimer(int expire_time, XParams param, ITimerFunc timer_func) {
|
|
return null;
|
|
}
|
|
|
|
public TimerList addDeadLineTimer(int expire_time, XParams param, ITimerFunc timer_func,
|
|
ITimerAfterFunc after_func) {
|
|
return null;
|
|
}
|
|
|
|
public TimerList addDeadLineTimerAndAttach(int expire_time, XParams param, ITimerFunc timer_func,
|
|
TimerAttacher timer_attacher) {
|
|
return null;
|
|
}
|
|
|
|
public TimerList addDeadLineTimerAndAttach(int expire_time, XParams param, ITimerFunc timer_func,
|
|
TimerAttacher timer_attacher, ITimerAfterFunc after_func) {
|
|
return null;
|
|
}
|
|
|
|
public TimerList addRepeatTimer(int expire_time, XParams param, ITimerFunc timer_func) {
|
|
return null;
|
|
}
|
|
|
|
public TimerList addFixedTimer(int expire_time, XParams param, ITimerFunc timer_func) {
|
|
return null;
|
|
}
|
|
|
|
public void modifyTimer(TimerList timer_list, int expire_time) {
|
|
|
|
}
|
|
|
|
public TimerList getTimerByAttach(ListHead attach_entry) {
|
|
return null;
|
|
}
|
|
|
|
public XParams getMutableParams(TimerList timer_list) {
|
|
return null;
|
|
}
|
|
|
|
public long getRemainTime(TimerList timer_list) {
|
|
return 0;
|
|
}
|
|
|
|
public TimerList getRunningTimer() {
|
|
return null;
|
|
}
|
|
|
|
public int getIdleableMillSeconds() {
|
|
return 0;
|
|
}
|
|
|
|
public void deleteTimer(TimerList timer_list) {
|
|
if (timer_list.timerAfterFunc != null) {
|
|
timer_list.timerAfterFunc.OnTimerAfter(timer_list.param);
|
|
}
|
|
detachTimer(timer_list);
|
|
if (timer_list.attachEntry != null && !timer_list.attachEntry.empty()) {
|
|
timer_list.attachEntry.del();
|
|
}
|
|
addToFreeList(timer_list);
|
|
}
|
|
|
|
public void detachTimer(TimerList timer_list) {
|
|
if (timer_list.entry != null && !timer_list.entry.empty()) {
|
|
timer_list.entry.delInit();
|
|
}
|
|
}
|
|
|
|
private TimerList newTimerList() {
|
|
return null;
|
|
}
|
|
|
|
private void clear() {
|
|
|
|
}
|
|
|
|
private void addToFreeList(TimerList timer_list) {
|
|
freeTimer.addTail(timer_list.entry);
|
|
++freeTimerNum;
|
|
}
|
|
|
|
private void gcTimerFunc() {
|
|
|
|
}
|
|
|
|
}
|