Package org.htmlunit.cssparser.parser
Class LexicalUnitImpl
- java.lang.Object
-
- org.htmlunit.cssparser.parser.AbstractLocatable
-
- org.htmlunit.cssparser.parser.LexicalUnitImpl
-
- All Implemented Interfaces:
java.io.Serializable
,LexicalUnit
,Locatable
public class LexicalUnitImpl extends AbstractLocatable implements LexicalUnit, java.io.Serializable
Implementation ofLexicalUnit
.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.htmlunit.cssparser.parser.LexicalUnit
LexicalUnit.LexicalUnitType
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
dimension_
private double
doubleValue_
private java.lang.String
functionName_
private LexicalUnit.LexicalUnitType
lexicalUnitType_
private LexicalUnit
nextLexicalUnit_
private LexicalUnit
parameters_
private LexicalUnit
previousLexicalUnit_
private java.lang.String
stringValue_
private java.lang.String
toString_
cache
-
Constructor Summary
Constructors Modifier Constructor Description protected
LexicalUnitImpl(LexicalUnit previous, int value)
Integer.LexicalUnitImpl(LexicalUnit previous, LexicalUnit.LexicalUnitType type)
Ctor.protected
LexicalUnitImpl(LexicalUnit previous, LexicalUnit.LexicalUnitType type, double value)
Dimension.LexicalUnitImpl(LexicalUnit previous, LexicalUnit.LexicalUnitType type, java.lang.String value)
String.protected
LexicalUnitImpl(LexicalUnit previous, LexicalUnit.LexicalUnitType type, java.lang.String dimension, double value)
Unknown dimension.protected
LexicalUnitImpl(LexicalUnit previous, LexicalUnit.LexicalUnitType type, java.lang.String name, java.lang.String stringValue)
Function.protected
LexicalUnitImpl(LexicalUnit previous, LexicalUnit.LexicalUnitType type, java.lang.String name, LexicalUnit params)
Function.
-
Method Summary
-
Methods inherited from class org.htmlunit.cssparser.parser.AbstractLocatable
getLocator, setLocator
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.htmlunit.cssparser.parser.LexicalUnit
getLocator, setLocator
-
-
-
-
Field Detail
-
lexicalUnitType_
private final LexicalUnit.LexicalUnitType lexicalUnitType_
-
nextLexicalUnit_
private LexicalUnit nextLexicalUnit_
-
previousLexicalUnit_
private LexicalUnit previousLexicalUnit_
-
doubleValue_
private double doubleValue_
-
dimension_
private java.lang.String dimension_
-
functionName_
private java.lang.String functionName_
-
parameters_
private LexicalUnit parameters_
-
stringValue_
private java.lang.String stringValue_
-
toString_
private transient java.lang.String toString_
cache
-
-
Constructor Detail
-
LexicalUnitImpl
public LexicalUnitImpl(LexicalUnit previous, LexicalUnit.LexicalUnitType type)
Ctor.- Parameters:
previous
- the previous LexicalUnittype
- the LexicalUnitType
-
LexicalUnitImpl
protected LexicalUnitImpl(LexicalUnit previous, int value)
Integer.- Parameters:
previous
- the previous LexicalUnitvalue
- the int value
-
LexicalUnitImpl
protected LexicalUnitImpl(LexicalUnit previous, LexicalUnit.LexicalUnitType type, double value)
Dimension.- Parameters:
previous
- the previous LexicalUnittype
- the LexicalUnitTypevalue
- the double value
-
LexicalUnitImpl
protected LexicalUnitImpl(LexicalUnit previous, LexicalUnit.LexicalUnitType type, java.lang.String dimension, double value)
Unknown dimension.- Parameters:
previous
- the previous LexicalUnittype
- the LexicalUnitTypedimension
- the dimensionvalue
- the double value
-
LexicalUnitImpl
public LexicalUnitImpl(LexicalUnit previous, LexicalUnit.LexicalUnitType type, java.lang.String value)
String.- Parameters:
previous
- the previous LexicalUnittype
- the LexicalUnitTypevalue
- the string value
-
LexicalUnitImpl
protected LexicalUnitImpl(LexicalUnit previous, LexicalUnit.LexicalUnitType type, java.lang.String name, LexicalUnit params)
Function.- Parameters:
previous
- the previous LexicalUnittype
- the LexicalUnitTypename
- the nameparams
- the parameter LexicalUnit
-
LexicalUnitImpl
protected LexicalUnitImpl(LexicalUnit previous, LexicalUnit.LexicalUnitType type, java.lang.String name, java.lang.String stringValue)
Function.- Parameters:
previous
- the previous LexicalUnittype
- the LexicalUnitTypename
- the namestringValue
- the string value
-
-
Method Detail
-
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 java.lang.String getDimension()
- Returns:
- the dimension
-
setDimension
public void setDimension(java.lang.String dimension)
- Parameters:
dimension
- the new dimension
-
setFunctionName
public void setFunctionName(java.lang.String function)
- Parameters:
function
- the function name
-
setParameters
public void setParameters(LexicalUnit params)
- Parameters:
params
- the parameter LexicalUnit
-
setStringValue
public void setStringValue(java.lang.String stringVal)
- Parameters:
stringVal
- the string value
-
getLexicalUnitType
public LexicalUnit.LexicalUnitType getLexicalUnitType()
- Specified by:
getLexicalUnitType
in interfaceLexicalUnit
- Returns:
- an integer indicating the type of
LexicalUnit
.
-
getNextLexicalUnit
public LexicalUnit getNextLexicalUnit()
- Specified by:
getNextLexicalUnit
in interfaceLexicalUnit
- Returns:
- the next value or
null
if any.
-
getPreviousLexicalUnit
public LexicalUnit getPreviousLexicalUnit()
- Specified by:
getPreviousLexicalUnit
in interfaceLexicalUnit
- Returns:
- the previous value or
null
if any.
-
getIntegerValue
public int getIntegerValue()
- Specified by:
getIntegerValue
in interfaceLexicalUnit
- Returns:
- the integer value.
-
getDoubleValue
public double getDoubleValue()
- Specified by:
getDoubleValue
in interfaceLexicalUnit
- Returns:
- the double value.
-
getDimensionUnitText
public java.lang.String getDimensionUnitText()
- Specified by:
getDimensionUnitText
in interfaceLexicalUnit
- Returns:
- the string representation of the unit.
-
getFunctionName
public java.lang.String getFunctionName()
- Specified by:
getFunctionName
in interfaceLexicalUnit
- Returns:
- the name of the function.
-
getParameters
public LexicalUnit getParameters()
- Specified by:
getParameters
in interfaceLexicalUnit
- Returns:
- the function parameters including operators (like the comma).
-
getStringValue
public java.lang.String getStringValue()
- Specified by:
getStringValue
in interfaceLexicalUnit
- Returns:
- the string value.
-
getSubValues
public LexicalUnit getSubValues()
- Specified by:
getSubValues
in interfaceLexicalUnit
- Returns:
- a list of values inside the sub expression.
-
getCssText
public java.lang.String getCssText()
- Returns:
- the current css text
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
toDebugString
public java.lang.String toDebugString()
- Returns:
- a string helping to debug
-
appendParams
private void appendParams(java.lang.StringBuilder sb)
-
getTrimedDoubleValue
private java.lang.String getTrimedDoubleValue()
-
createNumber
public static LexicalUnit createNumber(LexicalUnit prev, int i)
- Parameters:
prev
- the previous LexicalUniti
- the integer value- Returns:
- lexical unit with type integer
-
createNumber
public static LexicalUnit createNumber(LexicalUnit prev, double d)
- Parameters:
prev
- the previous LexicalUnitd
- the double value- Returns:
- lexical unit with type real
-
createPercentage
public static LexicalUnit createPercentage(LexicalUnit prev, double d)
- Parameters:
prev
- the previous LexicalUnitd
- the double value- Returns:
- lexical unit with type percent
-
createPixel
public static LexicalUnit createPixel(LexicalUnit prev, double d)
- Parameters:
prev
- the previous LexicalUnitd
- the double value- Returns:
- lexical unit with type pixel
-
createCentimeter
public static LexicalUnit createCentimeter(LexicalUnit prev, double d)
- Parameters:
prev
- the previous LexicalUnitd
- the double value- Returns:
- lexical unit with type centimeter
-
createMillimeter
public static LexicalUnit createMillimeter(LexicalUnit prev, double d)
- Parameters:
prev
- the previous LexicalUnitd
- the double value- Returns:
- lexical unit with type millimeter
-
createInch
public static LexicalUnit createInch(LexicalUnit prev, double d)
- Parameters:
prev
- the previous LexicalUnitd
- the double value- Returns:
- lexical unit with type inch
-
createPoint
public static LexicalUnit createPoint(LexicalUnit prev, double d)
- Parameters:
prev
- the previous LexicalUnitd
- the double value- Returns:
- lexical unit with type point
-
createPica
public static LexicalUnit createPica(LexicalUnit prev, double d)
- Parameters:
prev
- the previous LexicalUnitd
- the double value- Returns:
- lexical unit with type pica
-
createQuater
public static LexicalUnit createQuater(LexicalUnit prev, double d)
- Parameters:
prev
- the previous LexicalUnitd
- the double value- Returns:
- lexical unit with type quater
-
createEm
public static LexicalUnit createEm(LexicalUnit prev, double d)
- Parameters:
prev
- the previous LexicalUnitd
- the double value- Returns:
- lexical unit with type em
-
createRem
public static LexicalUnit createRem(LexicalUnit prev, double d)
- Parameters:
prev
- the previous LexicalUnitd
- the double value- Returns:
- lexical unit with type rem
-
createEx
public static LexicalUnit createEx(LexicalUnit prev, double d)
- Parameters:
prev
- the previous LexicalUnitd
- the double value- Returns:
- lexical unit with type ex
-
createCh
public static LexicalUnit createCh(LexicalUnit prev, double d)
- Parameters:
prev
- the previous LexicalUnitd
- the double value- Returns:
- lexical unit with type ch
-
createVw
public static LexicalUnit createVw(LexicalUnit prev, double d)
- Parameters:
prev
- the previous LexicalUnitd
- the double value- Returns:
- lexical unit with type vw
-
createVh
public static LexicalUnit createVh(LexicalUnit prev, double d)
- Parameters:
prev
- the previous LexicalUnitd
- the double value- Returns:
- lexical unit with type vh
-
createVMin
public static LexicalUnit createVMin(LexicalUnit prev, double d)
- Parameters:
prev
- the previous LexicalUnitd
- the double value- Returns:
- lexical unit with type vmin
-
createVMax
public static LexicalUnit createVMax(LexicalUnit prev, double d)
- Parameters:
prev
- the previous LexicalUnitd
- the double value- Returns:
- lexical unit with type vmax
-
createDegree
public static LexicalUnit createDegree(LexicalUnit prev, double d)
- Parameters:
prev
- the previous LexicalUnitd
- the double value- Returns:
- lexical unit with type degree
-
createRadian
public static LexicalUnit createRadian(LexicalUnit prev, double d)
- Parameters:
prev
- the previous LexicalUnitd
- the double value- Returns:
- lexical unit with type radian
-
createGradian
public static LexicalUnit createGradian(LexicalUnit prev, double d)
- Parameters:
prev
- the previous LexicalUnitd
- the double value- Returns:
- lexical unit with type gradian
-
createTurn
public static LexicalUnit createTurn(LexicalUnit prev, double d)
- Parameters:
prev
- the previous LexicalUnitd
- the double value- Returns:
- lexical unit with type turn
-
createMillisecond
public static LexicalUnit createMillisecond(LexicalUnit prev, double d)
- Parameters:
prev
- the previous LexicalUnitd
- the double value- Returns:
- lexical unit with type millisecond
-
createSecond
public static LexicalUnit createSecond(LexicalUnit prev, double d)
- Parameters:
prev
- the previous LexicalUnitd
- the double value- Returns:
- lexical unit with type second
-
createHertz
public static LexicalUnit createHertz(LexicalUnit prev, double d)
- Parameters:
prev
- the previous LexicalUnitd
- the double value- Returns:
- lexical unit with type hertz
-
createDimension
public static LexicalUnit createDimension(LexicalUnit prev, double d, java.lang.String dim)
- Parameters:
prev
- the previous LexicalUnitd
- the double valuedim
- the dimension- Returns:
- lexical unit with type dimension
-
createKiloHertz
public static LexicalUnit createKiloHertz(LexicalUnit prev, double d)
- Parameters:
prev
- the previous LexicalUnitd
- the double value- Returns:
- lexical unit with type kilohertz
-
createCounter
public static LexicalUnit createCounter(LexicalUnit prev, LexicalUnit params)
- Parameters:
prev
- the previous LexicalUnitparams
- the params- Returns:
- lexical unit with type counter
-
createCounters
public static LexicalUnit createCounters(LexicalUnit prev, LexicalUnit params)
- Parameters:
prev
- the previous LexicalUnitparams
- the params- Returns:
- lexical unit with type counters
-
createAttr
public static LexicalUnit createAttr(LexicalUnit prev, java.lang.String value)
- Parameters:
prev
- the previous LexicalUnitvalue
- the value- Returns:
- lexical unit with type attr
-
createRect
public static LexicalUnit createRect(LexicalUnit prev, LexicalUnit params)
- Parameters:
prev
- the previous LexicalUnitparams
- the params- Returns:
- lexical unit with type rect
-
createRgbColor
public static LexicalUnit createRgbColor(LexicalUnit prev, java.lang.String funct, LexicalUnit params)
- Parameters:
prev
- the previous LexicalUnitfunct
- the name rgb or rgbaparams
- the params- Returns:
- lexical unit with type rgb color
-
createHslColor
public static LexicalUnit createHslColor(LexicalUnit prev, java.lang.String funct, LexicalUnit params)
- Parameters:
prev
- the previous LexicalUnitfunct
- the name rgb or rgbaparams
- the params- Returns:
- lexical unit with type rgb color
-
createCalc
public static LexicalUnit createCalc(LexicalUnit prev, LexicalUnit params)
- Parameters:
prev
- the previous LexicalUnitparams
- the params- Returns:
- lexical unit with type calc
-
createFunction
public static LexicalUnit createFunction(LexicalUnit prev, java.lang.String name, LexicalUnit params)
- Parameters:
prev
- the previous LexicalUnitname
- the nameparams
- the params- Returns:
- lexical unit with type function
-
createString
public static LexicalUnit createString(LexicalUnit prev, java.lang.String value)
- Parameters:
prev
- the previous LexicalUnitvalue
- the value- Returns:
- lexical unit with type string
-
createIdent
public static LexicalUnit createIdent(LexicalUnit prev, java.lang.String value)
- Parameters:
prev
- the previous LexicalUnitvalue
- the value- Returns:
- lexical unit with type ident
-
createURI
public static LexicalUnit createURI(LexicalUnit prev, java.lang.String value)
- Parameters:
prev
- the previous LexicalUnitvalue
- 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
-
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
-
-