return new LengthRangeProperty();
}
+ private boolean isNegativeLength(Length len) {
+ return ((len instanceof PercentLength
+ && ((PercentLength) len).getPercentage() < 0)
+ || (len.isAbsolute() && len.getValue() < 0));
+ }
+
/**
* @see CompoundPropertyMaker#convertProperty
*/
|| this.propId == PR_INLINE_PROGRESSION_DIMENSION) {
Length len = p.getLength();
if (len != null) {
- if ((len instanceof PercentLength
- && ((PercentLength) len).getPercentage() < 0)
- || (len.isAbsolute() && len.getValue() < 0)) {
- log.warn("Replaced negative value for " + getName()
- + " with 0mpt");
+ if (isNegativeLength(len)) {
+ log.warn(FObj.decorateWithContextInfo(
+ "Replaced negative value (" + len + ") for " + getName()
+ + " with 0mpt", fo));
p = new FixedLength(0);
}
}
|| this.propId == PR_INLINE_PROGRESSION_DIMENSION) {
Length len = subproperty.getLength();
if (len != null) {
- if ((len instanceof PercentLength
- && ((PercentLength) len).getPercentage() < 0)
- || len.getValue() < 0) {
- log.warn("Replaced negative value for " + getName()
+ if (isNegativeLength(len)) {
+ log.warn("Replaced negative value (" + len + ") for " + getName()
+ " with 0mpt");
val.setComponent(subpropertyId,
new FixedLength(0), false);
return this.optimum;
}
+ /** @see java.lang.Object#toString() */
public String toString() {
- return "LengthRange[" +
- "min:" + getMinimum(null).getObject() +
- ", max:" + getMaximum(null).getObject() +
- ", opt:" + getOptimum(null).getObject() + "]";
+ return "LengthRange["
+ + "min:" + getMinimum(null).getObject()
+ + ", max:" + getMaximum(null).getObject()
+ + ", opt:" + getOptimum(null).getObject() + "]";
}
/**