|
|
|
@ -13,19 +13,20 @@ namespace BowlingLib.Model
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class Equipe
|
|
|
|
|
{
|
|
|
|
|
private string nom;
|
|
|
|
|
private readonly long id;
|
|
|
|
|
public string Nom { get; private set; };
|
|
|
|
|
public long Id { get; private set; };
|
|
|
|
|
|
|
|
|
|
public ReadOnlyCollection<Joueur> Joueurs { get; private set; }
|
|
|
|
|
|
|
|
|
|
public List<Joueur> Joueurs = new List<Joueur>();
|
|
|
|
|
private List<Joueur> joueurs = new List<Joueur>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public string Nom
|
|
|
|
|
/* public string Nom
|
|
|
|
|
{
|
|
|
|
|
get { return nom; }
|
|
|
|
|
set { nom = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -44,16 +45,21 @@ namespace BowlingLib.Model
|
|
|
|
|
|
|
|
|
|
public Equipe(string nom)
|
|
|
|
|
{
|
|
|
|
|
this.nom = nom;
|
|
|
|
|
Nom = nom;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Equipe(long id, string nom, List<Joueur> joueurs)
|
|
|
|
|
public Equipe(long id, string nom, params Joueur[] joueurs)
|
|
|
|
|
{
|
|
|
|
|
this.id = id;
|
|
|
|
|
Joueurs = joueurs;
|
|
|
|
|
Id = id;
|
|
|
|
|
// Joueurs = joueurs;
|
|
|
|
|
Nom = nom;
|
|
|
|
|
Joueurs = new ReadOnlyCollection<Joueur>(this.joueurs);
|
|
|
|
|
AjouterJoueurs(artists);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Equipe(long id, string nom, params Joueur[] joueurs)
|
|
|
|
|
: this(0, nom, joueurs) {}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Ajoute une liste de joueur à l'équipe
|
|
|
|
|
/// </summary>
|
|
|
|
@ -84,7 +90,7 @@ namespace BowlingLib.Model
|
|
|
|
|
{
|
|
|
|
|
if (!isExist(joueur))
|
|
|
|
|
{
|
|
|
|
|
Joueurs.Add(joueur);
|
|
|
|
|
joueurs.Add(joueur);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -100,17 +106,17 @@ namespace BowlingLib.Model
|
|
|
|
|
|
|
|
|
|
public void SupprimerJoueur(Joueur joueur)
|
|
|
|
|
{
|
|
|
|
|
Joueurs.Remove(joueur);
|
|
|
|
|
joueurs.Remove(joueur);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// retourner la liste non modifiable des joueurs de l'équipe
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public List<Joueur> GetJoueurs()
|
|
|
|
|
/* public List<Joueur> GetJoueurs()
|
|
|
|
|
{
|
|
|
|
|
return Joueurs;
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -120,7 +126,7 @@ namespace BowlingLib.Model
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public bool isExist(Joueur nouvJoueur)
|
|
|
|
|
{
|
|
|
|
|
if (Joueurs.Contains(nouvJoueur))
|
|
|
|
|
if (joueurs.Contains(nouvJoueur))
|
|
|
|
|
return true;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|