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));
}
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);
}
}
}
Aggregations