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 QuestionTypeSelect {

	private IntegerProperty id;
	private StringProperty name;
	
	public QuestionTypeSelect() {
		this.id = new SimpleIntegerProperty();
		this.name = new SimpleStringProperty();
	}
	
	public QuestionTypeSelect(Integer id, String name) {
		this.id = new SimpleIntegerProperty(id);
		this.name = new SimpleStringProperty(name);
	}

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

	public String getName() {
		return name.get();
	}

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

	public void setName(String name) {
		this.name.set(name);
	}
	
	public String toString() {
		return id.get() + " | " + name.get();
	}
	
	public int hashCode() {
	     return new HashCodeBuilder(17, 37).
	       append(this.id.get()).
	       append(this.name.get()).
	       toHashCode();
	}
	
	public boolean equals(Object obj) {
		   if (obj == null) { return false; }
		   if (obj == this) { return true; }
		   if (obj.getClass() != getClass()) {
		     return false;
		   }
		   QuestionTypeSelect oth = (QuestionTypeSelect) obj;
		   return new EqualsBuilder()
		                 .append(this.id.get(), oth.id.get())
		                 .append(this.name.get(), oth.name.get())
		                 .isEquals();
	}
}
