Character.toString(VectorSessionToken.SegmentSeparator), localLsnByRegion. entrySet() .stream() .map(kvp -> String.format("%s%s%s",
@Override public void visit(BuiltinMap builtinMap) { builtinMap.getEntries().entrySet().stream().forEach(e -> { visitNode(e.getKey()); visitNode(e.getValue()); }); builtinMap.baseTerms().stream().forEach(this::visitNode); visit((Collection) builtinMap); }
@Override public void visit(BuiltinMap builtinMap) { for (java.util.Map.Entry<Term, Term> entry : builtinMap.getEntries().entrySet()) { entry.getKey().accept(this); entry.getValue().accept(this); } for (Term term : builtinMap.baseTerms()) { term.accept(this); } visit((Collection) builtinMap); }
@Override public List<Term> getKComponents() { DataStructureSort sort = global.getDefinition().dataStructureSortOf(sort()); ArrayList<Term> components = Lists.newArrayList(); entries.entrySet().stream().forEach(entry -> components.add(KItem.of( KLabelConstant.of(sort.elementLabel(), global.getDefinition()), KList.concatenate(entry.getKey(), entry.getValue()), global, entry.getKey().att()))); for (Term term : baseTerms()) { if (term instanceof BuiltinMap) { components.addAll(((BuiltinMap) term).getKComponents()); } else { components.add(term); } } return components; }
for (Map.Entry<Integer, Long> kvp : sessionTokenWithHigherVersion.localLsnByRegion.entrySet()) { Integer regionId = kvp.getKey();
private boolean areRegionProgressEqual(UnmodifiableMap<Integer, Long> other) { if (this.localLsnByRegion.size() != other.size()) { return false; } for (Map.Entry<Integer, Long> kvp : this.localLsnByRegion.entrySet()) { Integer regionId = kvp.getKey(); ValueHolder<Long> localLsn1 = ValueHolder.initialize(kvp.getValue()); ValueHolder<Long> localLsn2 = ValueHolder.initialize(-1l); if (Utils.tryGetValue(other, regionId, localLsn2)) { if (ObjectUtils.notEqual(localLsn1.v, localLsn2.v)) { return false; } } } return true; }
for (Map.Entry<Integer, Long> kvp : other.localLsnByRegion.entrySet()) { Integer regionId = kvp.getKey(); long otherLocalLsn = kvp.getValue();
@Override public void visit(BuiltinMap node) { if (node.isGround() && node.isNormal()) { rhsSchedule.add(RHSInstruction.PUSH(node)); } else { int sizeBase = 0; for (Term base : node.baseTerms()) { base.accept(this); sizeBase++; } int sizeElem = 0; for (Map.Entry<Term, Term> entry : node.getEntries().entrySet()) { entry.getValue().accept(this); entry.getKey().accept(this); sizeElem++; } rhsSchedule.add(RHSInstruction.CONSTRUCT(new Constructor( ConstructorType.BUILTIN_MAP, sizeElem, sizeBase))); } }
@Override public void visit(BuiltinMap builtinMap) { preVisitor.resetProceed(); builtinMap.accept(preVisitor); if (!preVisitor.isProceed()) return; for (Map.Entry<Term, Term> entry : builtinMap.getEntries().entrySet()) { entry.getKey().accept(this); entry.getValue().accept(this); } for (Term term : builtinMap.baseTerms()) { term.accept(this); } builtinMap.accept(postVisitor); }
BuiltinMap.Builder builder = BuiltinMap.builder(resolveGlobalContext(builtinMap)); for (Map.Entry<Term, Term> entry : builtinMap.getEntries().entrySet()) { Term key = (Term) entry.getKey().accept(this); Term value = (Term) entry.getValue().accept(this); changed = true; for (Map.Entry<Term, Term> copy : builtinMap.getEntries().entrySet()) { if (copy.equals(entry)) {
private static Substitution<Variable, Term> addFrameMatching( BuiltinMap builtinMap, BuiltinMap patternBuiltinMap, PartialSubstitution ps, TermContext context) { if (!patternBuiltinMap.collectionVariables().isEmpty()) { Variable frame = patternBuiltinMap.collectionVariables().iterator().next(); if (ps.substitution.containsKey(frame)) { return null; } BuiltinMap.Builder builder = BuiltinMap.builder(context.global()); for (Map.Entry<Term, Term> entry : builtinMap.getEntries().entrySet()) { if (!ps.matched.contains(entry.getKey())) { builder.put(entry.getKey(), entry.getValue()); } } for (Term term : builtinMap.baseTerms()) { if (!ps.matched.contains(term)) { builder.concatenate(term); } } return ps.substitution.plus(frame, builder.build()); } else { return ps.substitution; } }
for (Map.Entry<Term, Term> patternEntry : patternBuiltinMap.getEntries().entrySet()) { List<PartialSubstitution> stepSubstitutions = new ArrayList<>(); for (Map.Entry<Term, Term> entry : builtinMap.getEntries().entrySet()) { PatternMatcher matcher = new PatternMatcher(matchOnFunctionSymbol, disjointVariables, termContext); matcher.addUnificationTask(entry.getKey(), patternEntry.getKey());
public static Term difference(BuiltinMap map1, BuiltinMap map2, TermContext context) { BuiltinMap.Builder builder = BuiltinMap.builder(context.global()); if (!map1.isGround() || !map2.isGround()) { if (map1.getEntries().entrySet().containsAll(map2.getEntries().entrySet()) && Multisets.containsOccurrences(map1.baseTerms(), map2.baseTerms())) { builder.putAll(Maps.difference(map1.getEntries(), map2.getEntries()).entriesOnlyOnLeft()); builder.concatenate(Multisets.difference(map1.baseTerms(), map2.baseTerms())); return builder.build(); } else { return null; } } else { /* Maps.difference breaks down the Venn diagram into four parts, see: * http://code.google.com/p/guava-libraries/wiki/CollectionUtilitiesExplained#difference */ MapDifference<Term, Term> mapDiff = Maps.difference(map1.getEntries(), map2.getEntries()); builder.putAll(mapDiff.entriesOnlyOnLeft()); for (Entry<Term, ValueDifference<Term>> e : mapDiff.entriesDiffering().entrySet()) { builder.put(e.getKey(), e.getValue().leftValue()); } return builder.build(); } }