zabstractevent.java

来自「ZDrive Driving Warning System」· Java 代码 · 共 51 行

JAVA
51
字号
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package zdrive.protocols;import java.util.ArrayDeque;import java.util.Deque;import zdrive.engines.ZUpdaterThreadsInterface;/** * * @author Mohamed Aly */public abstract class ZAbstractEvent extends Thread implements ZEventInterface{    protected double velocity_kph;    protected double total_distance_m;    protected double remaining_distance_m;    protected int event;    protected String direction;    protected boolean completed;    protected Deque <ZUpdaterThreadsInterface> tobenotified;    public abstract double getVelocity();    public abstract double getRemainingDistance();    public abstract double getTotalDistance();    public abstract int getEvent();    public abstract String getDirection();    public abstract boolean isCompleted();    @Override    public abstract void run();    public void addThreadToBeNotifiedOnCompletion(ZUpdaterThreadsInterface x){        if(tobenotified == null) tobenotified = new ArrayDeque<ZUpdaterThreadsInterface>();        tobenotified.add(x);    }    protected void notifyAllThreads(){        while(tobenotified.size() > 0){            tobenotified.pollFirst().wakeMeUp();        }    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?