static protected List<MatchingDefinition> normalizeMatchingDefinitions(Map<String, ? extends Object> matchingDefinitions, boolean moreSpaceForSpeed){
		//先分成两个匹配步骤
		Map<String, UrlStartWithMatcherStep2> step1 = new HashMap<String, UrlStartWithMatcherStep2>();
		for (Map.Entry<String, ? extends Object> e: matchingDefinitions.entrySet()){
			String[] splited = splitURL(e.getKey());
			String reversedBeforePart = splited[0];
			String afterPart = splited[1];
			Object attachment = e.getValue();
			
			String step1Pattern;
			String step1PatternUnescaped;
			String step1Example;
			int k = reversedBeforePart.length();
			char c1 = k >=1 ? reversedBeforePart.charAt(k-1) : 0;
			char c2 = k >=2 ? reversedBeforePart.charAt(k-2) : 0;
			if (c1 == '*' && c2 == '.'){
				step1Example = reversedBeforePart.substring(0, k - 1);	//点号要留下
				step1Pattern = escapeForRegExp(step1Example); 
				step1PatternUnescaped = step1Example;
			}else{
				step1Example = reversedBeforePart + "$";
				step1Pattern = escapeForRegExp(reversedBeforePart) + "$"; //加一个终结符，实现精确匹配
				step1PatternUnescaped = step1Example;
			}
			
			UrlStartWithMatcherStep2 step2;
			step2 = step1.get(step1Pattern);
			if (step2 == null){
				step2 = new UrlStartWithMatcherStep2(moreSpaceForSpeed);
				step1.put(step1Pattern, step2);
				step2.step1Example = step1Example;
				step2.step1PatternUnescapged = step1PatternUnescaped;
			}
			if (afterPart == null || afterPart.length() == 0){
				step2.noStep2 = true;
				step2.step1Attachment = attachment;
			}else{
				if (! step2.patterns.containsKey(afterPart)){
					step2.patterns.put(afterPart, attachment);
				}
			}
		}
		
		// 如果本pattern能被其他pattern所匹配，则要额外设置
		for (UrlStartWithMatcherStep2 step2 : step1.values()){
			String example = step2.step1Example;
				for (UrlStartWithMatcherStep2 otherStep2: step1.values()){
					//UrlStartWithMatcherStep2 otherStep2 = step1.get(otherStep2Pattern);
					if (step2 != otherStep2){
						String otherExample = otherStep2.step1Example;
						boolean matched = false; //这里无需考虑性能
						if (example.endsWith(".")){		//比如moc.anis.swen.
							if (otherExample.endsWith(".")){	//比如moc.anis.
								if (example.startsWith(otherExample)){
									matched = true;
								}
							}
						} else {	//比如 moc.anis.swen$
							if (example.startsWith(otherExample)){	//比如moc.anis.
								matched = true;
							}
						}
						if (matched){
							if (step2.step1Attachment != null){
								step2.patterns.putAll(otherStep2.patterns);
							}else{
								step2.additionalStep1Patterns.put(otherStep2.step1PatternUnescapged, otherStep2.step1Attachment);
							}
						}
					}
				}
		}
		

		List<MatchingDefinition> l = new ArrayList<MatchingDefinition>(matchingDefinitions.size());
		for (Map.Entry<String, UrlStartWithMatcherStep2> e: step1.entrySet()){
			UrlStartWithMatcherStep2 step2 = e.getValue();
			step2.buildMatcher();
			
			MatchingDefinition c = new MatchingDefinition();
			c.setRegularExpression(e.getKey());
			c.setAttachment(e.getValue());
			
			List<String> examples = new ArrayList<String>(1);
			examples.add(e.getValue().step1Example);
			c.setExactMatchExamples(examples);
			l.add(c);
			
			//System.out.println(p + "<===>" + step1.get(p));
		}
		
		return l;
	}
