package database.dataset;

import java.io.Serializable;

/**
 * @author alexis
 * dataset de la table ville
 */
public class Ville implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 198992883158049395L;
	private int ville_p_id;
	private String ville_nom;
	private String ville_province;
	private String ville_pays;
	private String NOM_TABLE = "ville";

	/**************************************************************************
	 * constructeur
	 *************************************************************************/
	
	public Ville(int ville_p_id, String ville_nom, String ville_province,
				 String ville_pays) {
		this.ville_p_id = ville_p_id;
		this.ville_nom = ville_nom;
		this.ville_province = ville_province;
		this.ville_pays = ville_pays;
	}

	/**************************************************************************
	 * getter
	 *************************************************************************/
	
	/**
	 * @return the ville_p_id
	 */
	public int getville_p_id() {
		return ville_p_id;
	}

	/**
	 * @return the ville_nom
	 */
	public String getVille_nom() {
		return ville_nom;
	}

	/**
	 * @return the ville_province
	 */
	public String getVille_province() {
		return ville_province;
	}

	/**
	 * @return the ville_pays
	 */
	public String getVille_pays() {
		return ville_pays;
	}
	
	/**
	 * Retourne le nom de la table
	 * @return NOM_TABLE
	 */
	public String getNomTable()
	{
		return NOM_TABLE;		
	}

	/**************************************************************************
	 * setter
	 *************************************************************************/
	
	/**
	 * @param ville_p_id the ville_p_id to set
	 */
	public void setville_p_id(int ville_p_id) {
		this.ville_p_id = ville_p_id;
	}

	/**
	 * @param ville_nom the ville_nom to set
	 */
	public void setVille_nom(String ville_nom) {
		this.ville_nom = ville_nom;
	}

	/**
	 * @param ville_province the ville_province to set
	 */
	public void setVille_province(String ville_province) {
		this.ville_province = ville_province;
	}

	/**
	 * @param ville_pays the ville_pays to set
	 */
	public void setVille_pays(String ville_pays) {
		this.ville_pays = ville_pays;
	}

	/**************************************************************************
	 * object
	 *************************************************************************/
	
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "ville [ville_p_id=" + ville_p_id + ", ville_nom=" + ville_nom
				+ ", ville_province=" + ville_province + ", ville_pays="
				+ ville_pays + "]";
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((ville_nom == null) ? 0 : ville_nom.hashCode());
		result = prime * result + ville_p_id;
		result = prime * result
				+ ((ville_pays == null) ? 0 : ville_pays.hashCode());
		result = prime * result
				+ ((ville_province == null) ? 0 : ville_province.hashCode());
		return result;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof Ville))
			return false;
		Ville other = (Ville) obj;
		if (ville_nom == null) {
			if (other.ville_nom != null)
				return false;
		} else if (!ville_nom.equals(other.ville_nom))
			return false;
		if (ville_p_id != other.ville_p_id)
			return false;
		if (ville_pays == null) {
			if (other.ville_pays != null)
				return false;
		} else if (!ville_pays.equals(other.ville_pays))
			return false;
		if (ville_province == null) {
			if (other.ville_province != null)
				return false;
		} else if (!ville_province.equals(other.ville_province))
			return false;
		return true;
	}
}