本文整理了Java中org.antlr.v4.runtime.misc.Utils.toMap()
方法的一些代码示例,展示了Utils.toMap()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.toMap()
方法的具体详情如下:
包路径:org.antlr.v4.runtime.misc.Utils
类名称:Utils
方法名:toMap
[英]Convert array of strings to string→index map. Useful for converting rulenames to name→ruleindex map.
[中]
代码示例来源:origin: org.antlr/antlr4-runtime
/**
* Get a map from rule names to rule indexes.
*
* <p>Used for XPath and tree pattern compilation.</p>
*/
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;
}
}
代码示例来源:origin: antlr/antlr4-intellij-adaptor
/** Get a map from rule names to rule indexes. */
public static Map<String, Integer> createRuleIndexMap(String[] ruleNames) {
return Utils.toMap(ruleNames);
}
代码示例来源:origin: antlr/antlr4-intellij-adaptor
/** Get a map from token names to token types. */
public static Map<String, Integer> createTokenTypeMap(String[] tokenNames) {
return Utils.toMap(tokenNames);
}
代码示例来源:origin: uk.co.nichesolutions/antlr4-runtime
/**
* Get a map from rule names to rule indexes.
*
* <p>Used for XPath and tree pattern compilation.</p>
*/
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;
}
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
/**
* Get a map from rule names to rule indexes.
*
* <p>Used for XPath and tree pattern compilation.</p>
*/
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;
}
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
/**
* Get a map from rule names to rule indexes.
*
* <p>Used for XPath and tree pattern compilation.</p>
*/
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;
}
}
代码示例来源:origin: com.tunnelvisionlabs/antlr4-runtime
/**
* 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;
}
}
内容来源于网络,如有侵权,请联系作者删除!