Package com._1c.g5.v8.dt.lcore.matcher
Class DefaultSequenceFinder
- java.lang.Object
-
- com._1c.g5.v8.dt.lcore.matcher.AbstractSequenceFinder
-
- com._1c.g5.v8.dt.lcore.matcher.DefaultSequenceFinder
-
- Direct Known Subclasses:
SpecialSequenceFinder
public class DefaultSequenceFinder extends AbstractSequenceFinder
Default implementation ofAbstractSequenceFinder
This class remove all found sequences which has length less than pattern length
Also digit characters are NOT word boundaries in this implementation
-
-
Constructor Summary
Constructors Constructor Description DefaultSequenceFinder(String pattern, String sourceText)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
computePriorityOfSubsequence(int[] subSequence)
Computes priority of concrete char sequenceprotected void
filterFoundSequence(List<int[]> sequence)
Filters all found char sequenceprotected int
findStartIndexOfNextWord(int startSearchingIndex, String findIn)
Finds start index of next word in stringfindIn
, begins withstartSearchingIndex
int[]
getBestSequence()
Gets the best sequenceint
getBestSequencePriority()
Gets priority of the best sequenceprotected boolean
isSourceTextStartWithPattern(String pattern, String sourceText)
Checks thatsourceText
starts withpattern
-
Methods inherited from class com._1c.g5.v8.dt.lcore.matcher.AbstractSequenceFinder
equalsChar, findSeqeuences, getFoundSequences, getPattern, getSourceText
-
-
-
-
Method Detail
-
getBestSequence
public int[] getBestSequence()
Description copied from class:AbstractSequenceFinder
Gets the best sequence- Specified by:
getBestSequence
in classAbstractSequenceFinder
- Returns:
- the best sequence or empty array if it not found
-
getBestSequencePriority
public int getBestSequencePriority()
Description copied from class:AbstractSequenceFinder
Gets priority of the best sequence- Specified by:
getBestSequencePriority
in classAbstractSequenceFinder
- Returns:
- priority of the best sequence
-
isSourceTextStartWithPattern
protected boolean isSourceTextStartWithPattern(String pattern, String sourceText)
Checks thatsourceText
starts withpattern
- Parameters:
pattern
- pattern for finding char sequence, can't benull
sourceText
- initial text for finding by pattern, can't benull
- Returns:
true
ifsourceText
starts withpattern
,false
otherwise
-
filterFoundSequence
protected void filterFoundSequence(List<int[]> sequence)
Description copied from class:AbstractSequenceFinder
Filters all found char sequence- Specified by:
filterFoundSequence
in classAbstractSequenceFinder
- Parameters:
sequence
- filtering sequences, can't benull
-
findStartIndexOfNextWord
protected int findStartIndexOfNextWord(int startSearchingIndex, String findIn)
Description copied from class:AbstractSequenceFinder
Finds start index of next word in stringfindIn
, begins withstartSearchingIndex
- Specified by:
findStartIndexOfNextWord
in classAbstractSequenceFinder
- Parameters:
startSearchingIndex
- start index for searchfindIn
- initial text for finding index of next word, can't benull
- Returns:
- start index of next word, if the word was found, or
findIn.length()
otherwise
-
computePriorityOfSubsequence
protected int computePriorityOfSubsequence(int[] subSequence)
Description copied from class:AbstractSequenceFinder
Computes priority of concrete char sequence- Specified by:
computePriorityOfSubsequence
in classAbstractSequenceFinder
- Parameters:
subSequence
- concrete char sequence, can't benull
- Returns:
- priority
-
-