コード例 #1
0
 public void RemoveResource(AbsractResource res)
 {
     if (res == comp)
     {
         comp = null;
     }
     else if (res == designer)
     {
         designer = null;
     }
     else if (res == algorithm)
     {
         algorithm = null;
     }
     else
     {
         throw new ArgumentException("No such element");
     }
 }
コード例 #2
0
 public void AddResource(AbsractResource res)
 {
     if (res is Computer && comp == null)
     {
         comp = (Computer)res;
     }
     else if (res is Designer && designer == null)
     {
         designer = (Designer)res;
     }
     else if (res is TracingAlgorythm && algorithm == null)
     {
         algorithm = (TracingAlgorythm)res;
     }
     else
     {
         throw new ArgumentException();
     }
 }