public void SetSoftwareAt(AbstractSoftware software, int index) { if ((index >= 0) && (index < softwares.Count)) { softwares[index] = software; } }
public void AddSoftware(AbstractSoftware software) { if (software is Virus) { throw new InvalidSoftwareException("Can't put Virus to Computer"); } if (softwares.Contains(software)) { throw new DuplicateSoftwareException(); } softwares.Add(software); }
public override bool Equals(object obj) { if ((obj == null) || !(obj is AbstractSoftware)) { return(false); } AbstractSoftware other = obj as AbstractSoftware; if ((Name != null) && Name.Equals(other.Name)) { return(Version != null && Version.Equals(other.Version)); } return(false); }
public void SetSoftwareAt(AbstractSoftware software, int index) { if (software is Virus) { throw new InvalidSoftwareException("Can't put Virus to Computer"); } if (softwares.Contains(software)) { throw new DuplicateSoftwareException(); } if ((index < 0) || (index >= softwares.Count)) { throw new IndexOutOfRangeException(); } softwares[index] = software; }
public void AddSoftware(AbstractSoftware software) { softwares.Add(software); }