Hardware/Computer.cs
changeset 110 411b72b73d8f
parent 86 b4f0f206173d
child 119 4ca4621553aa
     1.1 --- a/Hardware/Computer.cs	Thu May 06 19:20:38 2010 +0000
     1.2 +++ b/Hardware/Computer.cs	Sun May 09 16:22:13 2010 +0000
     1.3 @@ -91,21 +91,6 @@
     1.4        open = true;
     1.5      }
     1.6  
     1.7 -    private void SubHardwareUpdate(IHardware hardware) {
     1.8 -      foreach (IHardware subHardware in hardware.SubHardware) {
     1.9 -        subHardware.Update();
    1.10 -        SubHardwareUpdate(subHardware);
    1.11 -      }
    1.12 -    }
    1.13 -
    1.14 -    public void Update() {
    1.15 -      foreach (IGroup group in groups)
    1.16 -        foreach (IHardware hardware in group.Hardware) {
    1.17 -          hardware.Update();
    1.18 -          SubHardwareUpdate(hardware);
    1.19 -        }
    1.20 -    }
    1.21 -
    1.22      public bool HDDEnabled {
    1.23        get { return hddEnabled; }
    1.24        set {
    1.25 @@ -221,5 +206,15 @@
    1.26  
    1.27      public event HardwareEventHandler HardwareAdded;
    1.28      public event HardwareEventHandler HardwareRemoved;
    1.29 +
    1.30 +    public void Accept(IVisitor visitor) {
    1.31 +      visitor.VisitComputer(this);
    1.32 +    }
    1.33 +
    1.34 +    public void Traverse(IVisitor visitor) {
    1.35 +      foreach (IGroup group in groups)
    1.36 +        foreach (IHardware hardware in group.Hardware) 
    1.37 +          hardware.Accept(visitor);
    1.38 +    }
    1.39    }
    1.40  }