Package com._1c.g5.v8.dt.lcore.matcher
Class AbstractSequenceFinder
- java.lang.Object
-
- com._1c.g5.v8.dt.lcore.matcher.AbstractSequenceFinder
-
- Direct Known Subclasses:
DefaultSequenceFinder
public abstract class AbstractSequenceFinder extends Object
Initial API for find pretty matching char sequences
Instances ofAbstractSequenceFinder
are stateful and are not safe for use by multiple threads.
-
-
Constructor Summary
Constructors Constructor Description AbstractSequenceFinder(String pattern, String sourceText)
Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract int
computePriorityOfSubsequence(int[] subSequence)
Computes priority of concrete char sequenceprotected boolean
equalsChar(char sourceTextChar, char patternChar)
Checks that symbols are equalprotected abstract void
filterFoundSequence(List<int[]> sequence)
Filters all found char sequenceprotected List<int[]>
findSeqeuences()
Find sequences for pattern string in source textprotected abstract int
findStartIndexOfNextWord(int startSearchingIndex, String findIn)
Finds start index of next word in stringfindIn
, begins withstartSearchingIndex
abstract int[]
getBestSequence()
Gets the best sequenceabstract int
getBestSequencePriority()
Gets priority of the best sequenceList<int[]>
getFoundSequences()
Gets found sequencesString
getPattern()
Gets initial pattern stringString
getSourceText()
Initial source string for finding char sequence
-
-
-
Method Detail
-
getFoundSequences
public List<int[]> getFoundSequences()
Gets found sequences- Returns:
- list of found sequences, can't be
null
-
getPattern
public String getPattern()
Gets initial pattern string- Returns:
- pattern string, can't be
null
-
getSourceText
public String getSourceText()
Initial source string for finding char sequence- Returns:
- source text, can't be
null
-
getBestSequence
public abstract int[] getBestSequence()
Gets the best sequence- Returns:
- the best sequence or empty array if it not found
-
getBestSequencePriority
public abstract int getBestSequencePriority()
Gets priority of the best sequence- Returns:
- priority of the best sequence
-
findSeqeuences
protected List<int[]> findSeqeuences()
Find sequences for pattern string in source text- Returns:
- list of found sequences, can't be
null
-
equalsChar
protected boolean equalsChar(char sourceTextChar, char patternChar)
Checks that symbols are equal- Parameters:
sourceTextChar
- char from source textpatternChar
- char from pattern string- Returns:
true
if chars are equal,false
otherwise
-
filterFoundSequence
protected abstract void filterFoundSequence(List<int[]> sequence)
Filters all found char sequence- Parameters:
sequence
- filtering sequences, can't benull
-
findStartIndexOfNextWord
protected abstract int findStartIndexOfNextWord(int startSearchingIndex, String findIn)
Finds start index of next word in stringfindIn
, begins withstartSearchingIndex
- 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 abstract int computePriorityOfSubsequence(int[] subSequence)
Computes priority of concrete char sequence- Parameters:
subSequence
- concrete char sequence, can't benull
- Returns:
- priority
-
-