/** * Parse a String value as a SVGLength. * * Initialize this length with the result * of the parsing of this value. * @param s String representation of a SVGlength. */ protected void parse(String s) { try { LengthParser lengthParser = new LengthParser(); UnitProcessor.UnitResolver ur = new UnitProcessor.UnitResolver(); lengthParser.setLengthHandler(ur); lengthParser.parse(s); unitType = ur.unit; value = ur.value; } catch (ParseException e) { unitType = SVG_LENGTHTYPE_UNKNOWN; value = 0; } }
protected void doParse() throws ParseException, IOException { lengthHandler.startLength(); current = reader.read(); skipSpaces(); parseLength(); skipSpaces(); if (current != -1) { reportError("end.of.stream.expected", new Object[] {current}); } lengthHandler.endLength(); }
/** * Creates a new AnimatableLengthValueFactory. */ public AnimatableLengthValueFactory() { parser.setLengthHandler(handler); }
/** * Creates a new AnimatableValue from a string. */ public AnimatableValue createValue(AnimationTarget target, String ns, String ln, boolean isCSS, String s) { short pcInterp = target.getPercentageInterpretation(ns, ln, isCSS); try { parser.parse(s); return new AnimatableLengthValue (target, type, value, pcInterp); } catch (ParseException e) { // XXX Do something better than returning null. return null; } }
reportUnexpectedCharacterError( current ); return; case 'e': case 'E': if (!mantRead) { reportUnexpectedCharacterError( current ); return; switch (current) { default: reportUnexpectedCharacterError( current ); return; case 'm': if (!le) { reportUnexpectedCharacterError( current ); return; case 'x': if (!le) { reportUnexpectedCharacterError( current ); return; switch (current) { default: reportUnexpectedCharacterError( current ); return; case '0': case '1': case '2': case '3': case '4': break;
/** * Creates a new AnimatableLengthValueFactory. */ public AnimatableLengthValueFactory() { parser.setLengthHandler(handler); }
/** * Creates a new AnimatableValue from a string. */ public AnimatableValue createValue(AnimationTarget target, String ns, String ln, boolean isCSS, String s) { short pcInterp = target.getPercentageInterpretation(ns, ln, isCSS); try { parser.parse(s); return new AnimatableLengthValue (target, type, value, pcInterp); } catch (ParseException e) { // XXX Do something better than returning null. return null; } }
reportUnexpectedCharacterError( current ); return; case 'e': case 'E': if (!mantRead) { reportUnexpectedCharacterError( current ); return; switch (current) { default: reportUnexpectedCharacterError( current ); return; case 'm': if (!le) { reportUnexpectedCharacterError( current ); return; case 'x': if (!le) { reportUnexpectedCharacterError( current ); return; switch (current) { default: reportUnexpectedCharacterError( current ); return; case '0': case '1': case '2': case '3': case '4': break;
/** * Parse a String value as a SVGLength. * * Initialize this length with the result * of the parsing of this value. * @param s String representation of a SVGlength. */ protected void parse(String s) { try { LengthParser lengthParser = new LengthParser(); UnitProcessor.UnitResolver ur = new UnitProcessor.UnitResolver(); lengthParser.setLengthHandler(ur); lengthParser.parse(s); unitType = ur.unit; value = ur.value; } catch (ParseException e) { unitType = SVG_LENGTHTYPE_UNKNOWN; value = 0; } }
protected void doParse() throws ParseException, IOException { lengthHandler.startLength(); current = reader.read(); skipSpaces(); parseLength(); skipSpaces(); if (current != -1) { reportError("end.of.stream.expected", new Object[] {current}); } lengthHandler.endLength(); }
/** * Creates a new AnimatableLengthValueFactory. */ public AnimatableLengthValueFactory() { parser.setLengthHandler(handler); }
/** * Creates a new AnimatableValue from a string. */ public AnimatableValue createValue(AnimationTarget target, String ns, String ln, boolean isCSS, String s) { short pcInterp = target.getPercentageInterpretation(ns, ln, isCSS); try { parser.parse(s); return new AnimatableLengthValue (target, type, value, pcInterp); } catch (ParseException e) { // XXX Do something better than returning null. return null; } }
reportUnexpectedCharacterError( current ); return; case 'e': case 'E': if (!mantRead) { reportUnexpectedCharacterError( current ); return; switch (current) { default: reportUnexpectedCharacterError( current ); return; case 'm': if (!le) { reportUnexpectedCharacterError( current ); return; case 'x': if (!le) { reportUnexpectedCharacterError( current ); return; switch (current) { default: reportUnexpectedCharacterError( current ); return; case '0': case '1': case '2': case '3': case '4': break;
/** * Parse a String value as a SVGLength. * * Initialize this length with the result * of the parsing of this value. * @param s String representation of a SVGlength. */ protected void parse(String s) { try { LengthParser lengthParser = new LengthParser(); UnitProcessor.UnitResolver ur = new UnitProcessor.UnitResolver(); lengthParser.setLengthHandler(ur); lengthParser.parse(s); unitType = ur.unit; value = ur.value; } catch (ParseException e) { unitType = SVG_LENGTHTYPE_UNKNOWN; value = 0; } }
protected void doParse() throws ParseException, IOException { lengthHandler.startLength(); current = reader.read(); skipSpaces(); parseLength(); skipSpaces(); if (current != -1) { reportError("end.of.stream.expected", new Object[] { new Integer(current) }); } lengthHandler.endLength(); }
/** * Returns the specified coordinate with the specified direction * in user units. * * @param s the 'other' coordinate * @param attr the attribute name that represents the length * @param d the direction of the coordinate * @param ctx the context used to resolve relative value */ public static float svgToUserSpace(String s, String attr, short d, Context ctx) throws ParseException { LengthParser lengthParser = new LengthParser(); UnitResolver ur = new UnitResolver(); lengthParser.setLengthHandler(ur); lengthParser.parse(s); return svgToUserSpace(ur.value, ur.unit, d, ctx); }
/** * Returns the specified coordinate with the specified direction * in user units. * * @param s the 'other' coordinate * @param attr the attribute name that represents the length * @param d the direction of the coordinate * @param ctx the context used to resolve relative value */ public static float svgToUserSpace(String s, String attr, short d, Context ctx) throws ParseException { LengthParser lengthParser = new LengthParser(); UnitResolver ur = new UnitResolver(); lengthParser.setLengthHandler(ur); lengthParser.parse(s); return svgToUserSpace(ur.value, ur.unit, d, ctx); }
/** * Returns the specified value with the specified direction in * objectBoundingBox units. * * @param s the value * @param attr the attribute name that represents the value * @param d the direction of the value * @param ctx the context used to resolve relative value */ public static float svgToObjectBoundingBox(String s, String attr, short d, Context ctx) throws ParseException { LengthParser lengthParser = new LengthParser(); UnitResolver ur = new UnitResolver(); lengthParser.setLengthHandler(ur); lengthParser.parse(s); return svgToObjectBoundingBox(ur.value, ur.unit, d, ctx); }
/** * Returns the specified coordinate with the specified direction * in user units. * * @param s the 'other' coordinate * @param attr the attribute name that represents the length * @param d the direction of the coordinate * @param ctx the context used to resolve relative value */ public static float svgToUserSpace(String s, String attr, short d, Context ctx) throws ParseException { LengthParser lengthParser = new LengthParser(); UnitResolver ur = new UnitResolver(); lengthParser.setLengthHandler(ur); lengthParser.parse(s); return svgToUserSpace(ur.value, ur.unit, d, ctx); }
/** * Returns the specified value with the specified direction in * objectBoundingBox units. * * @param s the value * @param attr the attribute name that represents the value * @param d the direction of the value * @param ctx the context used to resolve relative value */ public static float svgToObjectBoundingBox(String s, String attr, short d, Context ctx) throws ParseException { LengthParser lengthParser = new LengthParser(); UnitResolver ur = new UnitResolver(); lengthParser.setLengthHandler(ur); lengthParser.parse(s); return svgToObjectBoundingBox(ur.value, ur.unit, d, ctx); }