package domain;
import java.io.Serializable;
public class ProduitCommandeClient implements Serializable, Comparable {
private static final long serialVersionUID = 1L;
public Integer id;
public Produit produit;
public CommandeClient commandeClient;
public int quantite_commandee;
public float prix_vente;
public float calcul;
public ProduitCommandeClient() {
}
public ProduitCommandeClient(Produit produit2) {
this.setProduit(produit2);
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Produit getProduit() {
return produit;
}
public void setProduit(Produit produit) {
this.produit = produit;
}
public CommandeClient getCommandeClient() {
return commandeClient;
}
public void setCommandeClient(CommandeClient commandeClient) {
this.commandeClient = commandeClient;
}
public int getQuantite_commandee() {
return quantite_commandee;
}
public void setQuantite_commandee(int quantiteCommandee) {
quantite_commandee = quantiteCommandee;
}
public float getPrix_vente() {
return prix_vente;
}
public void setPrix_vente(float prix_vente) {
this.prix_vente = prix_vente;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + Float.floatToIntBits(calcul);
result = prime * result
+ ((commandeClient == null) ? 0 : commandeClient.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + Float.floatToIntBits(prix_vente);
result = prime * result + ((produit == null) ? 0 : produit.hashCode());
result = prime * result + quantite_commandee;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ProduitCommandeClient other = (ProduitCommandeClient) obj;
if (Float.floatToIntBits(calcul) != Float.floatToIntBits(other.calcul))
return false;
if (commandeClient == null) {
if (other.commandeClient != null)
return false;
} else if (!commandeClient.equals(other.commandeClient))
return false;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (Float.floatToIntBits(prix_vente) != Float
.floatToIntBits(other.prix_vente))
return false;
if (produit == null) {
if (other.produit != null)
return false;
} else if (!produit.equals(other.produit))
return false;
if (quantite_commandee != other.quantite_commandee)
return false;
return true;
}
@Override
public int compareTo(Object o) {
return produit.getId();
}
public float getCalcul() {
return calcul=(getPrix_vente()*getQuantite_commandee());
}
public void setCalcul(float calcul){
calcul=(getPrix_vente())*(getQuantite_commandee());
}
}
Partager