public static List <Ptype> CreatePrototypeLibrary(IEnumerable <Mutable> buildargs) { List <Ptype> ptypes = new List <Ptype>(); Feature.Factory features = new Feature.Factory(); foreach (Mutable prototypebuildargs in buildargs) { ptypes.Add(CreatePtypeFromMutable(prototypebuildargs, ModelInstances.All, features, buildargs)); } return(ptypes); }
private static Ptype CreatePtypeFromMutable(Mutable prototypebuildargs, Model[] models, Feature.Factory features, IEnumerable <Mutable> allptypes) { Dictionary <string, Bitmap> ptypefeatureshash = prototypebuildargs.Features; Dictionary <string, Feature> ptypefeatures = new Dictionary <string, Feature>(); foreach (String fname in ptypefeatureshash.Keys) { Feature feature = features.Create(ptypefeatureshash[fname]); ptypefeatures.Add(fname, feature); } Model model = null; foreach (Model m in models) { if (m.Name.Equals(prototypebuildargs.Model)) { model = m; break; } } Dictionary <string, Region> rdict = (Dictionary <string, Region>) new Dictionary <string, Region>(prototypebuildargs.Regions); // if (prototypebuildargs instanceof Hierarchical.HierarchicalMutable) // { // Hierarchical.HierarchicalMutable mhp = (Hierarchical.HierarchicalMutable)prototypebuildargs; // Dictionary<String, Ptype> children = new Dictionary<String, Ptype>(); // for (int c = 0; c < mhp.childrenNames.size(); c++) // { // Mutable ptype = null; // for(Mutable p : allptypes){ // if(p.id.equals(mhp.children.get(c))){ // ptype = p; // break; // } // } // children.put(mhp.childrenNames.get(c), createPtypeFromMutable( ptype, models, features, allptypes)); // } // return new Hierarchical(mhp.id, fdict, rdict, model, children); // } // else return(new Ptype(prototypebuildargs.Id, ptypefeatures, rdict, model)); }