Recognizer.java 文件源码

java
阅读 30 收藏 0 点赞 0 评论 0

项目:Scratch-ApuC 作者:
/**
 * Get a map from rule names to rule indexes.
 *
 * <p>Used for XPath and tree pattern compilation.</p>
 */
@NotNull
public Map<String, Integer> getRuleIndexMap() {
    String[] ruleNames = getRuleNames();
    if (ruleNames == null) {
        throw new UnsupportedOperationException("The current recognizer does not provide a list of rule names.");
    }

    synchronized (ruleIndexMapCache) {
        Map<String, Integer> result = ruleIndexMapCache.get(ruleNames);
        if (result == null) {
            result = Collections.unmodifiableMap(Utils.toMap(ruleNames));
            ruleIndexMapCache.put(ruleNames, result);
        }

        return result;
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号