static protected List < MatchingDefinition > normalizeMatchingDefinitions ( Map < String , ? extends Object > matchingDefinitions , boolean moreSpaceForSpeed ) { Map < String , UrlStartWithMatcherStep2 > step1 = new HashMap < String , UrlStartWithMatcherStep2 > ( ) ; for ( Map . Entry < String , ? extends Object > e : matchingDefinitions . entrySet ( ) ) { String [ ] splited = splitURL ( e . getKey ( ) ) ; String reversedBeforePart = splited [ 0 ] ; String afterPart = splited [ 1 ] ; Object attachment = e . getValue ( ) ; String step1Pattern ; String step1PatternUnescaped ; String step1Example ; int k = reversedBeforePart . length ( ) ; char c1 = k >= 1 ? reversedBeforePart . charAt ( k - 1 ) : 0 ; char c2 = k >= 2 ? reversedBeforePart . charAt ( k - 2 ) : 0 ; if ( c1 == '*' && c2 == '.' ) { step1Example = reversedBeforePart . substring ( 0 , k - 1 ) ; step1Pattern = escapeForRegExp ( step1Example ) ; step1PatternUnescaped = step1Example ; } else { step1Example = reversedBeforePart + "$" ; step1Pattern = escapeForRegExp ( reversedBeforePart ) + "$" ; step1PatternUnescaped = step1Example ; } UrlStartWithMatcherStep2 step2 ; step2 = step1 . get ( step1Pattern ) ; if ( step2 == null ) { step2 = new UrlStartWithMatcherStep2 ( moreSpaceForSpeed ) ; step1 . put ( step1Pattern , step2 ) ; step2 . step1Example = step1Example ; step2 . step1PatternUnescapged = step1PatternUnescaped ; } if ( afterPart == null || afterPart . length ( ) == 0 ) { step2 . noStep2 = true ; step2 . step1Attachment = attachment ; } else { if ( ! step2 . patterns . containsKey ( afterPart ) ) { step2 . patterns . put ( afterPart , attachment ) ; } } } for ( UrlStartWithMatcherStep2 step2 : step1 . values ( ) ) { String example = step2 . step1Example ; for ( UrlStartWithMatcherStep2 otherStep2 : step1 . values ( ) ) { if ( step2 != otherStep2 ) { String otherExample = otherStep2 . step1Example ; boolean matched = false ; if ( example . endsWith ( "." ) ) { if ( otherExample . endsWith ( "." ) ) { if ( example . startsWith ( otherExample ) ) { matched = true ; } } } else { if ( example . startsWith ( otherExample ) ) { matched = true ; } } if ( matched ) { if ( step2 . step1Attachment != null ) { step2 . patterns . putAll ( otherStep2 . patterns ) ; } else { step2 . additionalStep1Patterns . put ( otherStep2 . step1PatternUnescapged , otherStep2 . step1Attachment ) ; } } } } } List < MatchingDefinition > l = new ArrayList < MatchingDefinition > ( matchingDefinitions . size ( ) ) ; for ( Map . Entry < String , UrlStartWithMatcherStep2 > e : step1 . entrySet ( ) ) { UrlStartWithMatcherStep2 step2 = e . getValue ( ) ; step2 . buildMatcher ( ) ; MatchingDefinition c = new MatchingDefinition ( ) ; c . setRegularExpression ( e . getKey ( ) ) ; c . setAttachment ( e . getValue ( ) ) ; List < String > examples = new ArrayList < String > ( 1 ) ; examples . add ( e . getValue ( ) . step1Example ) ; c . setExactMatchExamples ( examples ) ; l . add ( c ) ; } return l ; }
Normalize matching definitions according to requirements of {@link StartWithMatcher}.<br>
根据{@link StartWithMatcher}的需要来规范化匹配条件定义。

@param matchingDefinitions	Key是匹配字符串，Value是附件对象。
当进行匹配检查的时候，返回附件对象来标识哪一个匹配字符串被匹配上了。
<p>
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.
@return	{@link StartWithMatcher}所需的匹配条件定义。
<br>Matching definitions for usage of {@link StartWithMatcher}.
@param moreSpaceForSpeed  是否占用更多内存，而换取速度上的提升。
<br>Whether or not to consume
more memory for better matching speed.
@return	Normalized matching definitions<br>规范化了的匹配条件定义