Class PatternString
java.lang.Object
com.ibm.j9ddr.util.PatternString
- All Implemented Interfaces:
Serializable
A string containing wildcards and other characters that enable it
to represent many strings at once.
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A class to represent the PatternString in two separate patterns -
Field Summary
-
Constructor Summary
ConstructorDescriptionPatternString
(String pattern) Constructor for creating a PatternString class which can contain wildcard expressions and other characters to represent many strings at once. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Determine if there is a match to the pattern that ends with the given stringint[]
indexOf
(int c) Finds the indices of the possible first locations of the indicated character.boolean
Determines if the pattern matches with a given string.boolean
Checks if this PatternString contains no wildcards.static boolean
isWildcard
(char c) Checks if the provided character is a wildcardint[]
lastIndexOf
(int c) Finds the indices of the possible last locations of the indicated character.split
(int index) Splits the patterns into two separate patterns, the splitting being done by the character at the indicated index, so this character is not included in either string.boolean
startsWith
(String string) Determine if there is a match to the pattern that starts with the given stringtoString()
Gives the pattern used to create this PatternString class
-
Field Details
-
wildCard
public static final char wildCard- See Also:
-
singleCharWildCard
public static final char singleCharWildCard- See Also:
-
ALWAYS_MATCHES
-
-
Constructor Details
-
PatternString
Constructor for creating a PatternString class which can contain wildcard expressions and other characters to represent many strings at once.- Parameters:
pattern
- a String which can contain wildcards
-
-
Method Details
-
split
Splits the patterns into two separate patterns, the splitting being done by the character at the indicated index, so this character is not included in either string. If such a character is a variable length wildcard then the new patterns will begin and end with wildcards as needed.- Parameters:
index
- the index at which to split the PatternString in two parts
-
indexOf
public int[] indexOf(int c) Finds the indices of the possible first locations of the indicated character. The results are returned in ascending order.- Parameters:
c
- index of the pattern within this PatternString- Returns:
- int[] an array indicating the possible first locations of the character indicated at the index provided.
-
lastIndexOf
public int[] lastIndexOf(int c) Finds the indices of the possible last locations of the indicated character. The results are returned in descending order.- Parameters:
c
- index of the pattern within this PatternString- Returns:
- int[] an array indicating the possible last locations of the character indicated at the index provided.
-
isRegularString
public boolean isRegularString()Checks if this PatternString contains no wildcards.- Returns:
- boolean true if this PatternString contains no wildcards, false otherwise
-
isWildcard
public static boolean isWildcard(char c) Checks if the provided character is a wildcard- Parameters:
c
- the character to check whether it is a wildcard or not- Returns:
- boolean true if the character given is a wildcard
-
endsWith
Determine if there is a match to the pattern that ends with the given string- Parameters:
string
- the String to match- Returns:
- boolean returns true if there is a match, false if not
-
isMatch
Determines if the pattern matches with a given string.- Parameters:
string
- the String to match- Returns:
- boolean returns true if there is a match, false if not
-
startsWith
Determine if there is a match to the pattern that starts with the given string- Parameters:
string
- the String to match- Returns:
- boolean returns true if there is a match, false if not
-
toString
-