public PrefixPhrase <O> getMatchingPrefix(ParsedUri purl) { String host = purl.Host; // domainPrefix is a child of this, the root (with no parent) PrefixPhrase <O> hostPrefix = LookupChild(host); // children of hostPrefix String path = purl.AbsolutePath; return((hostPrefix == null) ? null : hostPrefix.GetMatchingPrefix(path, 1, separator)); // skip over starting '/' }
public PrefixPhrase <O> GetMatchingPrefix(String input, int start, char seperator) { if (IsTerminal()) { return(this); } int seperatorIndex = input.IndexOf(seperator, start); if (seperatorIndex > 0) { String key = input.Substring(start, seperatorIndex - start); PrefixPhrase <O> childPrefixPhrase = childPhraseMap.Get(key); if (childPrefixPhrase != null) { return((seperatorIndex < input.Length) ? childPrefixPhrase.GetMatchingPrefix(input, seperatorIndex + 1, seperator) : this); } } return(null); }