Esempio n. 1
0
        public void AddInstrument(String serialNumber, double price, InstrumentSpec spec)
        {
            Instrument instrument = null;

            if (spec is GuitarSpec)
            {
                instrument = new Guitar(serialNumber, price, (GuitarSpec)spec);
            }
            else if (spec is MandolinSpec)
            {
                instrument = new Mandolin(serialNumber, price, (MandolinSpec)spec);
            }
            _inventory.Add(instrument);
        }
Esempio n. 2
0
        public bool Matches(InstrumentSpec otherSpec)
        {
            if (!base.Matches(otherSpec))
            {
                return(false);
            }
            if (!(otherSpec is MandolinSpec))
            {
                return(false);
            }
            MandolinSpec mandolinSpec = (MandolinSpec)otherSpec;

            if (_style != mandolinSpec._style)
            {
                return(false);
            }
            return(true);
        }
Esempio n. 3
0
        public bool Matches(InstrumentSpec otherSpec)
        {
            if (!base.Matches(otherSpec))
            {
                return(false);
            }
            if (!(otherSpec is GuitarSpec))
            {
                return(false);
            }
            GuitarSpec guitarSpec = (GuitarSpec)otherSpec;

            if (_numStrings != guitarSpec._numStrings)
            {
                return(false);
            }
            return(true);
        }
Esempio n. 4
0
 public bool Matches(InstrumentSpec otherSpec)
 {
     if (_builder != otherSpec._builder)
     {
         return(false);
     }
     if ((_model != null) && (!_model.Equals("")) && (!_model.Equals(otherSpec._model)))
     {
         return(false);
     }
     if (_type != otherSpec._type)
     {
         return(false);
     }
     if (_backWood != otherSpec._backWood)
     {
         return(false);
     }
     if (_topWood != otherSpec._topWood)
     {
         return(false);
     }
     return(true);
 }
Esempio n. 5
0
 public Instrument(string serialNumber, double price, InstrumentSpec spec)
 {
     _serialNumber = serialNumber;
     _price        = price;
     _spec         = spec;
 }