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;

public class School {

	private IntegerProperty id;				//编号
	private StringProperty titleName;			//学校
	
	public School() {
		this.id = new SimpleIntegerProperty();
		this.titleName = new SimpleStringProperty();
	}

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

	public String getTitleName() {
		return titleName.get();
	}

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

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