public Sort getCellSort(KLabel cellLabel) { Sort s = labels.getCodomain(cellLabel); return cfg.isCell(s) ? s : null; }
if (cfg.cfg.isCell(sort)) { if (!subcellSorts.contains(sort)) { throw new IllegalArgumentException("No such sub-cell " + sort + " in the cell " + cellLabel); if (cfg.cfg.isCell(s)) { if (!subcellSorts.contains(s)) { throw new IllegalArgumentException("No such sub-cell " + s + " in the cell " + cellLabel);
private boolean isCell(K k) { return k instanceof KApply && cfg.isCell(labelInfo.getCodomain(((KApply) k).klabel())); } }
public boolean isCell(KLabel klabel) { Sort s = labels.getCodomain(klabel); return cfg.isCell(s) && cfg.getCellLabel(s).equals(klabel); } public boolean isLeafCell(KLabel klabel) {
private void filterRequired(Set<Sort> required, K item) { if (item instanceof KApply) { required.remove(labelInfo.getCodomain(((KApply) item).klabel())); } else if (item instanceof KVariable) { if (item.att().contains(Sort.class)) { Sort sort = item.att().get(Sort.class); if (cfg.cfg.isCell(sort)) { required.remove(sort); } else { required.clear(); } } else { required.clear(); } } } }
@Override public void apply(KApply k) { if (k.klabel().name().equals("#cells")) { for (int i = 0; i < k.klist().size(); i++) { K item = k.klist().items().get(i); if (item instanceof KVariable) { KVariable var = (KVariable) item; if (var.att().contains(Sort.class)) { Sort sort = var.att().get(Sort.class); if (!cfg.cfg.isCell(sort)) { if (!cellFragmentVars.containsKey(var)) { cellFragmentVars.put(var, new HashSet<>()); } cellFragmentVars.get(var).add(k); } } else { if (!cellFragmentVars.containsKey(var)) { cellFragmentVars.put(var, new HashSet<>()); } cellFragmentVars.get(var).add(k); } } } } else { super.apply(k); } } }.apply(term);
if (var.att().contains(Sort.class)) { Sort sort = var.att().get(Sort.class); if (cfg.cfg.isCell(sort)) { if (!cellVariables.getOrDefault(var, sort).equals(sort)) { Sort prevSort = cellVariables.get(var);
if (cfg.cfg.isCell(sort)) { remainingCells.removeIf(s -> !s.equals(sort));