java.lang.Object
org.htmlunit.cssparser.util.ParserUtils
Utility methods for parser handling.
- Author:
- Ronald Brill
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intHASH_OFFSET = 37.static final intHASH_SEED = 17. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanCompares two objects for equality.static inthashCode(int seed, boolean b) Calculates a hash code based on a given seed and boolean value.static inthashCode(int seed, int hashcode) Calculates a hash code based on a given seed and integer value.static intCalculates a hash code based on a given seed and object.static StringtrimBy(StringBuilder s, int left, int right) Removes the given number of characters from start and end.static StringHelper that removes the leading "url(", the trailing ")" and surrounding quotes from the given string builder.
-
Field Details
-
HASH_SEED
public static final int HASH_SEEDHASH_SEED = 17.- See Also:
-
HASH_OFFSET
public static final int HASH_OFFSETHASH_OFFSET = 37.- See Also:
-
-
Method Details
-
hashCode
public static int hashCode(int seed, int hashcode) Calculates a hash code based on a given seed and integer value.- Parameters:
seed- the seed to be usedhashcode- 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) Calculates a hash code based on a given seed and boolean value.- Parameters:
seed- the seed to be usedb- the boolean to be used as input- Returns:
- a hash code calculated based on a given boolean
-
hashCode
Calculates a hash code based on a given seed and object.- Parameters:
seed- the seed to be usedobj- the object to be used as input- Returns:
- a hash code calculated based on a given object
-
equals
Compares two objects for equality.- Parameters:
obj1- the first objectobj2- the second object- Returns:
- true if both objects are equal
-
trimBy
Removes the given number of characters from start and end. There is no parameter checking, the caller has to take care of this.- Parameters:
s- the StringBuilderleft- number of characters to be removed from startright- number of characters to be removed from end- Returns:
- the trimmed string
-
trimUrl
Helper that removes the leading "url(", the trailing ")" and surrounding quotes from the given string builder.- Parameters:
s- the StringBuilder- Returns:
- the trimmed string
-