public class StringStartWithMatcher extends StartWithMatcher
The matching is case sensitive. If one matching string starts with another, and the text string starts with them, then the longer one will be considered to be matched.
匹配时对大小写敏感。如果匹配字符串之间互相饱含,则匹配其中最长的。
If the matching need to be checked upon number segments (start number ~ end number) represented
as strings, expandNumberMatchingRange(Map, String, String, Object)
method can be used to
expand number segments to heading number strings.
如果需要对代表数字号码(开始号码~结束号码)的字符串进行匹配,可使用
expandNumberMatchingRange(Map, String, String, Object)
方法
将号码段字符串(一个开始号码,一个结束号码)转换为号码头字符串。
attachments, runAutomaton
Constructor and Description |
---|
StringStartWithMatcher(Map<String,? extends Object> headingDefinitions)
Create a new instance according to heading strings and their corresponding attachment objects.
根据开头匹配字符串、开头匹配字符串所对应的附件对象,创建一个新的实例。 |
StringStartWithMatcher(Map<String,? extends Object> headingDefinitions,
boolean moreSpaceForSpeed)
Create a new instance according to heading strings and their corresponding attachment objects.
根据开头匹配字符串、开头匹配字符串所对应的附件对象,创建一个新的实例。 |
StringStartWithMatcher(StringStartWithMatcher toBeCopied)
Create a copy, the copy will have exactly the same matching
definitions as the original copy.
创建一个副本,这个副本与原先的对象具有完全相同匹配方式。 |
Modifier and Type | Method and Description |
---|---|
static <T> void |
expandNumberMatchingRange(Map<String,T> headingDefinitions,
String start,
String end,
T attachment)
Expand number segments (such as 138000~138999 or 138000~138029) into number headings
(such as 138 or {13800,13801,13802}).
把号码段(类似:138000~138999或138000~138029)展开成号码头(类似:138或13800,13801,13802)。 |
protected static List<MatchingDefinition> |
normalizeMatchingDefinitions(Map<String,? extends Object> headingDefinitions)
Normalize matching definitions according to requirements of
StartWithMatcher .根据 StartWithMatcher 的需要来规范化匹配条件定义。 |
copyRunAutomaton, escapeForRegExp, getAllAcceptedStates, getLastAcceptedState, getLastAcceptedState, initialize, match, match, matchAll, matchAll, setAttachmentByExample
public StringStartWithMatcher(Map<String,? extends Object> headingDefinitions)
When initializing internal data structure, choose to consume more memory for better matching speed.
在创建内部数据结构的时候,选择占用更多内存,而换取速度上的提升。
headingDefinitions
- Key is the heading string, Value is its associated attachment object.
When the heading string is matched, the attachment object will be returned
as identifier.Key是匹配字符串,Value是附件对象。 当进行匹配检查的时候,返回附件对象来标识哪一个匹配字符串被匹配上了。
public StringStartWithMatcher(Map<String,? extends Object> headingDefinitions, boolean moreSpaceForSpeed)
headingDefinitions
- Key是匹配字符串,Value是附件对象。
当进行匹配检查的时候,返回附件对象来标识哪一个匹配字符串被匹配上了。
Key is the heading string, Value is its associated attachment object. When the heading string is matched, the attachment object will be returned as identifier.
moreSpaceForSpeed
- 是否占用更多内存,而换取速度上的提升。
Whether or not to consume more memory for better matching speed.
public StringStartWithMatcher(StringStartWithMatcher toBeCopied)
toBeCopied
- 原本。protected static List<MatchingDefinition> normalizeMatchingDefinitions(Map<String,? extends Object> headingDefinitions)
StartWithMatcher
.StartWithMatcher
的需要来规范化匹配条件定义。headingDefinitions
- Key是匹配字符串,Value是附件对象。
当进行匹配检查的时候,返回附件对象来标识哪一个匹配字符串被匹配上了。
Key is the heading string, Value is its associated attachment object. When the heading string is matched, the attachment object will be returned as identifier.
StartWithMatcher
所需的匹配条件定义。
StartWithMatcher
.public static <T> void expandNumberMatchingRange(Map<String,T> headingDefinitions, String start, String end, T attachment)
headingDefinitions
- 可用来对StringStartWithMatcher
进行初始化的展开后的匹配条件
会被放到这个Map里。
StringStartWithMatcher
will be put into this Map.start
- 起始号码 end
- 结束号码 attachment
- 匹配附件Copyright © 2014. All Rights Reserved.