Class DataTypeUtilities


  • public class DataTypeUtilities
    extends Object
    Collection of SVG Data Types utilities
    Author:
    KIYUT
    • Constructor Detail

      • DataTypeUtilities

        public DataTypeUtilities()
    • Method Detail

      • validateInteger

        public static Number validateInteger​(String source)
                                      throws ParseException
        Parses text represent SVGNumber from the beginning of the given string to produce a number.
        Parameters:
        source - A String whose beginning should be parsed.
        Returns:
        A Number parsed from the string
        Throws:
        ParseException - if the beginning of the specified string cannot be parsed.
        See Also:
        NumberFormat.parse(String)
      • validateNumber

        public static Number validateNumber​(String source)
                                     throws ParseException
        Parses text represent SVGNumber from the beginning of the given string to produce a number.
        Parameters:
        source - A String whose beginning should be parsed.
        Returns:
        A Number parsed from the string
        Throws:
        ParseException - if the beginning of the specified string cannot be parsed.
        See Also:
        NumberFormat.parse(String)
      • validateLength

        public static Number validateLength​(String source)
                                     throws ParseException
        Parses text represent SVGLength from the beginning of the given string to produce a number.
        Parameters:
        source - A String whose beginning should be parsed.
        Returns:
        A Number parsed from the string
        Throws:
        ParseException - if the beginning of the specified string cannot be parsed.
        See Also:
        NumberFormat.parse(String)
      • identicalLength

        public static boolean identicalLength​(String source1,
                                              String source2)
                                       throws ParseException
        check whether the supplied parameter is identical SVGLength. eg: 2% identical with 2.00%, 2% not identical with 2mm
        Parameters:
        source1 - String of SVGLength
        source2 - String of SVGLength
        Returns:
        true if both parameter is equals, false otherwise
        Throws:
        ParseException - if the beginning of the specified string cannot be parsed.
      • validatePointList

        public static List<Point2D> validatePointList​(String source)
                                               throws ParseException
        used with polyline and polygon point list
        Parameters:
        source - point description in string
        Returns:
        List of Point2D, but currently it just return null
        Throws:
        ParseException - if parse failed
      • validatePathData

        public static List<String> validatePathData​(String source)
                                             throws ParseException
        used with Path Data
        Parameters:
        source - the source
        Returns:
        List, but currently it just return null
        Throws:
        ParseException - if parse failed
      • parseViewBox

        public static String[] parseViewBox​(String viewBox)
        Return viewBox parsed as String
        Parameters:
        viewBox - the viewbox
        Returns:
        String array