| Modifier and Type | Field and Description |
|---|---|
| private String | |
| private Set | |
| private boolean | |
| private boolean | |
| private boolean | |
| private boolean | |
| private int | |
| private int | |
| private static final int | |
| private String | |
| private String | |
| private int | |
| private String | |
| private int | |
| private int |
| Access | Constructor and Description |
|---|---|
| public | StringInspector(String
the source string to process source, String the characters that can delimit the beginning of a quoted text block openingMarkers, String the characters that can delimit the end of a of a quoted text block. The length of this parameter must match the length of th previous one closingMarkers, String the subset of overridingMarkers, Set<SearchMode> openingMarkers that override the remaining markers, e.g., if openingMarkers = "'(",
closingMarkers = "')" and overridingMarkers = "'" then the block between the outer parenthesis in "start
('max('); end" is strictly consumed, otherwise the suffix "'); end" would end up being consumed too in the process of
handling the nested parenthesis.a searchMode)Set, ideally an EnumSet, containing the default flags from the enum SearchMode that determine the behavior
of the search and manipulation operations. Note that some operation may override the search mode according to their needs, but the default one
is not touched.This object provides string searching and manipulation operations such as finding sub-strings, matching sub-strings or building a comments-free version of a string. |
| public | StringInspector(String
the source string to process source, int the position from where the source string will be processed startingPosition, String the characters that can delimit the beginning of a quoted text block openingMarkers, String the characters that can delimit the end of a of a quoted text block. The length of this parameter must match the length of th previous one closingMarkers, String the subset of overridingMarkers, Set<SearchMode> openingMarkers that override the remaining markers, e.g., if openingMarkers = "'(",
closingMarkers = "')" and overridingMarkers = "'" then the block between the outer parenthesis in "start
('max('); end" is strictly consumed, otherwise the suffix "'); end" would end up being consumed too in the process of
handling the nested parenthesis.a searchMode)Set, ideally an EnumSet, containing the default flags from the enum SearchMode that determine the behavior
of the search and manipulation operations. Note that some operation may override the search mode according to their needs, but the default one
is not touched.This object provides string searching and manipulation operations such as finding sub-strings, matching sub-strings or building a comments-free version of a string. |
| Modifier and Type | Method and Description |
|---|---|
| public char | Returns: the character in the current positionReturns the character in the current position. |
| public int | |
| public int | Returns: the new current positionIncrements the current position index, by one, taking into consideration the "escaped" status of current character, if the mode
|
| public int | Returns: the new current positionthe search mode to use in this operation searchMode)Increments the current position index, by one, taking into consideration the "escaped" status of current character, if the mode
|
| public int | Returns: the new current positionthe number of positions to increment by)Increments the current position index, by be given number, taking into consideration the "escaped" status of current character, if the mode
|
| public int | Returns: the new current positionthe number of positions to increment by, Set<SearchMode> the search mode to use in this operation searchMode)Increments the current position index, by be given number, taking into consideration the "escaped" status of current character, if the mode
|
| private int | Returns: the position of the next closing marker corresponding to the opening marker in the current positionthe search mode to use in this operation searchMode)Returns the position of the next closing marker corresponding to the opening marker in the current position. |
| public int | Returns: the position where the sub-string is found, starting from the current position, or -1 if not foundthe sub-string to search for searchFor)Finds the position of the given string within the source string, ignoring case, with the option to skip text delimited by the specified markers or inside comment blocks. |
| public int | Returns: the position where the sub-string is found, starting from the current position, or -1 if not foundthe sub-string to search for searchFor, Set<SearchMode> the search mode to use in this operation searchMode)Finds the position of the given string within the source string, ignoring case, with the option to skip text delimited by the specified markers or inside comment blocks. |
| public int | Returns: the position where the first sub-string is found, starting from the current position, or -1 if not foundthe sequence of sub-strings to search searchFor)Finds the position of the of the first of a consecutive sequence of strings within the source string, ignoring case, with the option to skip text delimited by the specified markers or inside comment blocks. |
| public int | Returns: the position of the next valid character, or the current position if already on a valid characterReturns the position of the next alphanumeric character regardless the default search mode originally specified. |
| public int | Returns: the position of the next valid character, or the current position if already on a valid characterReturns the position of the next valid character. |
| private int | Returns: the position of the next valid character, or the current position if already on a valid characterthe search mode to use in this operation searchMode)Returns the position of the next valid character using the given search mode instead of the default one. |
| public int | Returns: the position of the next valid character, or the current position if already on a valid characterReturns the position of the next non-whitespace character regardless the default search mode originally specified. |
| public int | Returns: the position of the next valid character, or the current position if already on a valid characterReturns the position of the next whitespace character regardless the default search mode originally specified. |
| public void | |
| public int | Returns: the position where the sub-string match ended, or -1 if not matchedthe sub-string to match toMatch)Checks if the given string matches the source string counting from the current position, ignoring case, with the option to skip text delimited by the specified markers or inside comment blocks. |
| public int | Returns: the position where the sequence of sub-strings match ended, or -1 if not matchedthe sequence of sub-strings to match toMatch)Checks if the given consecutive sequence of strings matches the source string counting from the current position, ignoring case, with the option to skip text delimited by the specified markers or inside comment blocks. |
| public void | |
| private void | resetEscaped()
Checks if the current character is escaped by analyzing previous characters, as long as the search mode |
| public void | |
| public int | Returns: the previous current position valuethe position from where the source string will be processed pos)Sets the position from where the source string will be processed from now on, taking into consideration the "escaped" status of current character, if
the mode |
| public int | Returns: the previous stop position valuethe position where the source string will stop being processed pos)Sets the position where the source string processing will stop. |
| public List | |
| public String | Returns: a comments-free stringReturns a copy of the source string stripped of all comments and hints. |
| closingMarkers | back to summary |
|---|---|
| private String closingMarkers | |
| defaultSearchMode | back to summary |
|---|---|
| private Set<SearchMode> defaultSearchMode | |
| escaped | back to summary |
|---|---|
| private boolean escaped | |
| inMysqlBlock | back to summary |
|---|---|
| private boolean inMysqlBlock | |
| markedEscape | back to summary |
|---|---|
| private boolean markedEscape | |
| markedInMysqlBlock | back to summary |
|---|---|
| private boolean markedInMysqlBlock | |
| markedPos | back to summary |
|---|---|
| private int markedPos | |
| markedStopAt | back to summary |
|---|---|
| private int markedStopAt | |
| NON_COMMENTS_MYSQL_VERSION_REF_LENGTH | back to summary |
|---|---|
| private static final int NON_COMMENTS_MYSQL_VERSION_REF_LENGTH | |
| openingMarkers | back to summary |
|---|---|
| private String openingMarkers | |
| overridingMarkers | back to summary |
|---|---|
| private String overridingMarkers | |
| pos | back to summary |
|---|---|
| private int pos | |
| source | back to summary |
|---|---|
| private String source | |
| srcLen | back to summary |
|---|---|
| private int srcLen | |
| stopAt | back to summary |
|---|---|
| private int stopAt | |
| StringInspector | back to summary |
|---|---|
| public StringInspector(String source, String openingMarkers, String closingMarkers, String overridingMarkers, Set<SearchMode> searchMode) This object provides string searching and manipulation operations such as finding sub-strings, matching sub-strings or building a comments-free version of a string.
| |
| StringInspector | back to summary |
|---|---|
| public StringInspector(String source, int startingPosition, String openingMarkers, String closingMarkers, String overridingMarkers, Set<SearchMode> searchMode) This object provides string searching and manipulation operations such as finding sub-strings, matching sub-strings or building a comments-free version of a string.
| |
| getChar | back to summary |
|---|---|
| public char getChar() Returns the character in the current position.
| |
| getPosition | back to summary |
|---|---|
| public int getPosition() Returns the current position.
| |
| incrementPosition | back to summary |
|---|---|
| public int incrementPosition() Increments the current position index, by one, taking into consideration the "escaped" status of current character, if the mode
| |
| incrementPosition | back to summary |
|---|---|
| public int incrementPosition(Set<SearchMode> searchMode) Increments the current position index, by one, taking into consideration the "escaped" status of current character, if the mode
| |
| incrementPosition | back to summary |
|---|---|
| public int incrementPosition(int by) Increments the current position index, by be given number, taking into consideration the "escaped" status of current character, if the mode
| |
| incrementPosition | back to summary |
|---|---|
| public int incrementPosition(int by, Set<SearchMode> searchMode) Increments the current position index, by be given number, taking into consideration the "escaped" status of current character, if the mode
| |
| indexOfClosingMarker | back to summary |
|---|---|
| private int indexOfClosingMarker(Set<SearchMode> searchMode) Returns the position of the next closing marker corresponding to the opening marker in the current position. If the current position is not an opening marker, then -1 is returned instead.
| |
| indexOfIgnoreCase | back to summary |
|---|---|
| public int indexOfIgnoreCase(String searchFor) Finds the position of the given string within the source string, ignoring case, with the option to skip text delimited by the specified markers or inside comment blocks.
| |
| indexOfIgnoreCase | back to summary |
|---|---|
| public int indexOfIgnoreCase(String searchFor, Set<SearchMode> searchMode) Finds the position of the given string within the source string, ignoring case, with the option to skip text delimited by the specified markers or inside comment blocks.
| |
| indexOfIgnoreCase | back to summary |
|---|---|
| public int indexOfIgnoreCase(String... searchFor) Finds the position of the of the first of a consecutive sequence of strings within the source string, ignoring case, with the option to skip text delimited by the specified markers or inside comment blocks.
Independently of the
| |
| indexOfNextAlphanumericChar | back to summary |
|---|---|
| public int indexOfNextAlphanumericChar() Returns the position of the next alphanumeric character regardless the default search mode originally specified. This method does not increment the current position automatically, i.e., if already positioned in a valid character then repeated calls return always the same index. If the character in the current position matches one of the prefixes that determine a skipping block, then the position marker advances to the first alphanumeric character after the block to skip.
| |
| indexOfNextChar | back to summary |
|---|---|
| public int indexOfNextChar() Returns the position of the next valid character. This method does not increment the current position automatically, i.e., if already positioned in a valid character then repeated calls return always the same index. If the character in the current position matches one of the prefixes that determine a skipping block, then the position marker advances to the first character after the block to skip.
| |
| indexOfNextChar | back to summary |
|---|---|
| private int indexOfNextChar(Set<SearchMode> searchMode) Returns the position of the next valid character using the given search mode instead of the default one. This method does not increment the current position automatically, i.e., if already positioned in a valid character then repeated calls return always the same index. If the character in the current position matches one of the prefixes that determine a skipping block, then the position marker advances to the first character after the block to skip.
| |
| indexOfNextNonWsChar | back to summary |
|---|---|
| public int indexOfNextNonWsChar() Returns the position of the next non-whitespace character regardless the default search mode originally specified. This method does not increment the current position automatically, i.e., if already positioned in a valid character then repeated calls return always the same index. If the character in the current position matches one of the prefixes that determine a skipping block, then the position marker advances to the first non-whitespace character after the block to skip.
| |
| indexOfNextWsChar | back to summary |
|---|---|
| public int indexOfNextWsChar() Returns the position of the next whitespace character regardless the default search mode originally specified. This method does not increment the current position automatically, i.e., if already positioned in a valid character then repeated calls return always the same index. If the character in the current position matches one of the prefixes that determine a skipping block, then the position marker advances to the first whitespace character after the block to skip.
| |
| mark | back to summary |
|---|---|
| public void mark() Marks the current object's state. A subsequent call to the | |
| matchesIgnoreCase | back to summary |
|---|---|
| public int matchesIgnoreCase(String toMatch) Checks if the given string matches the source string counting from the current position, ignoring case, with the option to skip text delimited by the specified markers or inside comment blocks.
| |
| matchesIgnoreCase | back to summary |
|---|---|
| public int matchesIgnoreCase(String... toMatch) Checks if the given consecutive sequence of strings matches the source string counting from the current position, ignoring case, with the option to skip text delimited by the specified markers or inside comment blocks.
Independently of the
| |
| reset | back to summary |
|---|---|
| public void reset() Resets this object's state to previously mark state. | |
| resetEscaped | back to summary |
|---|---|
| private void resetEscaped() Checks if the current character is escaped by analyzing previous characters, as long as the search mode | |
| restart | back to summary |
|---|---|
| public void restart() Resets this object's state to original values. Allows to reuse the object from a fresh start. | |
| setStartPosition | back to summary |
|---|---|
| public int setStartPosition(int pos) Sets the position from where the source string will be processed from now on, taking into consideration the "escaped" status of current character, if
the mode
| |
| setStopPosition | back to summary |
|---|---|
| public int setStopPosition(int pos) Sets the position where the source string processing will stop.
| |
| split | back to summary |
|---|---|
| public List Splits the source string by the given delimiter. Consecutive delimiters result in empty string parts. | |
| stripCommentsAndHints | back to summary |
|---|---|
| public String stripCommentsAndHints() Returns a copy of the source string stripped of all comments and hints.
| |