Package org.smartparam.engine.util
Class EngineUtil
java.lang.Object
org.smartparam.engine.util.EngineUtil
The class contains the helper and tool methods used by the engine.
Some methods have equivalents in the standard library or different tool libraries but implemented in a way that increases their efficiency for use in the engine.- Since:
- 1.0.0
- Author:
- Przemek Hertel
-
Method Summary
-
Method Details
-
hasText
-
split
Splits the given string and returns an array of tokens. The separator is a single
The method is more than 4 times faster than String.split () called for a 1-character delimiter.delimcharacter. Returns a maximum ofmaxtokens even if the input string contains more tokens.- Parameters:
str- input stringdelim- single character treated as a separatormaxTokens- maximum number of tokens, the value -1 returns an array of all tokens (unlimited)- Returns:
- token array, never returns null
- See Also:
-
split
Splits the given string and returns an array of tokens. The separator is a single
The method is more than 4 times faster than String.split () called for a 1-character delimiter.delimcharacter. Returns arrays with all tokens found in the input string.- Parameters:
str- input stringdelim- character treated as a separator- Returns:
- Array of all tokens, never returns null
- See Also:
-
split2
Splits a string into exactly 2 tokens. The separator is the first occurrence of the
The method is 6 times faster thandelimcharacter.(java.lang.String, char, int)and about 24 times faster than String.split. Applicable to typical hotspots.- Parameters:
str- string that will be split into exactly 2 tokensdelim- character to be the separator- Returns:
- 2 element's token array, never returns null
-
trimAllWhitespace
-