Пример #1
0
        internal bool Matches(GuitarSpec matchSpec)
        {
            if (matchSpec.Builder != Builder)
            {
                return(false);
            }

            if (!String.IsNullOrWhiteSpace(matchSpec.ModelName) &&
                !matchSpec.ModelName.Equals(ModelName, StringComparison.OrdinalIgnoreCase))
            {
                return(false);
            }

            if (matchSpec.Type != Type)
            {
                return(false);
            }

            if (matchSpec.BackWood != BackWood)
            {
                return(false);
            }

            if (matchSpec.TopWood != TopWood)
            {
                return(false);
            }

            return(true);
        }
Пример #2
0
        public IEnumerable <Guitar> Search(GuitarSpec searchSpec)
        {
            List <Guitar> matchingGuitars = new List <Guitar>();

            foreach (Guitar guitar in guitars)
            {
                if (guitar.Spec.Matches(searchSpec))
                {
                    matchingGuitars.Add(guitar);
                }
            }

            return(matchingGuitars);
        }
Пример #3
0
 public Guitar(String serialNumber, double price, GuitarSpec spec)
 {
     SerialNumber = serialNumber;
     Price        = price;
     Spec         = spec;
 }