return f;
}
+ /**
+ * Returns the float value as a string unless the value is an integer. In
+ * that case returns the integer value as a string.
+ *
+ * @return a string representing the value, either with or without decimals
+ */
+ public String getFloatOrInteger() {
+ float f = getFloatValue();
+ int i = (int) f;
+ if ((i) == f) {
+ return i + "";
+ } else {
+ return f + "";
+ }
+ }
+
public void setFloatValue(float f) {
this.f = f;
i = (int) f;
text = Integer.toString(getIntegerValue(), 10);
break;
case LexicalUnit.SAC_REAL:
- text = getFloatValue() + "";
+ text = getFloatOrInteger();
break;
case LexicalUnit.SAC_EM:
case SCSSLexicalUnit.SAC_LEM:
case LexicalUnit.SAC_HERTZ:
case LexicalUnit.SAC_KILOHERTZ:
case LexicalUnit.SAC_DIMENSION:
- float f = getFloatValue();
- int i = (int) f;
- if ((i) == f) {
- text = i + getDimensionUnitText();
- } else {
- text = f + getDimensionUnitText();
- }
+ text = getFloatOrInteger() + getDimensionUnitText();
break;
case LexicalUnit.SAC_URI:
text = "url(" + getStringValue() + ")";