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

📄 fileadvertisement.java

📁 CoolFace是基于jxta的P2P系统
💻 JAVA
字号:
package com.cn.darkblue.adv;

import java.net.URI;

import net.jxta.document.Element;
import net.jxta.document.ExtendableAdvertisement;
import net.jxta.id.ID;
import net.jxta.id.IDFactory;
import net.jxta.protocol.PipeAdvertisement;

public class FileAdvertisement extends ExtendableAdvertisement implements Cloneable{

	String fId ;
	
	String fName;
	String cDate;
	String lmDate;
	String fType;
	
	ID id = null;
	
	private Element description = null;

	public static String getAdvertisementType() {
        return "CF:FILE";
    }
	
	@Override
	public String getBaseAdvType() {
		return getAdvertisementType();
	}
	
	public FileAdvertisement clone() {
        try {
        	FileAdvertisement likeMe = (FileAdvertisement) super.clone();

            likeMe.setCDate(getCDate());
            likeMe.setDesc(getDesc());
            likeMe.setFId(getFId());
            likeMe.setFType(getFType());
            likeMe.setLmDate(getLmDate());
            likeMe.setFName(getFName());

            return likeMe;
        } catch (CloneNotSupportedException impossible) {
            throw new Error("Object.clone() threw CloneNotSupportedException", impossible);
        }
    }
	
	public boolean equals(Object obj) {

        if (this == obj) {
            return true;
        }

        if (obj instanceof FileAdvertisement) {
        	FileAdvertisement likeMe = (FileAdvertisement) obj;

            if (!getFId().equals(likeMe.getFId())) {
                return false;
            }

            if (!getFType().equals(likeMe.getFType())) {
                return false;
            }

            String fName = getFName();

            if (fName == null ? likeMe.getFName() != null : !fName.equals(likeMe.getFName())) {
                return false;
            }

            String fDescription = getDescription();

            return !(fDescription == null ? likeMe.getDescription() != null : fDescription.equals(likeMe.getDescription()));
        }
        return false;
    }
	
	public String getDescription() {
        if (null != description) {
            return (String) description.getValue();
        }
        return null;
    }

	@Override
	public ID getID() {
		if(id == null){
			try{
				id = ID.create(new URI(getFId()));
			}catch(Exception e){
				e.printStackTrace();
			}
		}
		return id;
	}

	@Override
	public String[] getIndexFields() {
		return new String[]{fId,fName,cDate};
	}

	public String getCDate() {
		return cDate;
	}

	public void setCDate(String date) {
		cDate = date;
	}

	public Element getDesc() {
		return description;
	}

	public void setDesc(Element description) {
		this.description = description;
	}

	public String getFId() {
		return fId;
	}

	public void setFId(String id) {
		fId = id;
	}

	public String getFType() {
		return fType;
	}

	public void setFType(String type) {
		fType = type;
	}

	public String getLmDate() {
		return lmDate;
	}

	public void setLmDate(String lmDate) {
		this.lmDate = lmDate;
	}

	public String getFName() {
		return fName;
	}

	public void setFName(String name) {
		fName = name;
	}
	
}

⌨️ 快捷键说明

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