{
}
protected int validateParameter (final CSSValue value) throws FunctionEvaluationException
{
final CSSNumericValue nval;
if (value instanceof CSSStringValue)
{
// I shouldn't do this, but ..
final CSSStringValue strVal = (CSSStringValue) value;
nval = FunctionUtilities.parseNumberValue(strVal.getValue());
}
else if (value instanceof CSSNumericValue == false)
{
throw new FunctionEvaluationException("Expected a number");
}
else
{
nval = (CSSNumericValue) value;
}
if (nval.getType().equals(CSSNumericType.NUMBER))
{
return (int) (nval.getValue() % 256);
}
if (nval.getType().equals(CSSNumericType.PERCENTAGE))
{
return (int) (nval.getValue() * 256.0 / 100.0);
}
throw new FunctionEvaluationException("Expected a number, not a length");
}