package cn.hmsoft.ltc.model;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;

/**
 * 课程题型映射实体.
 * @author zq
 *
 */
public class CourseQuestion {

	private IntegerProperty id;				//编号
	private IntegerProperty courseId;		//课程ID
	private IntegerProperty quesTypeId;
	private IntegerProperty score;
	private IntegerProperty quesNums;
	private IntegerProperty ord;//排序号
	
	protected StringProperty quesTypeCode;//题型编码
	protected StringProperty quesTypeName;//题型名称
	protected StringProperty quideText;//题型指导语
	
	public CourseQuestion() {
		this.id = new SimpleIntegerProperty();
		this.courseId = new SimpleIntegerProperty();
		this.quesTypeId = new SimpleIntegerProperty();
		this.score = new SimpleIntegerProperty();
		this.quesNums = new SimpleIntegerProperty();
		this.quesTypeCode = new SimpleStringProperty();
		this.quesTypeName = new SimpleStringProperty();
		this.ord = new SimpleIntegerProperty();
		this.quideText = new SimpleStringProperty();
	}

	public Integer getId() {
		return id.get();
	}

	public Integer getCourseId() {
		return courseId.get();
	}

	public Integer getQuesTypeId() {
		return quesTypeId.get();
	}

	public Integer getScore() {
		return score.get();
	}

	public Integer getQuesNums() {
		return quesNums.get();
	}

	public void setId(Integer id) {
		this.id.set(id);
	}

	public void setCourseId(Integer courseId) {
		this.courseId.set(courseId);
	}

	public void setQuesTypeId(Integer quesTypeId) {
		this.quesTypeId.set(quesTypeId);
	}

	public void setScore(Integer score) {
		this.score.set(score);
	}

	public void setQuesNums(Integer quesNums) {
		this.quesNums.set(quesNums);
	}
	
	public int hashCode() {
	     return new HashCodeBuilder(17, 37).
	       append(this.id.get()).
	       append(this.courseId.get()).
	       append(this.quesTypeId.get()).
	       append(this.score.get()).
	       append(this.quesNums.get()).
	       toHashCode();
	}
	
	public boolean equals(Object obj) {
		   if (obj == null) { return false; }
		   if (obj == this) { return true; }
		   if (obj.getClass() != getClass()) {
		     return false;
		   }
		   CourseQuestion oth = (CourseQuestion) obj;
		   return new EqualsBuilder()
		                 .append(this.id.get(), oth.id.get())
		                 .append(this.courseId.get(), oth.courseId.get())
		                 .append(this.quesTypeId.get(), oth.quesTypeId.get())
		                 .append(this.score.get(), oth.score.get())
		                 .append(this.quesNums.get(), oth.quesNums.get())
		                 .isEquals();
	}

	public String getQuesTypeName() {
		return quesTypeName.get();
	}

	public void setQuesTypeName(String quesTypeName) {
		this.quesTypeName.set(quesTypeName);
	}

	public String getQuesTypeCode() {
		return quesTypeCode.get();
	}

	public void setQuesTypeCode(String quesTypeCode) {
		this.quesTypeCode.set(quesTypeCode);
	}

	public Integer getOrd() {
		return ord.get();
	}

	public void setOrd(Integer ord) {
		this.ord.set(ord);
	}

	public void setScore(IntegerProperty score) {
		this.score = score;
	}

	public String getQuideText() {
		return quideText.get();
	}

	public void setQuideText(String quideText) {
		this.quideText.set(quideText);
	}
}
