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

📄 questionvo.java

📁 基于STRUTS的网络调查应用
💻 JAVA
字号:
/*
 * Created on 16-ene-2005 18:31:02
 *
 */
package com.martincuervo.javatest.business.vo;

import java.util.List;

/**
 * @author Jorge Martin Cuervo <jorge@martincuervo.com>
 *
 */
public class QuestionVO implements IJavaTestVO {

	private int id;
	private String text;
	private String explanation;
	private List answers;

	private CategoryVO category;
		
	public QuestionVO(int id, String text, String explanation, List answers, CategoryVO category) {
		super();
		this.id = id;
		this.text = text;
		this.explanation = explanation;
		this.answers = answers;
		this.category = category;
	}
	
	public QuestionVO(int id) {
		super();
		this.id = id;
	}
	
	
	public List getAnswers() {
		return answers;
	}
	public void setAnswers(List answers) {
		this.answers = answers;
	}
	public String getExplanation() {
		return explanation;
	}
	public void setExplanation(String explanation) {
		this.explanation = explanation;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getText() {
		return text;
	}
	public void setText(String text) {
		this.text = text;
	}
	
	public CategoryVO getCategory() {
		return category;
	}
	public void setCategory(CategoryVO category) {
		this.category = category;
	}
	public boolean equals(Object obj) {
		boolean valRet = false;
		
		if (obj != null && obj instanceof QuestionVO) {
			QuestionVO question = (QuestionVO)obj;
			
			valRet = (question.getId() == id 
					&& question.getText().equals(text)
					&& question.getExplanation().equals(explanation)
					&& (
						(question.getAnswers() != null && answers != null 
							&& question.getAnswers().equals(answers) ) 
						|| (question.getAnswers() == null && answers == null) 
						)
					&& (
						(question.getCategory() != null && category != null 
							&& question.getCategory().getId() == category.getId() ) 
						|| (question.getCategory() == null && category == null) 
						)
				);
		}
		
		return valRet;
	}
	public String toString() {
		return "[" + this.getClass().getName() + ": " +
			"id=" 			+ id 			+ ", " +
			"text=" 		+ text 			+ ", " +
			"explanation=" 	+ explanation 	+ ", " +
			"answers=" 		+ answers 		+ ", " +
			"category=" 	+ category 		+ 
		"]";
	}
}

⌨️ 快捷键说明

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