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; }
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); }
public void AddInstrument(String serialNumber, double price, InstrumentSpec spec) { Instrument instrument = new Instrument(serialNumber,price,spec); _inventory.Add(instrument); }
public Instrument(string serialNumber, double price, InstrumentSpec spec) { _serialNumber = serialNumber; _price = price; _spec = spec; }