|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.jabb.util.text.StartWithMatcher
net.sf.jabb.util.text.UrlStartWithMatcher
public class UrlStartWithMatcher
Given a text string to be tested, and list of matching strings, find out which matching string the
text string starts with.
给定一个待检查的URL字符串,以及一批开头匹配字符串,看看待检查的URL字符串以哪个匹配字符串开头。
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.
匹配时对大小写敏感。如果匹配字符串之间互相饱含,则匹配其中最长的。
| Field Summary |
|---|
| Fields inherited from class net.sf.jabb.util.text.StartWithMatcher |
|---|
attachments, runAutomaton |
| Constructor Summary | |
|---|---|
UrlStartWithMatcher(Map<String,? extends Object> matchingDefinitions)
Create a new instance according to matching strings and their corresponding attachment objects. 根据匹配字符串、匹配字符串所对应的附件对象,创建一个新的实例。 |
|
UrlStartWithMatcher(Map<String,? extends Object> matchingDefinitions,
boolean moreSpaceForSpeed)
Create a new instance according to matching strings and their corresponding attachment objects. 根据匹配字符串、匹配字符串所对应的附件对象,创建一个新的实例。 |
|
UrlStartWithMatcher(UrlStartWithMatcher toBeCopied)
Create a copy, the copy will have exactly the same matching definitions as the original copy. 创建一个副本,这个副本与原先的对象具有完全相同匹配方式。 |
|
| Method Summary | |
|---|---|
Object |
match(String url)
Find out which matching string matches the URL. |
protected static List<MatchingDefinition> |
normalizeMatchingDefinitions(Map<String,? extends Object> matchingDefinitions,
boolean moreSpaceForSpeed)
Normalize matching definitions according to requirements of StartWithMatcher.根据 StartWithMatcher的需要来规范化匹配条件定义。 |
protected static String[] |
splitURL(String url)
将URL拆成两块:反序后的斜线前面的主机、端口和帐号;斜线后面的路径和参数。 比如对于http://www.news.com/read/daily/headline.html,返回的是: moc.swen.www和read/daily/headline.html两项。 |
| Methods inherited from class net.sf.jabb.util.text.StartWithMatcher |
|---|
copyRunAutomaton, escapeForRegExp, getAllAcceptedStates, getLastAcceptedState, getLastAcceptedState, initialize, match, match, matchAll, matchAll, setAttachmentByExample |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public UrlStartWithMatcher(Map<String,? extends Object> matchingDefinitions)
When initializing internal data structure, choose to consume more memory for better matching speed.
在创建内部数据结构的时候,选择占用更多内存,而换取速度上的提升。
matchingDefinitions - Key是匹配字符串,Value是附件对象。
当进行匹配检查的时候,返回附件对象来标识哪一个匹配字符串被匹配上了。
Key is the matching string, Value is its associated attachment object. When the heading string is matched, the attachment object will be returned as identifier.
public UrlStartWithMatcher(Map<String,? extends Object> matchingDefinitions,
boolean moreSpaceForSpeed)
matchingDefinitions - Key是匹配字符串,Value是附件对象。
当进行匹配检查的时候,返回附件对象来标识哪一个匹配字符串被匹配上了。
Key is the matching string, Value is its associated attachment object. When the heading string is matched, the attachment object will be returned as identifier.
moreSpaceForSpeed - 是否占用更多内存,而换取速度上的提升。
public UrlStartWithMatcher(UrlStartWithMatcher toBeCopied)
toBeCopied - 原本。| Method Detail |
|---|
protected static List<MatchingDefinition> normalizeMatchingDefinitions(Map<String,? extends Object> matchingDefinitions,
boolean moreSpaceForSpeed)
StartWithMatcher.StartWithMatcher的需要来规范化匹配条件定义。
matchingDefinitions - Key是匹配字符串,Value是附件对象。
当进行匹配检查的时候,返回附件对象来标识哪一个匹配字符串被匹配上了。
Key is the matching string, Value is its associated attachment object. When the matching string is matched, the attachment object will be returned as identifier.
moreSpaceForSpeed - 是否占用更多内存,而换取速度上的提升。
StartWithMatcher所需的匹配条件定义。
StartWithMatcher.public Object match(String url)
Matching is case insensitive.
url - 需要进行匹配判断的URLprotected static String[] splitURL(String url)
url - URL,可以带http://,也可不带
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||