pingevent.java

来自「Java p2p程序设计2002年版」· Java 代码 · 共 64 行

JAVA
64
字号
package net.jxta.impl.shell.bin.ping;import java.util.*;/** * Provided to PingReplyListeners when a ping reply is received by * a PingReplyHandler. This represents the initial ping leg and not * the reply. * * This event object holds two timestamps. One representing the sending * time and one representing the receving time. Plus the differential * time. * */public class PingEvent extends java.util.EventObject {        //timestamp of ping arrival    long timestamp = 0;        // name of peer who sent this message    String name = "";        // timestamp when ping left    long ostamp = 0;        /** Creates new PingEvent */    public PingEvent(Object source, String name, long ot, long t) {        super(source);        this.name = name;        this.ostamp = ot;        this.timestamp = t;    }        /**     * @return This method returns the timestamp of the origin of the ping     * message, which is to say, the ping sender.     */    public long getOriginTimestamp() {        return ostamp;    }        /**     * @return Returns the timestamp when the ping message was received.     */    public long getTimestamp() {        return timestamp;    }    /**     * @return The name of the peer who sent the ping message     */    public String getPeerName() {        return name;    }        /**     * @return Returns the time differential between the sender     * and receiver of this leg of a ping.     */    public long getDifferential() {        return timestamp-ostamp;    }}

⌨️ 快捷键说明

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