本文整理了Java中scala.collection.Map.contains()
方法的一些代码示例,展示了Map.contains()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Map.contains()
方法的具体详情如下:
包路径:scala.collection.Map
类名称:Map
方法名:contains
暂无
代码示例来源:origin: kframework/k
private void applyVarLhs(KVariable k, StringBuilder sb, VarInfo vars) {
String varName = encodeStringToVariable(k.name());
vars.vars.put(k, varName);
Sort s = k.att().getOptional(Sort.class).orElse(Sort(""));
if (mainModule.sortAttributesFor().contains(s)) {
String hook = mainModule.sortAttributesFor().apply(s).<String>getOptional("hook").orElse("");
if (sortVarHooks.containsKey(hook)) {
sb.append("(");
sb.append(sortVarHooks.get(hook).apply(s));
sb.append(" as ").append(varName).append(")");
return;
}
}
sb.append(varName);
}
代码示例来源:origin: kframework/k
@Override
public void apply(KToken k) {
if (inBooleanExp && k.sort().equals(Sorts.Bool())) {
sb.append(k.s());
return;
}
if (mainModule.sortAttributesFor().contains(k.sort())) {
String hook = mainModule.sortAttributesFor().apply(k.sort()).<String>getOptional("hook").orElse("");
if (sortHooks.containsKey(hook)) {
sb.append(sortHooks.get(hook).apply(k.s()));
return;
}
}
sb.append("KToken (");
apply(k.sort());
sb.append(", ");
sb.append(enquoteString(k.s()));
sb.append(")");
}
代码示例来源:origin: kframework/k
Term labelTerm = ((TermCons) child).get(0);
Optional<KLabel> optLabel = klabelFromTerm(labelTerm);
if (optLabel.isPresent() && m.productionsFor().contains(optLabel.get())) {
Collection<Production> productions = mutable(m.productionsFor().get(optLabel.get()).get());
List<Term> rawArgs = lowerKList(((TermCons) child).get(1));
代码示例来源:origin: kframework/k
private Either<Set<ParseFailedException>, Term> wrapTermWithCast(Constant c, Sort declared) {
Production cast;
if (addCast) {
cast = productions.apply(KLabel("#SemanticCastTo" + declared.toString())).head();
} else if (inferCasts && !hasCastAlready && productions.contains(KLabel("#SyntacticCast"))) {
cast = stream(productions.apply(KLabel("#SyntacticCast"))).filter(p -> p.sort().equals(declared)).findAny().get();
} else {
cast = null;
}
if (cast == null) {
return Right.apply(c);
} else {
return Right.apply(TermCons.apply(ConsPStack.singleton(c), cast, c.location(), c.source()));
}
}
代码示例来源:origin: kframework/k
if (mainModule.sortAttributesFor().contains(s)) {
String hook = mainModule.sortAttributesFor().apply(s).<String>getOptional("hook").orElse("");
if (!sortVarHooks.containsKey(hook)) {
代码示例来源:origin: kframework/k
Sort predicateSort = (mainModule.attributesFor().apply(functionLabel).get(Attribute.PREDICATE_KEY, Sort.class));
stream(mainModule.definedSorts()).filter(s -> mainModule.subsorts().greaterThanEq(predicateSort, s)).distinct()
.filter(sort -> mainModule.sortAttributesFor().contains(sort)).forEach(sort -> {
String sortHook = mainModule.sortAttributesFor().apply(sort).<String>getOptional("hook").orElse("");
if (predicateRules.containsKey(sortHook)) {
代码示例来源:origin: kframework/k
return;
if (mainModule.sortAttributesFor().contains(s)) {
String hook2 = mainModule.sortAttributesFor().apply(s).<String>getOptional("hook").orElse("");
if (sortVarHooks.containsKey(hook2)) {
代码示例来源:origin: kframework/k
private static Sentence markRegularRules(Definition d, ConfigurationInfoFromModule configInfo, Sentence s, String att) {
if (s instanceof org.kframework.definition.Rule) {
org.kframework.definition.Rule r = (org.kframework.definition.Rule) s;
if (r.body() instanceof KApply) {
KLabel klabel = ((KApply) r.body()).klabel();
if (d.mainModule().sortFor().contains(klabel) //is false for rules in specification modules not part of semantics
&& d.mainModule().sortFor().apply(klabel).equals(configInfo.topCell())) {
return Rule.apply(r.body(), r.requires(), r.ensures(), r.att().add(att));
}
}
}
return s;
}
内容来源于网络,如有侵权,请联系作者删除!