use of gov.sandia.n2a.db.MNode in project n2a by frothga.
the class ImportJob method gate.
public void gate(Node node, MNode container) {
String id = getAttribute(node, "id");
String type = getAttribute(node, "type");
boolean instantaneous = type.contains("Instantaneous");
String inherit;
if (type.isEmpty())
inherit = node.getNodeName();
else
inherit = type;
NameMap nameMap = partMap.importMap(inherit);
inherit = nameMap.internal;
MNode part = container.set(id, "");
part.set("$inherit", "\"" + inherit + "\"");
addDependency(part, inherit);
addAttributes(node, part, nameMap, "id", "type");
for (Node child = node.getFirstChild(); child != null; child = child.getNextSibling()) {
if (child.getNodeType() != Node.ELEMENT_NODE)
continue;
String name = child.getNodeName();
switch(name) {
case "subGate":
gate(child, part);
break;
case "notes":
part.set("$metadata", "notes", getText(child));
break;
case "q10Settings":
q10(child, part);
break;
case "openState":
case "closedState":
id = getAttribute(child, "id");
part.set(id, "$inherit", "\"Kinetic State\"");
part.set(id, "relativeConductance", name.equals("openState") ? "1" : "0");
break;
case "forwardTransition":
case "reverseTransition":
case "tauInfTransition":
case "vHalfTransition":
transition(child, part);
break;
default:
rate(child, part, false, instantaneous);
}
}
}
use of gov.sandia.n2a.db.MNode in project n2a by frothga.
the class ImportNeuroML method process.
@Override
public void process(File source) {
if (PluginNeuroML.partMap == null)
PluginNeuroML.partMap = new PartMap();
ImportJob job = new ImportJob(PluginNeuroML.partMap);
job.process(source);
job.postprocess();
MNode mainModel = job.models.child(job.modelName);
job.models.clear(job.modelName);
UndoManager um = PanelModel.instance.undoManager;
um.addEdit(new CompoundEdit());
while (job.models.size() > 0) addModel(job.models.iterator().next(), job.models, um);
// after all add operations are completed.
if (mainModel != null)
um.add(new AddDoc(job.modelName, mainModel));
um.endCompoundEdit();
}
use of gov.sandia.n2a.db.MNode in project n2a by frothga.
the class RunEnsemble method addRun.
public void addRun(Run run) {
runs.add(run);
runDocs.add(run.getSource());
MNode runsNode = source.childOrCreate("runs");
runsNode.childOrCreate(String.valueOf(runsNode.size())).merge(run.getSource());
}
Aggregations