Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.steadystate.css.parser
Class LexicalUnitImpl  view LexicalUnitImpl download LexicalUnitImpl.java

java.lang.Object
  extended bycom.steadystate.css.parser.LexicalUnitImpl
All Implemented Interfaces:
org.w3c.css.sac.LexicalUnit, java.io.Serializable

public class LexicalUnitImpl
extends java.lang.Object
implements org.w3c.css.sac.LexicalUnit, java.io.Serializable

Version:
$Release$

Field Summary
private  java.lang.String _dimension
           
private  float _floatVal
           
private  java.lang.String _function
           
private  org.w3c.css.sac.LexicalUnit _next
           
private  org.w3c.css.sac.LexicalUnit _params
           
private  org.w3c.css.sac.LexicalUnit _prev
           
private  java.lang.String _stringVal
           
private  short _type
           
 
Fields inherited from interface org.w3c.css.sac.LexicalUnit
SAC_ATTR, SAC_CENTIMETER, SAC_COUNTER_FUNCTION, SAC_COUNTERS_FUNCTION, SAC_DEGREE, SAC_DIMENSION, SAC_EM, SAC_EX, SAC_FUNCTION, SAC_GRADIAN, SAC_HERTZ, SAC_IDENT, SAC_INCH, SAC_INHERIT, SAC_INTEGER, SAC_KILOHERTZ, SAC_MILLIMETER, SAC_MILLISECOND, SAC_OPERATOR_COMMA, SAC_OPERATOR_EXP, SAC_OPERATOR_GE, SAC_OPERATOR_GT, SAC_OPERATOR_LE, SAC_OPERATOR_LT, SAC_OPERATOR_MINUS, SAC_OPERATOR_MOD, SAC_OPERATOR_MULTIPLY, SAC_OPERATOR_PLUS, SAC_OPERATOR_SLASH, SAC_OPERATOR_TILDE, SAC_PERCENTAGE, SAC_PICA, SAC_PIXEL, SAC_POINT, SAC_RADIAN, SAC_REAL, SAC_RECT_FUNCTION, SAC_RGBCOLOR, SAC_SECOND, SAC_STRING_VALUE, SAC_SUB_EXPRESSION, SAC_UNICODERANGE, SAC_URI
 
Constructor Summary
protected LexicalUnitImpl(org.w3c.css.sac.LexicalUnit previous, int value)
          Integer
protected LexicalUnitImpl(org.w3c.css.sac.LexicalUnit previous, short type)
           
protected LexicalUnitImpl(org.w3c.css.sac.LexicalUnit previous, short type, float value)
          Dimension
protected LexicalUnitImpl(org.w3c.css.sac.LexicalUnit previous, short type, java.lang.String value)
          String
protected LexicalUnitImpl(org.w3c.css.sac.LexicalUnit previous, short type, java.lang.String dimension, float value)
          Unknown dimension
protected LexicalUnitImpl(org.w3c.css.sac.LexicalUnit previous, short type, java.lang.String name, org.w3c.css.sac.LexicalUnit params)
          Function
 
Method Summary
private  void appendParams(java.lang.StringBuffer sb, org.w3c.css.sac.LexicalUnit first)
           
static org.w3c.css.sac.LexicalUnit createAttr(org.w3c.css.sac.LexicalUnit prev, org.w3c.css.sac.LexicalUnit params)
           
static org.w3c.css.sac.LexicalUnit createCentimeter(org.w3c.css.sac.LexicalUnit prev, float f)
           
static org.w3c.css.sac.LexicalUnit createComma(org.w3c.css.sac.LexicalUnit prev)
           
static org.w3c.css.sac.LexicalUnit createCounter(org.w3c.css.sac.LexicalUnit prev, org.w3c.css.sac.LexicalUnit params)
           
static org.w3c.css.sac.LexicalUnit createCounters(org.w3c.css.sac.LexicalUnit prev, org.w3c.css.sac.LexicalUnit params)
           
static org.w3c.css.sac.LexicalUnit createDegree(org.w3c.css.sac.LexicalUnit prev, float f)
           
static org.w3c.css.sac.LexicalUnit createDimension(org.w3c.css.sac.LexicalUnit prev, float f, java.lang.String dim)
           
static org.w3c.css.sac.LexicalUnit createEm(org.w3c.css.sac.LexicalUnit prev, float f)
           
