Search in sources :

Example 21 with DoubleInterval

use of maspack.util.DoubleInterval in project artisynth_core by artisynth.

the class RevoluteJoint method setMaxTheta.

public void setMaxTheta(double max) {
    double min = myThetaRange.getLowerBound();
    setThetaRange(new DoubleInterval(min, max));
}
Also used : DoubleInterval(maspack.util.DoubleInterval)

Example 22 with DoubleInterval

use of maspack.util.DoubleInterval in project artisynth_core by artisynth.

the class PropertyDesc method parseOptions.

protected void parseOptions(String optionStr) throws IllegalArgumentException {
    String[] tokens = optionStr.split("\\s+");
    for (int i = 0; i < tokens.length; i++) {
        int firstChar = tokens[i].charAt(0);
        String token = tokens[i];
        if (firstChar == '%') {
            try {
                setPrintFormat(token);
            } catch (IllegalArgumentException e) {
                System.err.println("Property '" + myName + "': illegal numeric format string");
            }
        } else if (firstChar == '[' || firstChar == '(') {
            NumericInterval range = new DoubleInterval(token);
            setNumericRange(range);
        } else if (token.equals("NE") || token.equals("NeverEdit")) {
            setEditing(Edit.Never);
        } else if (token.equals("NW") || token.equals("NoAutoWrite")) {
            setAutoWrite(false);
        } else if (token.equals("AE") || token.equals("AlwaysEdit")) {
            setEditing(Edit.Always);
        } else if (token.equals("1E") || token.equals("SingleEdit")) {
            setEditing(Edit.Single);
        } else if (token.equals("XE") || token.equals("ExpandedEdit")) {
            setWidgetExpandState(ExpandState.Expanded);
        } else if (token.equals("CE") || token.equals("ContractedEdit")) {
            setWidgetExpandState(ExpandState.Contracted);
        } else if (token.equals("AW") || token.equals("AutoWrite")) {
            setAutoWrite(true);
        } else if (token.equals("SH") || token.equals("Sharable")) {
            setSharable(true);
        } else if (token.equals("NV") || token.equals("NullOK")) {
            setNullValueOK(true);
        } else if (token.startsWith("D")) {
            String dimStr;
            if (token.startsWith("Dimension")) {
                dimStr = token.substring("Dimension".length());
            } else {
                dimStr = token.substring("D".length());
            }
            int dim;
            try {
                dim = Integer.parseInt(dimStr);
                if (myDimension != -1 && dim != myDimension) {
                    throw new IllegalArgumentException("Property '" + myName + "': dimension specified as " + dim + " but is known to be " + myDimension);
                } else if (myDimension == -1 && !typeIsNumeric()) {
                    System.err.println("Warning: dimension specified for non-numeric property '" + myName + "'");
                }
                setDimension(dim);
            } catch (NumberFormatException e) {
                throw new IllegalArgumentException("Property '" + myName + "': malformed dimension expression: " + token);
            }
        } else {
            throw new IllegalArgumentException("Property '" + myName + " unrecognized option token " + token);
        }
    }
}
Also used : DoubleInterval(maspack.util.DoubleInterval) NumericInterval(maspack.util.NumericInterval)

Aggregations

DoubleInterval (maspack.util.DoubleInterval)22 NumericInterval (maspack.util.NumericInterval)3 Property (maspack.properties.Property)2 IntegerInterval (maspack.util.IntegerInterval)2 BooleanSelector (maspack.widgets.BooleanSelector)2 DoubleIntervalField (maspack.widgets.DoubleIntervalField)2 AddComponentsCommand (artisynth.core.gui.editorManager.AddComponentsCommand)1 PropertyField (artisynth.core.gui.widgets.PropertyField)1 Point (artisynth.core.mechmodels.Point)1 NumericOutputProbe (artisynth.core.probes.NumericOutputProbe)1 NumericProbeVariable (artisynth.core.probes.NumericProbeVariable)1 ColorBar (artisynth.core.renderables.ColorBar)1 BorderLayout (java.awt.BorderLayout)1 Container (java.awt.Container)1 Dimension (java.awt.Dimension)1 Font (java.awt.Font)1 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 BoxLayout (javax.swing.BoxLayout)1