private DtLengthRange createOrAddLengthRange(
final DtLengthRange inputLengthRange,
final FObj fobj, final String value,
final String subPropertyName, final String propertyFullName)
throws PropertyException {
DtLengthRange lengthRange = inputLengthRange;
if (lengthRange == null) {
final DtLength lengthMin = DtLength.ZERO_LENGTH;
final DtLength lengthOpt = PdLeaderLength.DEFAULT_OPTIMUM_COMPONENT;
final DtPercentage lengthMax =
PdLeaderLength.DEFAULT_MAXIMUM_COMPONENT;
lengthRange = new DtLengthRange(true, lengthMin, lengthOpt,
lengthMax);
}
final PropertyValue pv = standardParse(fobj, value);
if (! pv.canEvalLength()
&& ! pv.canEvalPercentage()) {
throw unexpectedValue(value, fobj);
}
if (subPropertyName.equals("minimum")) {
lengthRange.setLengthMinimum(pv);
return lengthRange;
} else if (subPropertyName.equals("optimum")) {
lengthRange.setLengthOptimum(pv);
return lengthRange;
} else if (subPropertyName.equals("maximum")) {
lengthRange.setLengthMaximum(pv);
return lengthRange;
}
throw Property.invalidPropertyName(propertyFullName);
}