コード例 #1
0
        static public Component GetInstance(Patch aPatch)
        {
            Component aComponent = new Component();

            aComponent._patchPattern = aPatch.PatchPattern();
            aComponent.Weight        = aPatch.Weight;
            aComponent.CreationOrder = NumberCreated++;
            return(aComponent);
        }
コード例 #2
0
        public Component MakePatchAComponent(Patch aPatch)
        {
            RemovePatchFromTables(aPatch);
            VaccineAsString.AddComponent(aPatch.PatchPattern());
            Component aComponent = Component.GetInstance(aPatch);

            Components.AddNew(aComponent);
            UpdateComponentTables(aComponent);

            return(aComponent);
        }
コード例 #3
0
        private void Add(Patch aPatch)
        {
            PatchPattern patchPattern = aPatch.PatchPattern();

            if (PatchPatternToPatch.ContainsKey(patchPattern))
            {
                Patch previous = (Patch)PatchPatternToPatch[patchPattern];
                previous.Weight += aPatch.Weight;
            }
            else
            {
                PatchPatternToPatch.Add(patchPattern, aPatch);
            }
        }
コード例 #4
0
 override public void DoIt(Greedy greedy)
 {
     Debug.Assert(greedy.UnusedPatches.Contains(Patch));             // real assert
     Debug.WriteLine(string.Format("Making patch {0} a component, causing weight to increase by {1}", Patch.PatchPattern(), Patch.Weight));
     greedy.MakePatchAComponent(Patch);
 }