/** * Convert a LexicalUnit list into a List of Values. */ private static void extractValueOf(List<Value> accumulator, LexicalUnit value) { do { accumulator.add(valueOf(value)); value = value.getNextLexicalUnit(); } while (value != null); }
LexicalUnit red = colors; int r = getRgbComponentValue(red); LexicalUnit green = red.getNextLexicalUnit().getNextLexicalUnit(); int g = getRgbComponentValue(green); LexicalUnit blue = green.getNextLexicalUnit().getNextLexicalUnit(); int b = getRgbComponentValue(blue);
public static LexicalUnit parseComma( final LexicalUnit value ) { if ( value == null ) { return null; } LexicalUnit maybeComma = value.getNextLexicalUnit(); if ( maybeComma == null ) { return null; } if ( maybeComma.getLexicalUnitType() == LexicalUnit.SAC_OPERATOR_COMMA ) { return maybeComma.getNextLexicalUnit(); } return null; }
private void appendParams(final StringBuilder sb) { LexicalUnit l = parameters_; if (l != null) { sb.append(l.toString()); l = l.getNextLexicalUnit(); while (l != null) { if (l.getLexicalUnitType() != SAC_OPERATOR_COMMA) { sb.append(" "); } sb.append(l.toString()); l = l.getNextLexicalUnit(); } } }
private List<CSSValueImpl> getValues(final LexicalUnit value) { final List<CSSValueImpl> values = new ArrayList<CSSValueImpl>(); LexicalUnit lu = value; while (lu != null) { values.add(new CSSValueImpl(lu, true)); lu = lu.getNextLexicalUnit(); } return values; }
/** * Convert a LexicalUnit list into a List of Values. */ private static void extractValueOf(List<Value> accumulator, LexicalUnit value) { do { accumulator.add(valueOf(value)); value = value.getNextLexicalUnit(); } while (value != null); }
public CSSValueListImpl(LexicalUnit parsePropertyValue) { values = new ArrayList<CSSValue>(); LexicalUnit unit = parsePropertyValue; while(unit != null) { values.add(CSSValueFactory.newPrimitiveValue(unit)); unit = unit.getNextLexicalUnit(); } }
/** * Convert a LexicalUnit list into a List of Values. */ private static void extractValueOf(List<Value> accumulator, LexicalUnit value) { do { accumulator.add(valueOf(value)); value = value.getNextLexicalUnit(); } while (value != null); }
public RGBColorImpl(LexicalUnit lexicalUnit) { LexicalUnit nextUnit = lexicalUnit.getParameters(); red = new Measure(nextUnit); nextUnit = nextUnit.getNextLexicalUnit().getNextLexicalUnit(); green = new Measure(nextUnit); nextUnit = nextUnit.getNextLexicalUnit().getNextLexicalUnit(); blue = new Measure(nextUnit); }
private static float getAmountValue(LexicalUnitImpl color) { LexicalUnit next = color.getNextLexicalUnit(); float amount = 10f; if (next != null && next.getNextLexicalUnit() != null) { next = next.getNextLexicalUnit(); amount = next.getFloatValue(); } return amount; }
public void property(String name, LexicalUnit unit, boolean important) throws CSSException { _buffer.append(name); _buffer.append(':'); int index = 0; while (unit != null) { if (index > 0) _buffer.append(" "); String v = unit.toString(); v = substitute(v); _buffer.append(v); unit = unit.getNextLexicalUnit(); index++; } _buffer.append(';'); }
private Value createCIELCHColorValue(LexicalUnit lu, Value v) { lu = lu.getParameters(); float l = getColorValue(lu); lu = lu.getNextLexicalUnit(); expectComma(lu); lu = lu.getNextLexicalUnit(); float c = getColorValue(lu); lu = lu.getNextLexicalUnit(); expectComma(lu); lu = lu.getNextLexicalUnit(); float h = getColorValue(lu); CIELCHColor icc = new CIELCHColor(l, c, h); lu = lu.getNextLexicalUnit(); return icc; }
private Value createCIELabColorValue(LexicalUnit lu, Value v) { lu = lu.getParameters(); float l = getColorValue(lu); lu = lu.getNextLexicalUnit(); expectComma(lu); lu = lu.getNextLexicalUnit(); float a = getColorValue(lu); lu = lu.getNextLexicalUnit(); expectComma(lu); lu = lu.getNextLexicalUnit(); float b = getColorValue(lu); CIELabColor icc = new CIELabColor(l, a, b); lu = lu.getNextLexicalUnit(); return icc; }
public static CSSValue newValue(LexicalUnit value) { //if there are more lexical units then it's a list if(value.getNextLexicalUnit() != null) return new CSSValueListImpl(value); return newPrimitiveValue(value); }
private Value createICCNamedColorValue(LexicalUnit lu, Value v) { lu = lu.getParameters(); expectIdent(lu); String profileName = lu.getStringValue(); lu = lu.getNextLexicalUnit(); expectComma(lu); lu = lu.getNextLexicalUnit(); expectIdent(lu); String colorName = lu.getStringValue(); ICCNamedColor icc = new ICCNamedColor(profileName, colorName); lu = lu.getNextLexicalUnit(); return icc; }
private Value createICCColorValue(LexicalUnit lu, Value v) { lu = lu.getParameters(); expectIdent(lu); ICCColor icc = new ICCColor(lu.getStringValue()); lu = lu.getNextLexicalUnit(); while (lu != null) { expectComma(lu); lu = lu.getNextLexicalUnit(); icc.append(getColorValue(lu)); lu = lu.getNextLexicalUnit(); } return icc; }
private Value createICCNamedColorValue(LexicalUnit lu, Value v) { lu = lu.getParameters(); expectIdent(lu); String profileName = lu.getStringValue(); lu = lu.getNextLexicalUnit(); expectComma(lu); lu = lu.getNextLexicalUnit(); expectIdent(lu); String colorName = lu.getStringValue(); ICCNamedColor icc = new ICCNamedColor(profileName, colorName); lu = lu.getNextLexicalUnit(); return icc; }
private Value createICCColorValue(LexicalUnit lu, Value v) { lu = lu.getParameters(); expectIdent(lu); ICCColor icc = new ICCColor(lu.getStringValue()); lu = lu.getNextLexicalUnit(); while (lu != null) { expectComma(lu); lu = lu.getNextLexicalUnit(); icc.append(getColorValue(lu)); lu = lu.getNextLexicalUnit(); } return icc; }
private Value createICCColorValue(LexicalUnit lu, Value v) { lu = lu.getParameters(); expectIdent(lu); ICCColor icc = new ICCColor(lu.getStringValue()); lu = lu.getNextLexicalUnit(); while (lu != null) { expectComma(lu); lu = lu.getNextLexicalUnit(); icc.append(getColorValue(lu)); lu = lu.getNextLexicalUnit(); } return icc; }
private Value createICCNamedColorValue(LexicalUnit lu, Value v) { lu = lu.getParameters(); expectIdent(lu); String profileName = lu.getStringValue(); lu = lu.getNextLexicalUnit(); expectComma(lu); lu = lu.getNextLexicalUnit(); expectIdent(lu); String colorName = lu.getStringValue(); ICCNamedColor icc = new ICCNamedColor(profileName, colorName); lu = lu.getNextLexicalUnit(); return icc; }