Class LexicalUnitImpl

java.lang.Object
org.htmlunit.cssparser.parser.AbstractLocatable
org.htmlunit.cssparser.parser.LexicalUnitImpl
All Implemented Interfaces:
Serializable, LexicalUnit, Locatable

public class LexicalUnitImpl extends AbstractLocatable implements LexicalUnit, Serializable
Implementation of LexicalUnit.
Author:
Ronald Brill
See Also:
  • Constructor Details

    • LexicalUnitImpl

      public LexicalUnitImpl(LexicalUnit previous, LexicalUnit.LexicalUnitType type)
      Ctor.
      Parameters:
      previous - the previous LexicalUnit
      type - the LexicalUnitType
    • LexicalUnitImpl

      protected LexicalUnitImpl(LexicalUnit previous, int value)
      Integer.
      Parameters:
      previous - the previous LexicalUnit
      value - the int value
    • LexicalUnitImpl

      protected LexicalUnitImpl(LexicalUnit previous, LexicalUnit.LexicalUnitType type, double value)
      Dimension.
      Parameters:
      previous - the previous LexicalUnit
      type - the LexicalUnitType
      value - the double value
    • LexicalUnitImpl

      protected LexicalUnitImpl(LexicalUnit previous, LexicalUnit.LexicalUnitType type, String dimension, double value)
      Unknown dimension.
      Parameters:
      previous - the previous LexicalUnit
      type - the LexicalUnitType
      dimension - the dimension
      value - the double value
    • LexicalUnitImpl

      public LexicalUnitImpl(LexicalUnit previous, LexicalUnit.LexicalUnitType type, String value)
      String.
      Parameters:
      previous - the previous LexicalUnit
      type - the LexicalUnitType
      value - the string value
    • LexicalUnitImpl

      protected LexicalUnitImpl(LexicalUnit previous, LexicalUnit.LexicalUnitType type, String name, LexicalUnit params)
      Function.
      Parameters:
      previous - the previous LexicalUnit
      type - the LexicalUnitType
      name - the name
      params - the parameter LexicalUnit
    • LexicalUnitImpl

      protected LexicalUnitImpl(LexicalUnit previous, LexicalUnit.LexicalUnitType type, String name, String stringValue)
      Function.
      Parameters:
      previous - the previous LexicalUnit
      type - the LexicalUnitType
      name - the name
      stringValue - the string value
  • Method Details

    • setNextLexicalUnit

      public void setNextLexicalUnit(LexicalUnit next)
      Parameters:
      next - next LexicalUnit
    • setPreviousLexicalUnit

      public void setPreviousLexicalUnit(LexicalUnit prev)
      Parameters:
      prev - previous LexicalUnit
    • setDoubleValue

      public void setDoubleValue(double doubleVal)
      Parameters:
      doubleVal - the double value
    • getDimension

      public String getDimension()
      Returns:
      the dimension
    • setDimension

      public void setDimension(String dimension)
      Parameters:
      dimension - the new dimension
    • setFunctionName

      public void setFunctionName(String function)
      Parameters:
      function - the function name
    • setParameters

      public void setParameters(LexicalUnit params)
      Parameters:
      params - the parameter LexicalUnit
    • setStringValue

      public void setStringValue(String stringVal)
      Parameters:
      stringVal - the string value
    • getLexicalUnitType

      public LexicalUnit.LexicalUnitType getLexicalUnitType()
      Description copied from interface: LexicalUnit

      getLexicalUnitType.

      Specified by:
      getLexicalUnitType in interface LexicalUnit
      Returns:
      an integer indicating the type of LexicalUnit.
    • getNextLexicalUnit

      public LexicalUnit getNextLexicalUnit()
      Description copied from interface: LexicalUnit

      getNextLexicalUnit.

      Specified by:
      getNextLexicalUnit in interface LexicalUnit
      Returns:
      the next value or null if any.
    • getPreviousLexicalUnit

      public LexicalUnit getPreviousLexicalUnit()
      Description copied from interface: LexicalUnit

      getPreviousLexicalUnit.

      Specified by:
      getPreviousLexicalUnit in interface LexicalUnit
      Returns:
      the previous value or null if any.
    • getIntegerValue

      public int getIntegerValue()
      Description copied from interface: LexicalUnit

      getIntegerValue.

      Specified by:
      getIntegerValue in interface LexicalUnit
      Returns:
      the integer value.
    • getDoubleValue

      public double getDoubleValue()
      Description copied from interface: LexicalUnit

      getDoubleValue.

      Specified by:
      getDoubleValue in interface LexicalUnit
      Returns:
      the double value.
    • getDimensionUnitText

      public String getDimensionUnitText()
      Description copied from interface: LexicalUnit

      getDimensionUnitText.

      Specified by:
      getDimensionUnitText in interface LexicalUnit
      Returns:
      the string representation of the unit.
    • getFunctionName

      public String getFunctionName()
      Description copied from interface: LexicalUnit

      getFunctionName.

      Specified by:
      getFunctionName in interface LexicalUnit
      Returns:
      the name of the function.
    • getParameters

      public LexicalUnit getParameters()
      Description copied from interface: LexicalUnit

      getParameters.

      Specified by:
      getParameters in interface LexicalUnit
      Returns:
      the function parameters including operators (like the comma).
    • getStringValue

      public String getStringValue()
      Description copied from interface: LexicalUnit

      getStringValue.

      Specified by:
      getStringValue in interface LexicalUnit
      Returns:
      the string value.
    • getSubValues

      public LexicalUnit getSubValues()
      Description copied from interface: LexicalUnit

      getSubValues.

      Specified by:
      getSubValues in interface LexicalUnit
      Returns:
      a list of values inside the sub expression.
    • getCssText

      public String getCssText()
      Returns:
      the current css text
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toDebugString

      public String toDebugString()
      Returns:
      a string helping to debug
    • createNumber

      public static LexicalUnit createNumber(LexicalUnit prev, int i)
      Parameters:
      prev - the previous LexicalUnit
      i - the integer value
      Returns:
      lexical unit with type integer
    • createNumber

      public static LexicalUnit createNumber(LexicalUnit prev, double d)
      Parameters:
      prev - the previous LexicalUnit
      d - the double value
      Returns:
      lexical unit with type real
    • createPercentage

      public static LexicalUnit createPercentage(LexicalUnit prev, double d)
      Parameters:
      prev - the previous LexicalUnit
      d - the double value
      Returns:
      lexical unit with type percent
    • createPixel

      public static LexicalUnit createPixel(LexicalUnit prev, double d)
      Parameters:
      prev - the previous LexicalUnit
      d - the double value
      Returns:
      lexical unit with type pixel
    • createCentimeter

      public static LexicalUnit createCentimeter(LexicalUnit prev, double d)
      Parameters:
      prev - the previous LexicalUnit
      d - the double value
      Returns:
      lexical unit with type centimeter
    • createMillimeter

      public static LexicalUnit createMillimeter(LexicalUnit prev, double d)
      Parameters:
      prev - the previous LexicalUnit
      d - the double value
      Returns:
      lexical unit with type millimeter
    • createInch

      public static LexicalUnit createInch(LexicalUnit prev, double d)
      Parameters:
      prev - the previous LexicalUnit
      d - the double value
      Returns:
      lexical unit with type inch
    • createPoint

      public static LexicalUnit createPoint(LexicalUnit prev, double d)
      Parameters:
      prev - the previous LexicalUnit
      d - the double value
      Returns:
      lexical unit with type point
    • createPica

      public static LexicalUnit createPica(LexicalUnit prev, double d)
      Parameters:
      prev - the previous LexicalUnit
      d - the double value
      Returns:
      lexical unit with type pica
    • createQuater

      public static LexicalUnit createQuater(LexicalUnit prev, double d)
      Parameters:
      prev - the previous LexicalUnit
      d - the double value
      Returns:
      lexical unit with type quater
    • createEm

      public static LexicalUnit createEm(LexicalUnit prev, double d)
      Parameters:
      prev - the previous LexicalUnit
      d - the double value
      Returns:
      lexical unit with type em
    • createRem

      public static LexicalUnit createRem(LexicalUnit prev, double d)
      Parameters:
      prev - the previous LexicalUnit
      d - the double value
      Returns:
      lexical unit with type rem
    • createEx

      public static LexicalUnit createEx(LexicalUnit prev, double d)
      Parameters:
      prev - the previous LexicalUnit
      d - the double value
      Returns:
      lexical unit with type ex
    • createCh

      public static LexicalUnit createCh(LexicalUnit prev, double d)
      Parameters:
      prev - the previous LexicalUnit
      d - the double value
      Returns:
      lexical unit with type ch
    • createVw

      public static LexicalUnit createVw(LexicalUnit prev, double d)
      Parameters:
      prev - the previous LexicalUnit
      d - the double value
      Returns:
      lexical unit with type vw
    • createVh

      public static LexicalUnit createVh(LexicalUnit prev, double d)
      Parameters:
      prev - the previous LexicalUnit
      d - the double value
      Returns:
      lexical unit with type vh
    • createVMin

      public static LexicalUnit createVMin(LexicalUnit prev, double d)
      Parameters:
      prev - the previous LexicalUnit
      d - the double value
      Returns:
      lexical unit with type vmin
    • createVMax

      public static LexicalUnit createVMax(LexicalUnit prev, double d)
      Parameters:
      prev - the previous LexicalUnit
      d - the double value
      Returns:
      lexical unit with type vmax
    • createDegree

      public static LexicalUnit createDegree(LexicalUnit prev, double d)
      Parameters:
      prev - the previous LexicalUnit
      d - the double value
      Returns:
      lexical unit with type degree
    • createRadian

      public static LexicalUnit createRadian(LexicalUnit prev, double d)
      Parameters:
      prev - the previous LexicalUnit
      d - the double value
      Returns:
      lexical unit with type radian
    • createGradian

      public static LexicalUnit createGradian(LexicalUnit prev, double d)
      Parameters:
      prev - the previous LexicalUnit
      d - the double value
      Returns:
      lexical unit with type gradian
    • createTurn

      public static LexicalUnit createTurn(LexicalUnit prev, double d)
      Parameters:
      prev - the previous LexicalUnit
      d - the double value
      Returns:
      lexical unit with type turn
    • createMillisecond

      public static LexicalUnit createMillisecond(LexicalUnit prev, double d)
      Parameters:
      prev - the previous LexicalUnit
      d - the double value
      Returns:
      lexical unit with type millisecond
    • createSecond

      public static LexicalUnit createSecond(LexicalUnit prev, double d)
      Parameters:
      prev - the previous LexicalUnit
      d - the double value
      Returns:
      lexical unit with type second
    • createHertz

      public static LexicalUnit createHertz(LexicalUnit prev, double d)
      Parameters:
      prev - the previous LexicalUnit
      d - the double value
      Returns:
      lexical unit with type hertz
    • createDimension

      public static LexicalUnit createDimension(LexicalUnit prev, double d, String dim)
      Parameters:
      prev - the previous LexicalUnit
      d - the double value
      dim - the dimension
      Returns:
      lexical unit with type dimension
    • createKiloHertz

      public static LexicalUnit createKiloHertz(LexicalUnit prev, double d)
      Parameters:
      prev - the previous LexicalUnit
      d - the double value
      Returns:
      lexical unit with type kilohertz
    • createCounter

      public static LexicalUnit createCounter(LexicalUnit prev, LexicalUnit params)
      Parameters:
      prev - the previous LexicalUnit
      params - the params
      Returns:
      lexical unit with type counter
    • createCounters

      public static LexicalUnit createCounters(LexicalUnit prev, LexicalUnit params)
      Parameters:
      prev - the previous LexicalUnit
      params - the params
      Returns:
      lexical unit with type counters
    • createAttr

      public static LexicalUnit createAttr(LexicalUnit prev, String value)
      Parameters:
      prev - the previous LexicalUnit
      value - the value
      Returns:
      lexical unit with type attr
    • createRect

      public static LexicalUnit createRect(LexicalUnit prev, LexicalUnit params)
      Parameters:
      prev - the previous LexicalUnit
      params - the params
      Returns:
      lexical unit with type rect
    • createRgbColor

      public static LexicalUnit createRgbColor(LexicalUnit prev, String funct, LexicalUnit params)
      Parameters:
      prev - the previous LexicalUnit
      funct - the name rgb or rgba
      params - the params
      Returns:
      lexical unit with type rgb color
    • createHslColor

      public static LexicalUnit createHslColor(LexicalUnit prev, String funct, LexicalUnit params)
      Parameters:
      prev - the previous LexicalUnit
      funct - the name hsl or hsla
      params - the params
      Returns:
      lexical unit with type hsl color
    • createHwbColor

      public static LexicalUnit createHwbColor(LexicalUnit prev, String funct, LexicalUnit params)
      Parameters:
      prev - the previous LexicalUnit
      funct - the name hwb
      params - the params
      Returns:
      lexical unit with type hwb color
    • createLabColor

      public static LexicalUnit createLabColor(LexicalUnit prev, String funct, LexicalUnit params)
      Parameters:
      prev - the previous LexicalUnit
      funct - the name lab
      params - the params
      Returns:
      lexical unit with type lab color
    • createLchColor

      public static LexicalUnit createLchColor(LexicalUnit prev, String funct, LexicalUnit params)
      Parameters:
      prev - the previous LexicalUnit
      funct - the name lch
      params - the params
      Returns:
      lexical unit with type lch color
    • createNone

      public static LexicalUnit createNone(LexicalUnit prev)
      Parameters:
      prev - the previous LexicalUnit
      Returns:
      lexical unit with type rgb color
    • createCalc

      public static LexicalUnit createCalc(LexicalUnit prev, LexicalUnit params)
      Parameters:
      prev - the previous LexicalUnit
      params - the params
      Returns:
      lexical unit with type calc
    • createFunction

      public static LexicalUnit createFunction(LexicalUnit prev, String name, LexicalUnit params)
      Parameters:
      prev - the previous LexicalUnit
      name - the name
      params - the params
      Returns:
      lexical unit with type function
    • createString

      public static LexicalUnit createString(LexicalUnit prev, String value)
      Parameters:
      prev - the previous LexicalUnit
      value - the value
      Returns:
      lexical unit with type string
    • createIdent

      public static LexicalUnit createIdent(LexicalUnit prev, String value)
      Parameters:
      prev - the previous LexicalUnit
      value - the value
      Returns:
      lexical unit with type ident
    • createURI

      public static LexicalUnit createURI(LexicalUnit prev, String value)
      Parameters:
      prev - the previous LexicalUnit
      value - the value
      Returns:
      lexical unit with type uri
    • createComma

      public static LexicalUnit createComma(LexicalUnit prev)
      Parameters:
      prev - the previous LexicalUnit
      Returns:
      lexical unit with type comma
    • createInherit

      public static LexicalUnit createInherit(LexicalUnit prev)
      Parameters:
      prev - the previous LexicalUnit
      Returns:
      lexical unit with type comma
    • createSlash

      public static LexicalUnit createSlash(LexicalUnit prev)
      Parameters:
      prev - the previous LexicalUnit
      Returns:
      lexical unit with type slash
    • createPlus

      public static LexicalUnit createPlus(LexicalUnit prev)
      Parameters:
      prev - the previous LexicalUnit
      Returns:
      lexical unit with type plus
    • createMinus

      public static LexicalUnit createMinus(LexicalUnit prev)
      Parameters:
      prev - the previous LexicalUnit
      Returns:
      lexical unit with type minus
    • createMultiply

      public static LexicalUnit createMultiply(LexicalUnit prev)
      Parameters:
      prev - the previous LexicalUnit
      Returns:
      lexical unit with type multiply
    • createDivide

      public static LexicalUnit createDivide(LexicalUnit prev)
      Parameters:
      prev - the previous LexicalUnit
      Returns:
      lexical unit with type slash