/* This is the place to assemble the top-level choices available in the GUI. A "project" is a list of model cases. Use pl.addProject() to add another entry to the projects toolbar at the very top of the window. A "model" in this context is an Environment object with a linked Ecosystem object. Use addModel() to add an entry to the second toolbar. A "view" is a display mode for a particular model. These will show up in a toolbar at the bottom if a model has more than one of them. Use "addView". Note also the makeDefault() methods. Right now, the sequence that these things show up in the toolbars can't be controlled. This is a limitation of the HashMap implementation, which ought to change in the future. Note that defaults and ranges for free parameters (controlled by sliders) are set within the Ecosystem and Environment objects, but initial conditions are set here. It doesn't have to be this way: all of the configuration of a given model case, including its linked Views, could be moved into a custom class that extends Environment. Note also that all the configuration done here is run _before_ the projects, models, and views get linked to the GUI, and thus at this point they don't have access to the screen layout, colors, fonts, etc. Any graphical customization of a View has to be done within the View.define() method. */ ProjectList assembleMasterProjectList() { ProjectList pl = new ProjectList(); Project p; Environment env; // ASTroCAT ---------------------------------------- p = pl.addProject("ASTroCAT"); pl.makeDefault(p); int[] NP = {2, 4, 8, 16, 40}; for (int i=0; i cm/s switcher.addVar("w", -1, 1); switcher.addVar("PAR",0,150); env.addView(switcher); env.getVar("N").setInitial(30); env.getVar("P").setInitial(0.1); env.getVar("Z").setInitial(0.1); p.addModel(env); p.makeDefault(env); return pl; } // --------------------------------------------------------------------------------------------- class ProjectList extends HashMap { Project currentProject; ProjectList() {} Project addProject(String name) { Project p = new Project(name); put(name, p); return p; } Project addProject(Project p) { put(p.shortname, p); return p; } void makeDefault(Project p) { currentProject = p; } } class Project extends HashMap { String shortname; Environment currentModel = null; Toolbar modelsToolbar = null; Project(String shortname) { this.shortname = shortname; currentModel = null; } Environment addModel(Environment env) { put(env.shortname, env); if (currentModel == null) currentModel = env; return env; } void makeDefault(Environment env) { currentModel = env; } }