Compare commits
No commits in common. "51bb96a809caf03ae82d15b85d9bace168449869" and "558c7f786cffae3ce1a20db421be833de805a125" have entirely different histories.
51bb96a809
...
558c7f786c
@ -1,97 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
*/
|
*/
|
||||||
|
package métiers;
|
||||||
package métiers;
|
|
||||||
|
/**
|
||||||
import java.util.Objects;
|
*
|
||||||
import java.util.HashMap;
|
* @author famille Thevenot
|
||||||
/**
|
*/
|
||||||
*
|
public class Commande {
|
||||||
* @author ilona
|
|
||||||
*/
|
}
|
||||||
public class Commande {
|
|
||||||
|
|
||||||
private int noCom, noVendeur;
|
|
||||||
private String dateCom;
|
|
||||||
private HashMap <Instrument, int> lesLignes = new HashMap();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Commande(int noCom, int noVendeur, String dateCom) {
|
|
||||||
this.noCom = noCom;
|
|
||||||
this.noVendeur = noVendeur;
|
|
||||||
this.dateCom = dateCom;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ajoute une quantité donnée d'un instrument à la commande
|
|
||||||
* @param unInstrument instrument à ajouter
|
|
||||||
* @param qte quantité à ajouter
|
|
||||||
* @return true si l'ajout est bon
|
|
||||||
*/
|
|
||||||
public boolean ajouter(Instrument unInstrument, int qte){
|
|
||||||
boolean ajoutOK = lesLignes.put(unInstrument,qte);
|
|
||||||
return ajoutOK;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Supprimer un instrument de la commande
|
|
||||||
* @param unInstrument instrument à supprimer
|
|
||||||
* @return true si la suppression est effectuée
|
|
||||||
*/
|
|
||||||
public boolean supprimer(Instrument unInstrument){
|
|
||||||
boolean suppOK = lesLignes.remove(unInstrument);
|
|
||||||
return suppOK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
public int getNoCom() {
|
|
||||||
return noCom;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getNoVendeur() {
|
|
||||||
return noVendeur;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDateCom() {
|
|
||||||
return dateCom;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNoCom(int noCom) {
|
|
||||||
this.noCom = noCom;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNoVendeur(int noVendeur) {
|
|
||||||
this.noVendeur = noVendeur;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDateCom(String dateCom) {
|
|
||||||
this.dateCom = dateCom;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (this == obj) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final Commande other = (Commande) obj;
|
|
||||||
if (this.noCom != other.noCom) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (this.noVendeur != other.noVendeur) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return Objects.equals(this.dateCom, other.dateCom);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user