Пример #1
0
        public virtual bool Validate(Beagle.Hit hit)
        {
            if (flavors.Count < 1)
            {
                return(false);
            }

            Weight = 0;

            HitFlavor best = null;

            foreach (HitFlavor flavor in flavors)
            {
                if (!flavor.IsMatch(hit))
                {
                    continue;
                }

                if (best == null)
                {
                    best = flavor;
                    continue;
                }

                if (flavor.Weight > best.Weight)
                {
                    best = flavor;
                }
            }

            if (best != null)
            {
                Weight += best.Weight;
                return(true);
            }

            return(false);
        }
Пример #2
0
 protected void AddSupportedFlavor(HitFlavor flavor)
 {
     flavors.Add(flavor);
 }
Пример #3
0
		protected void AddSupportedFlavor (HitFlavor flavor)
		{
			flavors.Add (flavor);
		}