public K addImplicitCells(K term) { if (labelInfo.isFunction(term)) return term; return addRootCell(term); }
protected void addLabel(String result, String label, boolean isAssoc) { addLabel(result, label, isAssoc, false, false); }
public boolean isCellCollection(KLabel klabel) { Sort s = labels.getCodomain(klabel); return cfg.isCellCollection(s); }
+ cellType.toString() + " when closing cell " + cell.toString()); LabelInfo.AssocInfo info = labelInfo.getAssocInfo(closeOperator); if (!info.isAssoc() && openLeft && openRight) { throw KEMException.criticalError(
public boolean isFunction(K term) { if (term instanceof KApply && isFunction(((KApply) term).klabel())) { return true; } if (term instanceof KRewrite && ((KRewrite) term).left() instanceof KApply && isFunction(((KApply) ((KRewrite) term).left()).klabel())) { return true; } return false; }
protected void addLabel(Sort result, String label, boolean isAssoc) { addLabel(result, label, isAssoc, false, false); }
public KLabel getCellFragmentLabel(KLabel cellLabel) { Sort s = labels.getCodomain(cellLabel); return cfg.getCellFragmentLabel(s); }
public boolean isFunction(K term) { if (term instanceof KApply && isFunction(((KApply) term).klabel())) { return true; } if (term instanceof KRewrite && ((KRewrite) term).left() instanceof KApply && isFunction(((KApply) ((KRewrite) term).left()).klabel())) { return true; } return false; }
protected void addLabel(String result, String label) { addLabel(result, label, false); }
public Sort getCellSort(KLabel cellLabel) { Sort s = labels.getCodomain(cellLabel); return cfg.isCell(s) ? s : null; }
if (!labelInfo.isFunction(term)) { new VisitK() { private boolean inKCell = false;
protected void addLabel(Sort result, String label) { addLabel(result, label, false); }
public List<Sort> getChildren(KLabel label) { return cfg.getChildren(labels.getCodomain(label)); }
private K apply(K term) { if (labelInfo.isFunction(term)) return term; List<K> items = IncompleteCellUtils.flattenCells(term); if (items.size() != 1) { return term; } K item = items.get(0); if (isCell(item)) { return term; } else if (item instanceof KRewrite) { final KRewrite rew = (KRewrite) item; if (Stream.concat( IncompleteCellUtils.flattenCells(rew.left()).stream(), IncompleteCellUtils.flattenCells(rew.right()).stream()) .anyMatch(this::isCell)) { return term; } } KLabel computation = cfg.getCellLabel(cfg.getComputationCell()); return IncompleteCellUtils.make(computation, false, item, true); }
public int getLevel(KLabel label) { return cfg.getLevel(labels.getCodomain(label)); }
public ConfigurationInfo.Multiplicity getMultiplicity(KLabel label) { return cfg.getMultiplicity(labels.getCodomain(label)); } public ConfigurationInfo.Multiplicity getMultiplicity(Sort sort) {
public boolean isLeafCell(KLabel klabel) { return cfg.isLeafCell(labels.getCodomain(klabel)); } public boolean isParentCell(KLabel klabel) {
public Sort leafCellType(KLabel label) { return cfg.leafCellType(labels.getCodomain(label)); } public List<Sort> getChildren(KLabel label) {
public KLabel getParent(KLabel klabel) { return getParent(labels.getCodomain(klabel)); }
public Sort getCellSort(K k) { if (k instanceof KApply) { return labels.getCodomain(((KApply) k).klabel()); } else if (k instanceof KVariable) { return k.att().get(Sort.class); } else { throw new AssertionError("expected KApply or KVariable, found " + k.getClass().getSimpleName()); } }