internal static PatchTable GetInstanceWithUniformWeights(VaccineMaker vaccineMaker) { SpecialFunctions.CheckCondition(vaccineMaker is Greedy); Greedy greedy = (Greedy)vaccineMaker; return(GetInstanceWithUniformWeightByLength(PatchPatternCollection(greedy))); }
static public VaccineMaker GetInstance(string name) { SpecialFunctions.CheckCondition(name == "Greedy", "VaccineMaker must be 'Greedy'"); VaccineMaker aVaccineMaker = new Greedy(); aVaccineMaker.Name = name; return(aVaccineMaker); }
override public void DoIt(Greedy greedy) { string u = Unification.ToString(); Debug.Assert(u[0] != '.' && u[u.Length - 1] != '.'); // real assert should have AASet.OptionalAny at start or end //Debug.Assert(Combinable is Component || greedy.UnusedPatches.Contains(Combinable)); // real assert Component.ReplaceWithUnification(Combinable, Unification); Combinable.RemoveMeFromTablesAndUpdate(greedy, Component); }
private static List <PatchPattern> PatchPatternCollection(Greedy greedy) { List <PatchPattern> rg = new List <PatchPattern>(); foreach (Component component in greedy.Components) { PatchPattern patchPattern = component.PatchPattern(); rg.Add(patchPattern); } return(rg); }
override public void RemoveMeFromTablesAndUpdate(Greedy greedy, Component component) { greedy.VaccineAsString.SetComponents(greedy.Components); greedy.RemovePatchFromTables(this); greedy.UpdateComponentTables(component); }
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); }
public abstract void RemoveMeFromTablesAndUpdate(Greedy greedy, Component component);
public abstract void DoIt(Greedy greedy);