Class ParserUtils


  • public final class ParserUtils
    extends Object
    Util methods.
    Author:
    Ronald Brill
    • Method Detail

      • hashCode

        public static int hashCode​(int seed,
                                   int hashcode)
        Parameters:
        seed - the seed to be used
        hashcode - the hashcode to be used as input
        Returns:
        a hash code calculated based on a given one.
      • hashCode

        public static int hashCode​(int seed,
                                   boolean b)
        Parameters:
        seed - the seed to be used
        b - the boolean to be used as input
        Returns:
        a hash code calculated based on a given boolean.
      • hashCode

        public static int hashCode​(int seed,
                                   Object obj)
        Parameters:
        seed - the seed to be used
        obj - the object to be used as input
        Returns:
        a hash code calculated based on a given object.
      • equals

        public static boolean equals​(Object obj1,
                                     Object obj2)
        Parameters:
        obj1 - the first object
        obj2 - the second object
        Returns:
        true if the both objects are equals
      • trimBy

        public static String trimBy​(StringBuilder s,
                                    int left,
                                    int right)
        Remove the given number of chars from start and end. There is no parameter checking, the caller has to take care of this.
        Parameters:
        s - the StringBuilder
        left - no of chars to be removed from start
        right - no of chars to be removed from end
        Returns:
        the trimmed string
      • trimUrl

        public static String trimUrl​(StringBuilder s)
        Helper that removes the leading "url(", the trailing ")" and surrounding quotes from the given string builder.
        Parameters:
        s - the StringBuilder
        Returns:
        the trimmed string