static org.w3c.css.sac.LexicalUnit createEx(org.w3c.css.sac.LexicalUnit prev, float f)
           
static org.w3c.css.sac.LexicalUnit createFunction(org.w3c.css.sac.LexicalUnit prev, java.lang.String name, org.w3c.css.sac.LexicalUnit params)
           
static org.w3c.css.sac.LexicalUnit createGradian(org.w3c.css.sac.LexicalUnit prev, float f)
           
static org.w3c.css.sac.LexicalUnit createHertz(org.w3c.css.sac.LexicalUnit prev, float f)
           
static org.w3c.css.sac.LexicalUnit createIdent(org.w3c.css.sac.LexicalUnit prev, java.lang.String value)
           
static org.w3c.css.sac.LexicalUnit createInch(org.w3c.css.sac.LexicalUnit prev, float f)
           
static org.w3c.css.sac.LexicalUnit createKiloHertz(org.w3c.css.sac.LexicalUnit prev, float f)
           
static org.w3c.css.sac.LexicalUnit createMillimeter(org.w3c.css.sac.LexicalUnit prev, float f)
           
static org.w3c.css.sac.LexicalUnit createMillisecond(org.w3c.css.sac.LexicalUnit prev, float f)
           
static org.w3c.css.sac.LexicalUnit createNumber(org.w3c.css.sac.LexicalUnit prev, float f)
           
static org.w3c.css.sac.LexicalUnit createPercentage(org.w3c.css.sac.LexicalUnit prev, float f)
           
static org.w3c.css.sac.LexicalUnit createPica(org.w3c.css.sac.LexicalUnit prev, float f)
           
static org.w3c.css.sac.LexicalUnit createPixel(org.w3c.css.sac.LexicalUnit prev, float f)
           
static org.w3c.css.sac.LexicalUnit createPoint(org.w3c.css.sac.LexicalUnit prev, float f)
           
static org.w3c.css.sac.LexicalUnit createRadian(org.w3c.css.sac.LexicalUnit prev, float f)
           
static org.w3c.css.sac.LexicalUnit createRect(org.w3c.css.sac.LexicalUnit prev, org.w3c.css.sac.LexicalUnit params)
           
static org.w3c.css.sac.LexicalUnit createRgbColor(org.w3c.css.sac.LexicalUnit prev, org.w3c.css.sac.LexicalUnit params)
           
static org.w3c.css.sac.LexicalUnit createSecond(org.w3c.css.sac.LexicalUnit prev, float f)
           
static org.w3c.css.sac.LexicalUnit createString(org.w3c.css.sac.LexicalUnit prev, java.lang.String value)
           
static org.w3c.css.sac.LexicalUnit createURI(org.w3c.css.sac.LexicalUnit prev, java.lang.String value)
           
 java.lang.String getDimensionUnitText()
          Returns the string representation of the unit.
 float getFloatValue()
          Returns the float value.
 java.lang.String getFunctionName()
          Returns the name of the function.
 int getIntegerValue()
          Returns the integer value.
 short getLexicalUnitType()
          An integer indicating the type of LexicalUnit.
 org.w3c.css.sac.LexicalUnit getNextLexicalUnit()
          Returns the next value or null if any.
 org.w3c.css.sac.LexicalUnit getParameters()
          The function parameters including operators (like the comma).
 org.w3c.css.sac.LexicalUnit getPreviousLexicalUnit()
          Returns the previous value or null if any.
 java.lang.String getStringValue()
          Returns the string value.
 org.w3c.css.sac.LexicalUnit getSubValues()
          Returns a list of values inside the sub expression.
 java.lang.String toDebugString()
           
 java.lang.String toString()
          Convert this Object to a human-readable String.
private  java.lang.String trimFloat(float f)
           
