package lu.tudor.santec.gecamed.billing.utils;



public class ReportSorterBean {

	private Integer  m_PatientId;
	private Integer  m_PhysicianId;
	private TimeSpan m_ValiditySpan;
	
	
	
	public ReportSorterBean (Integer p_PatientId, Integer p_PhysicianId, TimeSpan p_ValiditySpan)
		{
		this.m_PatientId 	= p_PatientId;
		this.m_PhysicianId 	= p_PhysicianId;
		this.m_ValiditySpan	= p_ValiditySpan;
		}
	
//	public ReportSorterBean (Patient p_Patient, Physician p_Physician)
//		{
//		this.m_PatientId 	= p_Patient.getId();
//		this.m_PhysicianId 	= p_Physician.getId();
////		this.m_ValiditySpan = p_ValiditySpan;
//		}
	
	
	public Integer getPatientId() 
		{
		return m_PatientId;
		}
	
	public void setPatientId(Integer p_PatientId) 
		{
		this.m_PatientId = p_PatientId;
		}
	
	public Integer getPhysicianId() 
		{
		return m_PhysicianId;
		}
	
	public void setPhysicianId(Integer p_PhysicianId) 
		{
		this.m_PhysicianId = p_PhysicianId;
		}

	public TimeSpan getValiditySpan() 
		{
		return m_ValiditySpan;
		}
	
	public void setValiditySpan(TimeSpan p_ValiditySpan) 
		{
		this.m_ValiditySpan = p_ValiditySpan;
		}
	
	
	@Override
	public int hashCode() {
		final int l_Prime	= 31;
		int l_Result 		= 1;
		int l_StartDate		= 0;
		int l_EndDate		= 0;
		if (m_ValiditySpan != null)
			{
			if (m_ValiditySpan.getStartDate() != null)
				l_StartDate = m_ValiditySpan.getStartDate().hashCode();
			if (m_ValiditySpan.getEndDate() != null)
				l_EndDate = m_ValiditySpan.getEndDate().hashCode();
			}
		
		l_Result = l_Prime * l_Result
				+ ((m_PatientId == null) ? 0 : m_PatientId.hashCode());
		l_Result = l_Prime * l_Result
				+ ((m_PhysicianId == null) ? 0 : m_PhysicianId.hashCode());
		l_Result = l_Prime * l_Result + l_StartDate;
		l_Result = l_Prime * l_Result + l_EndDate;
		return l_Result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ReportSorterBean other = (ReportSorterBean) obj;
		if (m_PatientId == null) {
			if (other.m_PatientId != null)
				return false;
		} else if (!m_PatientId.equals(other.m_PatientId))
			return false;
		if (m_PhysicianId == null) {
			if (other.m_PhysicianId != null)
				return false;
		} else if (!m_PhysicianId.equals(other.m_PhysicianId))
			return false;
		return true;
	}
}
