Bibliobrol : le modèle
Dans notre analyse sommaire de l'application, différentes notions nous sont apparues indispensables, et nous avons pu dégager les différents intervenants.
Ces différentes notions constituent le modèle, ou le cœur de notre application. Nous nous pencherons par la suite sur la manière d'interagir avec l'utilisateur (la vue) ou sur le moyen de stocker les données que nous manipulons (la persistance).
Nous allons à présent revoir les objets qui constitueront notre modèle. Dans les exemples qui suivent, le code utilisé est C#, mais les principes sont identiques dans bien des langages.
Brol
L'objet Brol définit un ouvrage.
Code c# (Brol.cs) (324 lignes)
using System; using System.Collections.Generic; using System.Text; namespace be.gaudry.bibliobrol.model { /// <summary> /// General item. It contains only informations about a general item, /// but not about a specific occurence item. /// I.E. we may have informations about a film, but not about the occurence /// of that film stored into the biblio. /// </summary> [Serializable] public class Brol : IBrol { #region constructors and declarations private int id, cotation; private String title, synopsis, comment; private List<BrolCategory> categories; private List<Actor> actors; private List<SerieItem> serieItems; private BrolType brolType; private DateTime date; private bool brolLocked; public Brol() : this(-1) { } public Brol(int id) : this(id, "", "") { } public Brol(int id, String title, String synopsis) { } public Brol(int id, String title, List<BrolCategory> categories, String synopsis, int cotation) : this(id, title, categories, synopsis, cotation, "") { } public Brol(int id, String title, List<BrolCategory> categories, String synopsis, int cotation, String comment) { } public Brol(int id, String title, List<BrolCategory> categories, String synopsis, int cotation, String comment, DateTime date) { this.id = id; this.cotation = cotation; this.title = title; this.synopsis = synopsis; this.comment = comment; this.categories = categories; this.date = date; } public Brol(Brol brol) { this.id = brol.id; this.title = brol.title; this.synopsis = brol.synopsis; this.comment = brol.comment; addCategories(brol.Categories); addActors(brol.Actors); this.brolType = brol.brolType; this.date = brol.date; this.brolLocked = brol.brolLocked; this.cotation = brol.cotation; } #endregion #region overrided methods public override String ToString() { return title; } public override int GetHashCode() { int PRIME = 31; int result = 1; result = PRIME * result + ((actors == null) ? 0 : actors.GetHashCode()); result = PRIME * result + (brolLocked ? 1231 : 1237); result = PRIME * result + ((brolType == null) ? 0 : brolType.GetHashCode()); result = PRIME * result + ((categories == null) ? 0 : categories.GetHashCode()); result = PRIME * result + ((comment == null) ? 0 : comment.GetHashCode()); result = PRIME * result + cotation; result = PRIME * result + ((date == null) ? 0 : date.GetHashCode()); result = PRIME * result + id; result = PRIME * result + ((serieItems == null) ? 0 : serieItems.GetHashCode()); result = PRIME * result + ((synopsis == null) ? 0 : synopsis.GetHashCode()); result = PRIME * result + ((title == null) ? 0 : title.GetHashCode()); return result; } public override bool Equals(Object obj) { /*if (this == o) return true; if (!(o is Brol)) return false; Brol b = (Brol)o; if (this.Id != b.Id) return false; if (!this.title.Equals(b.title)) return false; if (this.synopsis != null) { if (!this.synopsis.Equals(b.synopsis)) return false; } else if (b.synopsis!=null) return false; if (this.comment != null) { if (!this.comment.Equals(b.comment)) return false; } else if (b.comment != null) return false; if (!this.categories.Equals(b.categories)) return false; //if (!testCatEquals(this.categories, b.categories)) return false; if (!this.actors.Equals(b.actors)) return false; if (!this.brolType.Equals(b.brolType)) return false; if (!this.date.Equals(b.date)) return false; if (this.cotation != b.cotation) return false; return true;*/ if (this == obj) return true; if (obj == null) return false; return false; Brol other = (Brol) obj; if (id != other.id) return false; if (title == null) { if (other.title != null) return false; } else if (!title.Equals(other.title)) return false; if (synopsis == null) { if (other.synopsis != null) return false; } else if (!synopsis.Equals(other.synopsis)) return false; if (actors == null) { if (other.actors != null) return false; } else if (!actors.Equals(other.actors)) return false; if (brolType == null) { if (other.brolType != null) return false; } else if (!brolType.Equals(other.brolType)) return false; if (categories == null) { if (other.categories != null) return false; } else if (!categories.Equals(other.categories)) return false; if (comment == null) { if (other.comment != null) return false; } else if (!comment.Equals(other.comment)) return false; if (cotation != other.cotation) return false; if (date == null) { if (other.date != null) return false; } else if (!date.Equals(other.date)) return false; if (serieItems == null) { if (other.serieItems != null) return false; } else if (!serieItems.Equals(other.serieItems)) return false; return true; } /* private bool testCatEquals(List<BrolCategory> list1, List<BrolCategory> list2) { if (list1 == null || list1.Count == 0) { if (list2 == null || list2.Count == 0) return true; } if (list2 == null) return false; if (list1.Count != list2.Count) return false; bool catExist; for (int i = 0; i < (list1.Count - 1); i++) { catExist = false; for (int j = 0; j < (list2.Count - 1); j++) { if (list1[i].Equals(list2[j])) { catExist = true; break; } if (catExist == false) return false; } } return true; } */ #endregion #region getters and setters public int Id { get { return this.id; } set { this.id = value; } } public BrolType BrolType { get { return this.brolType; } set { this.brolType = value; } } public String Title { get { return this.title; } set { this.title = value; } } public String Synopsis { get { return this.synopsis; } set { this.synopsis = value; } } public String Comment { get { return this.comment; } set { this.comment = value; } } public List<BrolCategory> Categories { get { return this.categories; } set { this.categories = value; } } public int Cotation { get { return this.cotation; } set { this.cotation = value; } } public List<Actor> Actors { get { return this.actors; } set { this.actors = value; } } public List<SerieItem> SerieItems { get { return this.serieItems; } set { this.serieItems = value; } } public DateTime Date { get { return this.date; } set { this.date = value; } } /// <summary> /// Set to true when use in editing mode to avoid concurent modifications. /// If brolLocked, saving it is not allowed /// </summary> public bool BrolLocked { get { return this.brolLocked; } set { this.brolLocked = value; } } #endregion #region public methods public void addCategory(BrolCategory category) { categories.Add(category); } public void addCategories(List<BrolCategory> categories) { categories.AddRange(categories); } public void addActor(Actor actor) { actors.Add(actor); } public void addActors(List<Actor> actors) { actors.AddRange(actors); } public void addSerieItem(SerieItem serieItem) { serieItems.Add(serieItem); } public void addSerieItems(List<SerieItem> serieItems) { serieItems.AddRange(serieItems); } public BrolCategory getCategoryById(int id) { foreach (BrolCategory category in categories) { if (category.Id == id) { return category; } } return null; } public Actor getActorById(int id) { foreach (Actor actor in actors) { if (actor.Id == id) { return actor; } } return null; } #endregion } }
BrolCategory
L'objet BrolCategory définit une catégorie pour un ouvrage.
Code c# (BrolCategory.cs) (29 lignes)
using System; using System.Collections.Generic; using System.Text; namespace be.gaudry.bibliobrol.model { /// <summary> /// Category for a brol object. /// i.e. may be "Horror", "Science-Fiction" for a film /// </summary> [Serializable] public class BrolCategory : GenericStateContainer { #region constructor and declarations public BrolCategory() : base() { } public BrolCategory(int id, String name) : base(id, name) { } #endregion #region overrided methods public override bool Equals(Object o) { //if (this == o) return true; BrolCategory c = (BrolCategory)o; return this.Id == c.Id && this.Name.Equals(c.Name); } #endregion } }
BrolType
L'objet BrolType définit un type d'ouvrage (ex : film, bande dessinée, livre, etc.).
Code c# (BrolType.cs) (38 lignes)
using System; using System.Collections.Generic; using System.Text; namespace be.gaudry.bibliobrol.model { /// <summary> /// Type for a brol object. /// i.e. may be "film", "bd", "book" /// </summary> [Serializable] public class BrolType : GenericStateContainer { #region constructor and declarations public BrolType():base(){} public BrolType(int id, String name):base(id,name){} /// <summary> /// Copy constructor /// </summary> /// <param name="type">(BrolType) broltype to copy</param> public BrolType(BrolType type) :this(type.Id, type.Name) { this.Status = type.Status; } #endregion #region overrided methods public override bool Equals(object obj) { BrolType brolType = obj as BrolType; if (brolType == null) return false; return this.Id == brolType.Id && this.Name.Equals(brolType.Name); } #endregion } }
MediaBrol
L'objet MediaBrol définit un exemplaire.
Code c# (MediaBrol.cs) (169 lignes)
using System; using System.Collections.Generic; using System.Text; namespace be.gaudry.bibliobrol.model { /// <summary> /// Physical occurence of a Brol. /// I.E. For a film (Brol object), we may have some physical occurences (MediaBrol object) /// like a DVD, two different encoding DivX versions on CD, etc. /// </summary> [Serializable] public class MediaBrol : IBrol { #region constructors and declarations private int id; private Brol brol; private Media media; /// <summary> /// I.E. Sound(DTS), Codec(VOB), etc. /// </summary> private List<Quality> qualities; private Person owner; private String name, comment, localisation; private DateTime insertionDate; [NonSerialized] private bool borrowed;//used to get quick info with lazy fetching [NonSerialized] private List<Borrow> borrows; public MediaBrol() { this.reset(); } public MediaBrol(int id, Brol brol):this() { this.id = id; this.brol = brol; } public MediaBrol(int id, Brol brol, String name) : this(id, brol) { this.name = name; } public MediaBrol(int id, Brol brol, String name, String comment, String localisation) : this(id, brol, name) { this.comment = comment; this.localisation = localisation; } public MediaBrol( int id, Brol brol, String name, String comment, String localisation, Media media, List<Quality> qualities, Person owner, DateTime insertionDate) : this(id, brol, name, comment, localisation) { this.media = media; this.qualities = qualities; this.owner = owner; this.insertionDate = insertionDate; } public MediaBrol( int id, Brol brol, String name, String comment, String localisation, Media media, List<Quality> qualities, Person owner, DateTime insertionDate, List<Borrow> borrows) : this(id, brol, name, comment, localisation, media, qualities, owner, insertionDate) { this.borrows = borrows; } #endregion #region private methods private void reset() { id = -1; name = ""; comment = ""; localisation = ""; borrowed = false; } #endregion #region getters and setters public int Id { get { return this.id; } set { this.id = value; } } public Brol Brol { get { return this.brol; } set { this.brol = value; } } public String Name { get { return this.name; } set { this.name = value; } } public String Comment { get { return this.comment; } set { this.comment = value; } } public String Localisation { get { return this.localisation; } set { this.localisation = value; } } public Person Owner { get { return this.owner; } set { this.owner = value; } } public List<Quality> Qualities { get { return this.qualities; } set { this.qualities = value; } } public Media MediaType { get { return this.media; } set { this.media = value; } } public DateTime InsertionDate { get { return this.insertionDate; } set { this.insertionDate = value; } } /// <summary> /// Get or set the history of borrows for this item /// Be carefull : This info is NOT available in lazy fetching (empty list) /// </summary> public List<Borrow> Borrows { get { return this.borrows; } set { this.borrows = value; } } /// <summary> /// Get true if this mediabrol is currently borrowed /// This info is also available in lazy fetching /// </summary> public bool Borrowed { get { /*if (Borrows.Count < 1) return false; return Borrows[Borrows.Count - 1].EndDate != new DateTime(0L); */ return borrowed; } set { borrowed = value; } } #endregion } }
Media
L'objet Media définit le support utilisé pour un exemplaire (ex : DVD-R, DVD+R, VHS, CD, etc. pour un exemplaire d'un film).
Code c# (Media.cs) (78 lignes)
using System; using System.Collections.Generic; using System.Text; namespace be.gaudry.bibliobrol.model { /// <summary> /// Storage support. /// I.E. CD, DVD, Book, etc. /// </summary> [Serializable] public class Media { #region constructors and declarations private int id; private String name; private BrolType brolType; public Media(String name) { this.id = -1; this.name = name; } public Media(int id, String name) { this.id = id; this.name = name; } public Media(int id, String name, BrolType brolType) { this.id = id; this.name = name; this.brolType = brolType; } #endregion #region overrided methods public override String ToString() { return name; } public override int GetHashCode() { //todo : reimplement GetHashCode return this.ToString().GetHashCode(); } public override bool Equals(Object o) { if (this == o) return true; Media m = (Media)o; if (this.Id != m.Id) return false; if (!this.name.Equals(m.name)) return false; if (this.brolType.Id!=m.brolType.Id) return false; return true; } #endregion #region getters an setters public int Id { get { return this.id; } set { this.id = value; } } public BrolType BrolType { get { return this.brolType; } set { this.brolType = value; } } public String Name { get { return this.name; } set { this.name = value; } } #endregion } }
Person
L'objet Person définit une personne.
Code c# (Person.cs) (182 lignes)
using System; using System.Collections.Generic; using System.Text; using System.Data; using be.gaudry.observer; using be.gaudry.bibliobrol.model.identity; namespace be.gaudry.bibliobrol.model { [Serializable] public class Person : Observable { #region constructor and declarations private int id; private Identity identity; /// <summary> /// Set to true when use in editing mode to avoid concurent modifications. /// If brolLocked, saving it is not allowed /// </summary> private bool edited; public Person() { reinit(true); } public Person(int id, String lastName):this() { this.id = id; identity.LastName = lastName; } /// <summary> /// Create a person with only a lastName and a firstName. /// Person id has -1 value /// </summary> /// <param name="lastName">(String) lastName</param> /// <param name="firstName">(String) firstName</param> public Person(String lastName, String firstName) { reinit(true); identity.LastName = lastName; identity.FirstName = firstName; } #endregion #region overrided methods public override String ToString() { if(identity!=null) return identity.ToString(); return id.ToString(); } public override int GetHashCode() { if (identity != null) return identity.GetHashCode(); return id.GetHashCode(); } public override bool Equals(Object o) { Person p = (Person)o; if (identity == null && p.identity == null) return id == p.id; return id == p.id && identity.Equals(p.identity); } #endregion #region properties public int Id { get { return this.id; } set { this.id = value; } } /// <summary> /// Set to true when use in editing mode to avoid concurent modifications. /// If brolLocked, saving it is not allowed /// </summary> public bool Edited { get { return this.edited; } set { this.edited = value; } } #endregion #region identity properties public String LastName { get { return identity.LastName; } set { identity.LastName = value; } } public String FirstName { get { return identity.FirstName; } set { identity.FirstName = value; } } public String Pseudo { get { return identity.Pseudo; } set { identity.Pseudo = value; } } public SEX Sex { // if not set, return first enum value // be sure than the first value is "_" get { return identity.Sex; } set { identity.Sex = value; } } public DateTime Birthdate { get { return identity.Birthdate; } set { identity.Birthdate = value; } } #endregion #region public methods public void setIdentity(Identity identity) { this.identity = identity; } public Identity getIdentity() { return this.identity; } /// <summary> /// Create a person with all values from an other person /// </summary> /// <param name="person">(Person) person to copy</param> public void copy(Person person) { if (person != null) { try { id = person.id; edited = person.edited; //identity = person.identity is not allowed : copy references and not values LastName = person.LastName; FirstName = person.FirstName; Pseudo = person.Pseudo; Birthdate = person.Birthdate; Sex = person.Sex; } catch (Exception e) { } } else { notify(new Notification(Notification.VERBOSE.error,"Copie de personne : impossible de copier une valeur nulle", this)); } } /// <summary> /// Used to fill all field with default values /// </summary> /// <param name="total">(bool) Reset also person Id if true</param> public void reinit(bool total) { if(total)id = -1; edited = false; } /// <summary> /// Used to get local sex name /// </summary> /// <param name="s">(SEX) sex</param> /// <returns>(String) local sex name</returns> public String getSexName(SEX s) { switch (s) { case SEX.F: return "Femme"; case SEX.M: return "Homme"; default: return "?"; } } #endregion } }
Phone
L'objet Phone définit un numéro de téléphone pour une personne et ses caractéristiques.
Code c# (Phone.cs) (155 lignes)
using System; using System.Collections.Generic; using System.Text; namespace be.gaudry.bibliobrol.model { [Serializable] public class Phone : ICloneable { #region constructor and declarations public enum TYPE { _, bureau, domicile, gsm } private int id; private String number; private TYPE type; public Phone() { reset(); } public Phone(String number) : this() { this.number = number; } public Phone(int id, String number) : this(number) { this.id = id; } public Phone(int id, String number, TYPE type) : this(id, number) { this.type = type; } #endregion #region overrided methods public override String ToString() { /*if(id==-1) return "Nouveau numéro";*/ return number + " (" + getTypeLocalName(type) + ")"; } public override bool Equals(object obj) { Phone phone = obj as Phone; if (phone == null) return false; if (phone.Id != id) return false; return phone.Number.Equals(number) && phone.Type.Equals(type); } public override int GetHashCode() { return (ToString()+id).GetHashCode(); } #endregion #region public methods /// <summary> /// Used to set default values for all fields /// </summary> public void reset() { id = -1; number = ""; type = TYPE._; } /// <summary> /// Get the local name of a phone type enum item /// </summary> /// <param name="t">Phone type enum item</param> /// <returns>Local name of param</returns> public static String getTypeLocalName(TYPE t) { switch (t) { case TYPE.gsm: return "GSM";//break; case TYPE.domicile: return "Maison";//break; case TYPE.bureau: return "Bureau";//break; default: return "Sans type"; } } /// <summary> /// Get the phone type enum item from a local name /// </summary> /// <param name="t">Local name of type</param> /// <returns>Phone type enum item</returns> public static TYPE getTypeFromLocalName(String t) { switch (t) { case "GSM": return TYPE.gsm;//break; case "Maison": return TYPE.domicile;//break; case "Bureau": return TYPE.bureau;//break; default: return TYPE._; } } /// <summary> /// Get the local name of a phone type enum item name /// </summary> /// <param name="typeName">(String) Phone type enum item name</param> /// <returns>Local name of param</returns> public static String getTypeLocalName(String typeName) { TYPE t; try { } catch(Exception) { t = TYPE._; } return getTypeLocalName(t); } #endregion #region properties public int Id { get { return this.id; } set { this.id = value; } } public String Number { get { return this.number; } set { //todo : implement validation rules this.number = value; } } /// <summary> /// Just use to display /// </summary> public String NumberAndType { //no setter!!! get { return ToString(); } } public TYPE Type { get { return this.type; } set { this.type = value; } } #endregion #region ICloneable Members public object Clone() { Phone p = (Phone)MemberwiseClone(); return p; } #endregion } }
Actor
L'objet Actor définit une personne qui joue un rôle dans l'application. L'objet Actor hérite de Person.
Code c# (Actor.cs) (132 lignes)
using System; using System.Collections.Generic; using System.Text; namespace be.gaudry.bibliobrol.model { [Serializable] public class Actor : Person { #region constructor and declarations private STATUS status; private ActorRole role; public Actor():base() { this.Status = STATUS.none; } public Actor(int id, String lastName) : this() { this.Id = id; this.LastName = lastName; } #endregion #region overrided methods public override String ToString() { s.Append(" "); s.Append(LastName); s.Append(" ("); if(role!=null && role.Name!=null) s.Append(role.Name); else s.Append("Rôle indéterminé"); s.Append(")"); return s.ToString(); } public override int GetHashCode() { //todo : reimplement GetHashCode return this.ToString().GetHashCode(); } public override bool Equals(Object o) { //if (this == o) return true; Actor p = o as Actor; if (p == null) return false; if (this.Id != p.Id) return false; if (this.role != null) { if (!this.role.Equals(p.role)) return false; } else if (p.role!=null) return false; //if (!this.LastName.Equals(p.LastName)) return false; //if (!this.FirstName.Equals(p.FirstName)) return false; //if (!this.getBirthdate().Equals(p.getBirthdate())) return false; return true; } #endregion #region properties public ActorRole Role { get { return this.role; } set { this.role = value; } } public STATUS Status { get { return this.status; } set { this.status = value; } } /// <summary> /// Get string with lastname, firstname, and role /// </summary> public String Display { get { /*StringBuilder display = new StringBuilder(this.ToString()); if (role!=null && role.Name != null && !role.Name.Equals("")) { display.Append(" ("); display.Append(role.Name); display.Append(")"); } return display.ToString(); */ return this.ToString(); } } /// <summary> /// Get string with firstname and lastname /// </summary> public String DisplayPerson { get { return String.Format("{0} {1}", FirstName, LastName); } } #endregion #region public methods public void setFromPerson(Person person) { this.Id = person.Id; this.LastName = person.LastName; this.FirstName = person.FirstName; this.Sex = person.Sex; } #endregion /* /// <summary> /// Get person without phones or mail addresses /// </summary> /// <param name="reset">true if we want insert this person as a new person</param> /// <returns></returns> internal Person getPerson(bool reset) { int id = (reset)?-1:Id; Person p = new Person(id,LastName); p.FirstName = FirstName; p.Pseudo = Pseudo; p.Birthdate = Birthdate; p.Sex = Sex; return p; }*/ } }
ActorRole
L'objet ActorRole définit un rôle joué par un acteur dans l'application. Par exemple : dessinateur de bande dessinée.
Code c# (ActorRole.cs) (102 lignes)
using System; using System.Collections.Generic; using System.Text; namespace be.gaudry.bibliobrol.model { [Serializable] public class ActorRole { #region constructor and declarations private int id; private String name, value, info; public ActorRole() : this(-1, "") { } public ActorRole(int id, String name) : this(id, name, "") { } public ActorRole(int id, String name, String value) : this(id,name,value,"") { } public ActorRole(int id, String name, String value, String info) { this.id = id; this.name = name; this.value = value; this.info = info; } /// <summary> /// Copy constructor /// </summary> /// <param name="role"></param> public ActorRole(ActorRole role) { this.id = role.id; this.name = role.name; this.value = role.value; this.info = role.info; } #endregion #region overrided methods public override String ToString() { return name + " " + value; } public override int GetHashCode() { //todo : reimplement GetHashCode return this.ToString().GetHashCode(); } public override bool Equals(Object o) { //if (this == o) return true; ActorRole p = (ActorRole)o; if (!this.name.Equals(p.name)) return false; if (!this.value.Equals(p.value)) return false; return true; } #endregion #region getters and setters /// <summary> /// Role identifier /// </summary> public int RoleId { get { return this.id; } set { this.id = value; } } /// <summary> /// Role name (i.e. Acteur) /// </summary> public String Name { get { return this.name; } set { this.name = value; } } /// <summary> /// Role value (i.e. person name played by an actor) /// </summary> public String Value { get { return this.value; } set { this.value = value; } } /// <summary> /// Role info (i.e. film title where this actor plays) /// </summary> public String Info { get { return this.info; } set { this.info = value; } } #endregion } }
Borrow
L'objet Borrow définit l'emprunt d'un exemplaire par une personne.
Code c# (Borrow.cs) (85 lignes)
using System; using System.Collections.Generic; using System.Text; namespace be.gaudry.bibliobrol.model { public class Borrow { #region Constructors and declarations private int id; private Person borrower; private String comment; private int mediabrolId; private DateTime startDate, endDate, planDate; public Borrow(int mediabrolId, DateTime startDate) { this.id = -1; this.mediabrolId = mediabrolId; this.startDate = startDate; } public Borrow(int id, int mediabrolId, DateTime startDate, Person borrower) { this.id = id; this.mediabrolId = mediabrolId; this.borrower = borrower; this.startDate = startDate; } public Borrow(int id, int mediabrolId, DateTime startDate, DateTime endDate, DateTime planDate, Person borrower, String comment) { this.id = id; this.mediabrolId = mediabrolId; this.borrower = borrower; this.startDate = startDate; this.endDate = endDate; this.planDate = planDate; this.comment = comment; } #endregion #region getters and setters public int Id { get { return this.id; } set { this.id = value; } } public int MediabrolId { get { return this.mediabrolId; } set { this.mediabrolId = value; } } public String Comment { get { return this.comment; } set { this.comment = value; } } public Person Borrower { get { return this.borrower; } set { this.borrower = value; } } public DateTime StartDate { get { return this.startDate; } set { this.startDate = value; } } public DateTime EndDate { get { return this.endDate; } set { this.endDate = value; } } public DateTime PlanDate { get { return this.planDate; } set { this.planDate = value; } } #endregion } }
Task
L'objet Task définit une tâche.
Code c# (Task.cs) (104 lignes)
using System; using System.Collections.Generic; using System.Text; namespace be.gaudry.bibliobrol.model { public class Task { #region constructor and declarations private int id; private String taskName, taskInfo; private DateTime startDate, endDate, planDate; public Task() { this.id = -1; taskName = ""; taskInfo = ""; } public Task(int id, String taskName) : this() { this.id = id; this.taskName = taskName; } public Task(int id, String taskName, DateTime startDate) : this(id, taskName) { this.startDate = startDate; } public Task(int id, String taskName, String taskInfo) : this(id, taskName) { this.taskInfo = taskInfo; } public Task(int id, DateTime startDate, String taskName, DateTime planDate, DateTime endDate, String taskInfo) : this(id, taskName, taskInfo) { this.startDate = startDate; this.planDate = planDate; this.endDate = endDate; } #endregion #region overrided methods public override String ToString() { return startDate + " : " + taskName; } public override int GetHashCode() { return this.ToString().GetHashCode(); } public override bool Equals(Object o) { //if (this == o) return true; Task t = (Task)o; if (this.Id != t.Id) return false; if (!this.taskName.Equals(t.taskName)) return false; if (!this.taskInfo.Equals(t.taskInfo)) return false; if (!this.startDate.Equals(t.startDate)) return false; if (!this.endDate.Equals(t.endDate)) return false; return true; } #endregion #region getters and setters public int Id { get { return this.id; } set { this.id = value; } } public String TaskName { get { return this.taskName; } set { this.taskName = value; } } public String TaskInfo { get { return this.taskInfo; } set { this.taskInfo = value; } } public DateTime StartDate { get { return this.startDate; } set { this.startDate = value; } } public DateTime EndDate { get { return this.endDate; } set { this.endDate = value; } } public DateTime PlanDate { get { return this.planDate; } set { this.planDate = value; } } #endregion } }
Deutsche Übersetzung
Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.
Vielen Dank im Voraus.
Dokument erstellt 06/12/2006, zuletzt geändert 26/10/2018
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/bibliobrol-objets.html
Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.