Search in sources :

Example 1 with EvenSpacingParameterSpecification

use of gov.sandia.umf.platform.ensemble.params.specs.EvenSpacingParameterSpecification in project n2a by frothga.

the class ParameterSpecGroupPanel method addParam.

public ParameterSpecPanel addParam(ParameterBundle bundle, ParameterSpecification useThisSpec) {
    ParameterSpecification spec;
    GroupType type = (GroupType) cboGroupType.getSelectedItem();
    Object defaultValue = bundle.getParameter().getDefaultValue();
    if (useThisSpec == null) {
        spec = chooseDefaultSpecification(type, defaultValue);
    } else {
        spec = useThisSpec;
    }
    final ParameterSpecPanel pnlSpec = new ParameterSpecPanel(bundle, spec, readOnly);
    pnlSpec.addRemoveListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            pnlParams.remove(specPanels.get(pnlSpec));
            specPanels.remove(pnlSpec);
            pnlParams.updateUI();
            fireChangeNotifier();
        }
    });
    pnlSpec.addEditListener(new ChangeListener() {

        public void stateChanged(ChangeEvent e) {
            ParameterSpecification spec = pnlSpec.getSpecification();
            GroupType type = (GroupType) cboGroupType.getSelectedItem();
            switch(type) {
                case LATIN_HYPERCUBE:
                    if (!(spec instanceof EvenSpacingParameterSpecification)) {
                        cboGroupType.setSelectedItem(GroupType.MIXED);
                    }
                    break;
                case MONTE_CARLO:
                    if (!(spec instanceof EvenSpacingParameterSpecification)) {
                        cboGroupType.setSelectedItem(GroupType.MIXED);
                    }
                    break;
            }
            fireChangeNotifier();
        }
    });
    JPanel cont = Lay.p(pnlSpec, "eb=10t,opaque=false");
    specPanels.put(pnlSpec, cont);
    pnlParams.add(cont);
    updateUI();
    fireChangeNotifier();
    return pnlSpec;
}
Also used : JPanel(javax.swing.JPanel) ConstantParameterSpecification(gov.sandia.umf.platform.ensemble.params.specs.ConstantParameterSpecification) ParameterSpecification(gov.sandia.n2a.parms.ParameterSpecification) UniformParameterSpecification(gov.sandia.umf.platform.ensemble.params.specs.UniformParameterSpecification) EvenSpacingParameterSpecification(gov.sandia.umf.platform.ensemble.params.specs.EvenSpacingParameterSpecification) EvenSpacingParameterSpecification(gov.sandia.umf.platform.ensemble.params.specs.EvenSpacingParameterSpecification) ChangeEvent(javax.swing.event.ChangeEvent) ChangeListener(javax.swing.event.ChangeListener)

Example 2 with EvenSpacingParameterSpecification

use of gov.sandia.umf.platform.ensemble.params.specs.EvenSpacingParameterSpecification in project n2a by frothga.

the class ParameterSpecGroupSet method multiple.

private static void multiple() {
    RandomManager.setRandomSeed("Ensemble/UniformParameterSpecification", 123);
    ParameterSpecGroup knGrp = new ParameterSpecGroup(3);
    knGrp.put("Knowledge", new ListParameterSpecification(new Object[] { 0.2, 0.5, 0.8 }));
    ParameterSpecGroup gravGrp = new ParameterSpecGroup(6);
    gravGrp.put("Gravity", new EvenSpacingParameterSpecification(10, 20));
    ParameterSpecGroup uniGrp = new ParameterSpecGroup(3);
    uniGrp.put("UNIFORM", new UniformParameterSpecification(0, 10.0), true);
    ParameterSpecGroupSet groups = new ParameterSpecGroupSet();
    groups.add(knGrp);
    groups.add(gravGrp);
    groups.add(uniGrp);
    // ConstantParameterSpecGroup cgroup = new ConstantParameterSpecGroup();
    // cgroup.addConstParameter("Gravity", 2222);
    // cgroup.addConstParameter("Gravityx", 2222);
    // groups.setDefaultValueGroup(cgroup);
    groups.setDefaultValueGroup(new ConstantParameterSpecGroup("Gravity", 22, "xyz", "what", "pisquared", 10.237, "asdf"));
    // groups.printParameterSets(false);
    groups.printParameterSets(true);
}
Also used : ListParameterSpecification(gov.sandia.umf.platform.ensemble.params.specs.ListParameterSpecification) EvenSpacingParameterSpecification(gov.sandia.umf.platform.ensemble.params.specs.EvenSpacingParameterSpecification) UniformParameterSpecification(gov.sandia.umf.platform.ensemble.params.specs.UniformParameterSpecification) ConstantParameterSpecGroup(gov.sandia.umf.platform.ensemble.params.groups.ConstantParameterSpecGroup) LatinHypercubeParameterSpecGroup(gov.sandia.umf.platform.ensemble.params.groups.LatinHypercubeParameterSpecGroup) MonteCarloParameterSpecGroup(gov.sandia.umf.platform.ensemble.params.groups.MonteCarloParameterSpecGroup) ParameterSpecGroup(gov.sandia.umf.platform.ensemble.params.groups.ParameterSpecGroup) ConstantParameterSpecGroup(gov.sandia.umf.platform.ensemble.params.groups.ConstantParameterSpecGroup)

Example 3 with EvenSpacingParameterSpecification

use of gov.sandia.umf.platform.ensemble.params.specs.EvenSpacingParameterSpecification in project n2a by frothga.

the class EvenSpParamSpecDefPanel method setSpecification.

@Override
public void setSpecification(ParameterSpecification spec) {
    EvenSpacingParameterSpecification xspec = (EvenSpacingParameterSpecification) spec;
    txtStart.setText(xspec.getStart().toString());
    txtEnd.setText(xspec.getEnd().toString());
}
Also used : EvenSpacingParameterSpecification(gov.sandia.umf.platform.ensemble.params.specs.EvenSpacingParameterSpecification)

Aggregations

EvenSpacingParameterSpecification (gov.sandia.umf.platform.ensemble.params.specs.EvenSpacingParameterSpecification)3 UniformParameterSpecification (gov.sandia.umf.platform.ensemble.params.specs.UniformParameterSpecification)2 ParameterSpecification (gov.sandia.n2a.parms.ParameterSpecification)1 ConstantParameterSpecGroup (gov.sandia.umf.platform.ensemble.params.groups.ConstantParameterSpecGroup)1 LatinHypercubeParameterSpecGroup (gov.sandia.umf.platform.ensemble.params.groups.LatinHypercubeParameterSpecGroup)1 MonteCarloParameterSpecGroup (gov.sandia.umf.platform.ensemble.params.groups.MonteCarloParameterSpecGroup)1 ParameterSpecGroup (gov.sandia.umf.platform.ensemble.params.groups.ParameterSpecGroup)1 ConstantParameterSpecification (gov.sandia.umf.platform.ensemble.params.specs.ConstantParameterSpecification)1 ListParameterSpecification (gov.sandia.umf.platform.ensemble.params.specs.ListParameterSpecification)1 JPanel (javax.swing.JPanel)1 ChangeEvent (javax.swing.event.ChangeEvent)1 ChangeListener (javax.swing.event.ChangeListener)1