private static float value(char op, java.lang.String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_type

private short _type

_next

private org.w3c.css.sac.LexicalUnit _next

_prev

private org.w3c.css.sac.LexicalUnit _prev

_floatVal

private float _floatVal

_dimension

private java.lang.String _dimension

_function

private java.lang.String _function

_params

private org.w3c.css.sac.LexicalUnit _params

_stringVal

private java.lang.String _stringVal
Constructor Detail

LexicalUnitImpl

protected LexicalUnitImpl(org.w3c.css.sac.LexicalUnit previous,
                          short type)

LexicalUnitImpl

protected LexicalUnitImpl(org.w3c.css.sac.LexicalUnit previous,
                          int value)
Integer


LexicalUnitImpl

protected LexicalUnitImpl(org.w3c.css.sac.LexicalUnit previous,
                          short type,
                          float value)
Dimension


LexicalUnitImpl

protected LexicalUnitImpl(org.w3c.css.sac.LexicalUnit previous,
                          short type,
                          java.lang.String dimension,
                          float value)
Unknown dimension


LexicalUnitImpl

protected LexicalUnitImpl(org.w3c.css.sac.LexicalUnit previous,
                          short type,
                          java.lang.String value)
String


LexicalUnitImpl

protected LexicalUnitImpl(org.w3c.css.sac.LexicalUnit previous,
                          short type,
                          java.lang.String name,
                          org.w3c.css.sac.LexicalUnit params)
Function

Method Detail

getLexicalUnitType

public short getLexicalUnitType()
Description copied from interface: org.w3c.css.sac.LexicalUnit
An integer indicating the type of LexicalUnit.

Specified by:
getLexicalUnitType in interface org.w3c.css.sac.LexicalUnit

getNextLexicalUnit

public org.w3c.css.sac.LexicalUnit getNextLexicalUnit()
Description copied from interface: org.w3c.css.sac.LexicalUnit
Returns the next value or null if any.

Specified by:
getNextLexicalUnit in interface org.w3c.css.sac.LexicalUnit

getPreviousLexicalUnit

public org.w3c.css.sac.LexicalUnit getPreviousLexicalUnit()
Description copied from interface: org.w3c.css.sac.LexicalUnit
Returns the previous value or null if any.

Specified by:
getPreviousLexicalUnit in interface org.w3c.css.sac.LexicalUnit

getIntegerValue

public int getIntegerValue()
Description copied from interface: org.w3c.css.sac.LexicalUnit
Returns the integer value.

Specified by:
getIntegerValue in interface org.w3c.css.sac.LexicalUnit

getFloatValue

public float getFloatValue()
Description copied from interface: org.w3c.css.sac.LexicalUnit
Returns the float value.

If the type of LexicalUnit is one of SAC_DEGREE, SAC_GRADIAN, SAC_RADIAN, SAC_MILLISECOND, SAC_SECOND, SAC_HERTZ or SAC_KILOHERTZ, the value can never be negative.

Specified by:
getFloatValue in interface org.w3c.css.sac.LexicalUnit

getDimensionUnitText

public java.lang.String getDimensionUnitText()
Description copied from interface: org.w3c.css.sac.LexicalUnit
Returns the string representation of the unit.

if this lexical unit represents a float, the dimension is an empty string.

Specified by:
getDimensionUnitText in interface org.w3c.css.sac.LexicalUnit

getFunctionName

public java.lang.String getFunctionName()
Description copied from interface: org.w3c.css.sac.LexicalUnit
Returns the name of the function.

Specified by:
getFunctionName in interface org.w3c.css.sac.LexicalUnit

getParameters

public org.w3c.css.sac.LexicalUnit getParameters()
Description copied from interface: org.w3c.css.sac.LexicalUnit
The function parameters including operators (like the comma). #000 is converted to rgb(0, 0, 0) can return null if SAC_FUNCTION.

Specified by:
getParameters in interface org.w3c.css.sac.LexicalUnit

getStringValue

public java.lang.String getStringValue()
Description copied from interface: org.w3c.css.sac.LexicalUnit
Returns the string value.

If the type is SAC_URI, the return value doesn't contain uri(....) or quotes.

If the type is SAC_ATTR, the return value doesn't contain attr(....).

Specified by:
getStringValue in interface org.w3c.css.sac.LexicalUnit

getSubValues

public org.w3c.css.sac.LexicalUnit getSubValues()
Description copied from interface: org.w3c.css.sac.LexicalUnit
Returns a list of values inside the sub expression.

Specified by:
getSubValues in interface org.w3c.css.sac.LexicalUnit

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


toDebugString

public java.lang.String toDebugString()

appendParams

private void appendParams(java.lang.StringBuffer sb,
                          org.w3c.css.sac.LexicalUnit first)

trimFloat

private java.lang.String trimFloat(float f)

value

private static float value(char op,
                           java.lang.String s)

createNumber

public static org.w3c.css.sac.LexicalUnit createNumber(org.w3c.css.sac.LexicalUnit prev,
                                                       float f)

createPercentage

public static org.w3c.css.sac.LexicalUnit createPercentage(org.w3c.css.sac.LexicalUnit prev,
                                                           float f)

createPixel

public static org.w3c.css.sac.LexicalUnit createPixel(org.w3c.css.sac.LexicalUnit prev,
                                                      float f)

createCentimeter

public static org.w3c.css.sac.LexicalUnit createCentimeter(org.w3c.css.sac.LexicalUnit prev,
                                                           float f)

createMillimeter

public static org.w3c.css.sac.LexicalUnit createMillimeter(org.w3c.css.sac.LexicalUnit prev,
                                                           float f)

createInch

public static org.w3c.css.sac.LexicalUnit createInch(org.w3c.css.sac.LexicalUnit prev,
                                                     float f)

createPoint

public static org.w3c.css.sac.LexicalUnit createPoint(org.w3c.css.sac.LexicalUnit prev,
                                                      float f)

createPica

public static org.w3c.css.sac.LexicalUnit createPica(org.w3c.css.sac.LexicalUnit prev,
                                                     float f)

createEm

public static org.w3c.css.sac.LexicalUnit createEm(org.w3c.css.sac.LexicalUnit prev,
                                                   float f)

createEx

public static org.w3c.css.sac.LexicalUnit createEx(org.w3c.css.sac.LexicalUnit prev,
                                                   float f)

createDegree

public static org.w3c.css.sac.LexicalUnit createDegree(org.w3c.css.sac.LexicalUnit prev,
                                                       float f)

createRadian

public static org.w3c.css.sac.LexicalUnit createRadian(org.w3c.css.sac.LexicalUnit prev,
                                                       float f)

createGradian

public static org.w3c.css.sac.LexicalUnit createGradian(org.w3c.css.sac.LexicalUnit prev,
                                                        float f)

createMillisecond

public static org.w3c.css.sac.LexicalUnit createMillisecond(org.w3c.css.sac.LexicalUnit prev,
                                                            float f)

createSecond

public static org.w3c.css.sac.LexicalUnit createSecond(org.w3c.css.sac.LexicalUnit prev,
                                                       float f)

createHertz

public static org.w3c.css.sac.LexicalUnit createHertz(org.w3c.css.sac.LexicalUnit prev,
                                                      float f)

createDimension

public static org.w3c.css.sac.LexicalUnit createDimension(org.w3c.css.sac.LexicalUnit prev,
                                                          float f,
                                                          java.lang.String dim)

createKiloHertz

public static org.w3c.css.sac.LexicalUnit createKiloHertz(org.w3c.css.sac.LexicalUnit prev,
                                                          float f)

createCounter

public static org.w3c.css.sac.LexicalUnit createCounter(org.w3c.css.sac.LexicalUnit prev,
                                                        org.w3c.css.sac.LexicalUnit params)

createCounters

public static org.w3c.css.sac.LexicalUnit createCounters(org.w3c.css.sac.LexicalUnit prev,
                                                         org.w3c.css.sac.LexicalUnit params)

createAttr

public static org.w3c.css.sac.LexicalUnit createAttr(org.w3c.css.sac.LexicalUnit prev,
                                                     org.w3c.css.sac.LexicalUnit params)

createRect

public static org.w3c.css.sac.LexicalUnit createRect(org.w3c.css.sac.LexicalUnit prev,
                                                     org.w3c.css.sac.LexicalUnit params)

createRgbColor

public static org.w3c.css.sac.LexicalUnit createRgbColor(org.w3c.css.sac.LexicalUnit prev,
                                                         org.w3c.css.sac.LexicalUnit params)

createFunction

public static org.w3c.css.sac.LexicalUnit createFunction(org.w3c.css.sac.LexicalUnit prev,
                                                         java.lang.String name,
                                                         org.w3c.css.sac.LexicalUnit params)

createString

public static org.w3c.css.sac.LexicalUnit createString(org.w3c.css.sac.LexicalUnit prev,
                                                       java.lang.String value)

createIdent

public static org.w3c.css.sac.LexicalUnit createIdent(org.w3c.css.sac.LexicalUnit prev,
                                                      java.lang.String value)

createURI

public static org.w3c.css.sac.LexicalUnit createURI(org.w3c.css.sac.LexicalUnit prev,
                                                    java.lang.String value)

createComma

public static org.w3c.css.sac.LexicalUnit createComma(org.w3c.css.sac.LexicalUnit prev)