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

📄 trade.java

📁 基于J2EE技术的 电子购物商城系统
💻 JAVA
字号:

package domain;

public class Trade {

	public static void main(String[] args) {
	}
	
	public Trade() {
		//do nothing.
	}
	
	public Trade(String id) {
		this.id = id;
	}
	
	public Trade(String id, String listId, User buyer, User saler, Goods goods, int goodCount) {
		this.id = id;
		this.listId = listId;
		this.buyer = buyer;
		this.saler = saler;
		this.goods = goods;
		this.goodCount = goodCount;
		this.isPayed = false;
		this.isSuccessful = false;
	}
	
	public Trade(String id, String listId, User buyer, User saler, Goods goods, int goodCount, boolean isPayed) {
		this(id, listId, buyer, saler, goods, goodCount);
		this.isPayed = isPayed;
	}
	
	/**
	 * @return Returns the buyer.
	 */
	public User getBuyer() {
		return buyer;
	}
	/**
	 * @param buyer The buyer to set.
	 */
	public void setBuyer(User buyer) {
		this.buyer = buyer;
	}
	/**
	 * @return Returns the good.
	 */
	public Goods getGood() {
		return goods;
	}
	/**
	 * @param goods The good to set.
	 */
	public void setGood(Goods goods) {
		this.goods = goods;
	}
	/**
	 * @return Returns the goodCount.
	 */
	public int getGoodCount() {
		return goodCount;
	}
	/**
	 * @param goodCount The goodCount to set.
	 */
	public void setGoodCount(int goodCount) {
		this.goodCount = goodCount;
	}

	/**
	 * @return Returns the isPayed.
	 */
	public boolean isPayed() {
		return isPayed;
	}
	/**
	 * @param isPayed The isPayed to set.
	 */
	public void setPayed(boolean isPayed) {
		this.isPayed = isPayed;
	}
	
	public void setPayed() {
		setPayed(true);
	}
	
	/**
	 * @return Returns the isSuccessful.
	 */
	public boolean isSuccessful() {
		return isSuccessful;
	}
	/**
	 * @param isSuccessful The isSuccessful to set.
	 */
	public void setSuccessful(boolean isSuccessful) {
		this.isSuccessful = isSuccessful;
	}
	
	public void setSuccessful() {
		setSuccessful(true);
	}
	
	/**
	 * @return Returns the saler.
	 */
	public User getSaler() {
		return saler;
	}
	/**
	 * @param saler The saler to set.
	 */
	public void setSaler(User saler) {
		this.saler = saler;
	}

	/**
	 * @return Returns the id.
	 */
	public String getId() {
		return id;
	}
	/**
	 * @param id The id to set.
	 */
	public void setId(String id) {
		this.id = id;
	}
	/**
	 * @return Returns the listId.
	 */
	public String getListId() {
		return listId;
	}
	/**
	 * @param listId The listId to set.
	 */
	public void setListId(String listId) {
		this.listId = listId;
	}
	
	public boolean validate() {
		if (isSuccessful == true && isPayed == false)
			return false;
		else if (goodCount <= 0)
			return false;
		else
			return true;
	}
	
	public boolean equals(Trade trade) {
		if (trade == null)
			return (this == null);
		else
			return (this.id == trade.id);
	}
	
	public boolean equals(Object o) {
		if (o instanceof Trade)
			return equals((Trade)o);
		else
			return false;
	}
	
	String id = null;
	String listId = null;
	User buyer = null;
	User saler = null;
	Goods goods = null;
	int goodCount = 0;
	boolean isPayed = false;
	boolean isSuccessful = false;
}

⌨️ 快捷键说明

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