⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 member.java

📁 基于jxta的局域网P2P文件共享,可以实现局域网中的文件p2p共享,实现文件快速传输及交流
💻 JAVA
字号:
package connex.core.Presence;

import javax.swing.*;
import net.jxta.protocol.PeerAdvertisement;
import java.util.Hashtable;


public class Member {
    private String name = "unknown";
    private String id;

    /**
     * @directed
     * @link aggregationByValue 
     */
    private ProfileAdv profil = null;
    private boolean picUpdate = false;

    private PeerAdvertisement peerAdv = null;
    private String status= PresenceProtocol.OFFLINE;
    private String img = "default.jpg";
    private String presenceBackDoorID;
    private Hashtable services= new Hashtable();
    private long lastUpdate;
    private long timeOut = 6 * 60000;

    public Member() {

    }

    public Member(String id, ProfileAdv profil, String presenceBackDoorID) {
        this.id = id;
        this.profil = profil;

        this.presenceBackDoorID = presenceBackDoorID;

        lastUpdate = System.currentTimeMillis();
    }


    public Member(String presenceBackDoorID) {
        this.presenceBackDoorID = presenceBackDoorID;

        lastUpdate = System.currentTimeMillis();
    }

    protected void setName(String name) {
        this.name = name;
    }

    protected String getName() {
        if (profil != null) {
            name = profil.getName();
        }
        return name;
    }

    protected void setID(String id) {
        this.id = id;
    }

    protected String getID() {
        return this.id;
    }

    protected void setProfilAdv(ProfileAdv profil) {
        this.profil = profil;
        lastUpdate = System.currentTimeMillis();

    }

    protected ProfileAdv getProfileAdv() {
        return this.profil;
    }

    protected void setPeerAdv(PeerAdvertisement peerAdv) {

        this.peerAdv = peerAdv;
        lastUpdate = System.currentTimeMillis();
    }

    protected PeerAdvertisement getPeerAdv() {
        return this.peerAdv;
    }

    protected void setPresenceBackDoorID(String backID) {
        this.presenceBackDoorID = backID;
        lastUpdate = System.currentTimeMillis();
    }

    protected String getPresenceBackDoorID() {
        return this.presenceBackDoorID;

    }

    protected void setStatus(String s) {
        this.status = s;
        lastUpdate = System.currentTimeMillis();
    }

    protected String getStatus() {
        return status;
    }

    protected void setService(String serviceID, String pipeID) {
        services.put(serviceID, pipeID);
    }
    protected String getServicePipe(String serviceID){
        if(!services.containsKey(serviceID)){
            return null;
        }
          return  services.get(serviceID).toString();
    }
    protected void setPicture(String img) {
        this.img = img;
        picUpdate = false;
        lastUpdate = System.currentTimeMillis();
    }

    public String getPicture() {
        return this.img;
    }

    protected void pictureUpdated() {
        picUpdate = true;
        lastUpdate = System.currentTimeMillis();
    }

    protected boolean isPictureUpdated() {
        return picUpdate;
    }


    protected void setLastUpdate() {
        lastUpdate = System.currentTimeMillis();
    }

    protected long getLastUpdate() {
        return lastUpdate;
    }


    protected boolean isOutOfTime() {
        return (System.currentTimeMillis() - lastUpdate) >= timeOut;
    }


}

⌨️ 快捷键说明

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