Class TrimSplitByChar
Object
com.owenfeehan.pathpatternfinder.trim.TrimSplitByChar
- All Implemented Interfaces:
TrimOperation<String>
public class TrimSplitByChar extends Object implements TrimOperation<String>
Attempts to split a string by finding a common special character in all strings.
It then creates two new unresolved elements to the left, and right of the character, as well as a constant element representing the character itself.
Note that we do not perform any case-sensitive matching on the assumption that the characters
used in splitChar
will typically be special characters for which case is irrelevant.
- Author:
- Owen Feehan
-
Constructor Summary
Constructors Constructor Description TrimSplitByChar(char splitChar, int splitCharIndex, UnresolvedPatternElementFactory factoryResolved)
Constructor -
Method Summary
-
Constructor Details
-
TrimSplitByChar
public TrimSplitByChar(char splitChar, int splitCharIndex, UnresolvedPatternElementFactory factoryResolved)Constructor- Parameters:
splitChar
- the character to split withsplitCharIndex
- the index from which the splitChar was found (used to prevent trying to split again characters that have already been rejected)factoryResolved
- factory for creating unresolved pattern elements
-
-
Method Details
-
trim
Description copied from interface:TrimOperation
Attempts to trim the list of objects by finding aPattern
.- Specified by:
trim
in interfaceTrimOperation<String>
- Parameters:
source
- list of objects- Returns:
- if successful, a pattern with the trimmed elements (and what remains to be resolved) as elements, otherwise
Optional.empty()
if unsuccessful
-