Ejemplo n.º 1
0
 public ArrayList Search(InstrumentSpec searchGuitar)
 {
     ArrayList matchingInstruments = new ArrayList();
     foreach (var item in _inventory)
     {
         Instrument instrument = (Instrument)item;
         if (instrument.Spec.Matches(searchGuitar))
             matchingInstruments.Add(instrument);
     }
     return matchingInstruments;
 }
Ejemplo n.º 2
0
 public bool Matches(InstrumentSpec otherSpec)
 {
     foreach (var item in otherSpec._properties.Keys)
     {
         string propertyName = (string)item;
         if (!_properties[propertyName].Equals(otherSpec.GetProperty(propertyName)))
         {
             return(false);
         }
     }
     return(true);
 }
Ejemplo n.º 3
0
 public void AddInstrument(String serialNumber, double price, InstrumentSpec spec)
 {
     Instrument instrument = new Instrument(serialNumber,price,spec);
     _inventory.Add(instrument);
 }
Ejemplo n.º 4
0
 public Instrument(string serialNumber, double price, InstrumentSpec spec)
 {
     _serialNumber = serialNumber;
     _price        = price;
     _spec         = spec;
 }