Class CalcValue

All Implemented Interfaces:
CSSExpressionValue, CSSPrimitiveValue, CSSTypedValue, CSSValue, Serializable, Cloneable

public class CalcValue extends ExpressionValue
Calc value.
See Also:
  • Constructor Details

    • CalcValue

      public CalcValue()
    • CalcValue

      protected CalcValue(CalcValue copied)
  • Method Details

    • getStringValue

      public String getStringValue() throws DOMException
      Description copied from interface: CSSTypedValue
      If this value represents a string value, get it.

      This method is useful for values like strings, identifiers, URIs, element references, etc. For functions, it returns the function name.

      Specified by:
      getStringValue in interface CSSTypedValue
      Overrides:
      getStringValue in class ExpressionValue
      Returns:
      the string value.
      Throws:
      DOMException - INVALID_ACCESS_ERR if this value is not a string.
    • isInvalidOperand

      protected boolean isInvalidOperand(PrimitiveValue primi, LexicalUnit.LexicalType lutype, LexicalUnit.LexicalType lastlutype)
      Overrides:
      isInvalidOperand in class ExpressionValue
    • getFloatValue

      public float getFloatValue(short unitType) throws DOMException
      Description copied from interface: CSSTypedValue
      If this is a number, get its float value in the requested unit.
      Specified by:
      getFloatValue in interface CSSTypedValue
      Overrides:
      getFloatValue in class TypedValue
      Parameters:
      unitType - the requested unit type. If the type is CSS_OTHER, the value shall be returned as is, regardless of the unit that was set with.
      Returns:
      the float value in the requested unit.
      Throws:
      DOMException - INVALID_ACCESS_ERR if this value is not a number value or it could not be transformed to the desired unit (for example a relative value converted to an absolute one, for which a context is needed).
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class ExpressionValue
    • getCssText

      public String getCssText()
      Description copied from class: StyleValue
      Get a string representation of the current value.
      Specified by:
      getCssText in interface CSSValue
      Overrides:
      getCssText in class ExpressionValue
      Returns:
      the css text representing the value of this property.
    • getMinifiedCssText

      public String getMinifiedCssText(String pname)
      Description copied from interface: CSSValue
      Gives a minified version of the css text of the property.

      It may be customized for the given property name.

      Specified by:
      getMinifiedCssText in interface CSSValue
      Overrides:
      getMinifiedCssText in class ExpressionValue
      Parameters:
      pname - the property name.
      Returns:
      the minified css text.
    • writeCssText

      public void writeCssText(io.sf.carte.util.SimpleWriter wri) throws IOException
      Description copied from interface: CSSValue
      Serialize this value to a SimpleWriter.
      Specified by:
      writeCssText in interface CSSValue
      Overrides:
      writeCssText in class ExpressionValue
      Parameters:
      wri - the SimpleWriter.
      Throws:
      IOException - if an error happened while writing.
    • clone

      public CalcValue clone()
      Description copied from class: TypedValue
      Creates and returns a copy of this object.

      The object will be the same except for the subproperty flag, that will be disabled in the clone object.

      Specified by:
      clone in interface CSSExpressionValue
      Specified by:
      clone in interface CSSValue
      Overrides:
      clone in class ExpressionValue
      Returns:
      a copy of this object.