示例#1
0
 public void SetSoftwareAt(AbstractSoftware software, int index)
 {
     if ((index < 0) || (index >= softwares.Count))
     {
         throw new IndexOutOfRangeException();
     }
     softwares[index] = software;
 }
示例#2
0
 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);
 }
示例#3
0
        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);
        }
示例#4
0
 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;
 }
示例#5
0
 public void AddSoftware(AbstractSoftware software)
 {
     softwares.Add(software);
 }