use of gov.sandia.n2a.parms.ParameterDomain in project n2a by frothga.
the class EquationSet method getOutputParameters.
/**
* Assembles list of all variables that can be used in an output expression.
* Depends on results of: resolveLHS() (optional, enables us to remove "reference" variables)
*/
public ParameterDomain getOutputParameters() {
ImageIcon icon;
if (connectionBindings == null) {
icon = ImageUtil.getImage("layer.gif");
} else {
icon = ImageUtil.getImage("bridge.gif");
}
// TODO: should we return the empty string, or replace it with something?
ParameterDomain result = new ParameterDomain(name, icon);
for (Variable v : variables) {
if (v.hasAttribute("reference"))
continue;
String defaultValue = "";
if (v.equations.size() > 0)
defaultValue = v.equations.first().expression.render();
result.addParameter(new Parameter(v.nameString(), defaultValue));
}
for (EquationSet s : parts) {
result.addSubdomain(s.getOutputParameters());
}
return result;
}
use of gov.sandia.n2a.parms.ParameterDomain in project n2a by frothga.
the class FixedParameterSpacePanel method populate.
// AMap wrap operation
private void populate(TNode nParent, ParameterDomain domain) {
for (ParameterDomain subdomain : domain.getSubdomains()) {
TNode nSubdomain = new TNode(new NodeSubdomain(subdomain));
populate(nSubdomain, subdomain);
nParent.add(nSubdomain);
}
for (Parameter param : domain.getParameters()) {
TNode nParam = new TNode(new NodeParameter(param));
nParent.add(nParam);
}
}
use of gov.sandia.n2a.parms.ParameterDomain in project n2a by frothga.
the class FixedParameterSpacePanel method setSimulationInputParameters.
public void setSimulationInputParameters(ParameterDomain sDomain) {
if (sDomain == null) {
sDomain = new ParameterDomain();
}
simDomain = sDomain;
simDomain.setName("Simulator");
simDomain.setIcon(ImageUtil.getImage("job.gif"));
constructDVGroup();
buildDomainTab(simDomain);
updateFromGroups();
// TODO remove from groups any old sim params
}
use of gov.sandia.n2a.parms.ParameterDomain in project n2a by frothga.
the class ParameterSpecGroupPanel method initPanel.
private void initPanel(ParameterSpecGroup group) {
for (Object key : group.keySet()) {
ParameterSpecification spec = group.get(key);
String keyStr = key.toString();
String[] path = keyStr.split("\\.");
List<ParameterDomain> d = new ArrayList<ParameterDomain>();
for (int i = 0; i < path.length - 1; i++) {
String seg = path[i];
d.add(new ParameterDomain(seg));
}
// , dv, desc,icon);
Parameter param = new Parameter(path[path.length - 1]);
ParameterBundle bundle = new ParameterBundle(d, param);
addParam(bundle, spec);
}
}
use of gov.sandia.n2a.parms.ParameterDomain in project n2a by frothga.
the class OutputParameterPanel method dragGestureRecognized.
public void dragGestureRecognized(DragGestureEvent event) {
Cursor cursor = null;
SimpleTree list = (SimpleTree) event.getComponent();
TreePath[] paths = list.getSelectionPaths();
if (paths == null) {
return;
}
List<ParameterBundle> bundles = new ArrayList<ParameterBundle>();
for (TreePath path : paths) {
List<ParameterDomain> domains = new ArrayList<ParameterDomain>();
for (int p = 0; p < path.getPathCount(); p++) {
Object u = ((TNode) path.getPathComponent(p)).getObject();
if (u instanceof NodeSubdomain) {
domains.add(((NodeSubdomain) u).getSubdomain());
}
}
NodeBase uLeaf = ((TNode) path.getLastPathComponent()).getObject();
if (uLeaf instanceof NodeParameter) {
NodeParameter p = (NodeParameter) uLeaf;
bundles.add(new ParameterBundle(domains, p.getParameter()));
} else {
// TODO: add all children?
return;
}
}
if (event.getDragAction() == DnDConstants.ACTION_LINK) {
cursor = DragCursors.getGrabhandcursor();
}
event.startDrag(cursor, new TransferableParameterBundles(bundles));
}
Aggregations