use of mb.nabl2.terms.unification.IUnifier in project nabl by metaborg.
the class TermMultiset method add.
public void add(ITerm term, int n, IUnifier unifier) {
final ITerm rep = unifier.findRecursive(term);
for (ITermVar var : rep.getVars().elementSet()) {
varTerms.put(var, rep);
}
terms.add(rep, n);
}
use of mb.nabl2.terms.unification.IUnifier in project nabl by metaborg.
the class VarMultiset method add.
public boolean add(ITermVar var, int n, IUnifier unifier) {
final Multiset<ITermVar> reps = unifier.findRecursive(var).getVars();
boolean change = false;
for (ITermVar rep : reps) {
vars.add(rep, n);
change |= n > 0;
}
return change;
}
use of mb.nabl2.terms.unification.IUnifier in project nabl by metaborg.
the class VarMultiset method count.
public int count(ITermVar var, IUnifier unifier) {
final Multiset<ITermVar> reps = unifier.findRecursive(var).getVars();
int n = 0;
for (ITermVar rep : reps.elementSet()) {
n += vars.count(rep);
}
return n;
}
use of mb.nabl2.terms.unification.IUnifier in project nabl by metaborg.
the class TermMultiset method remove.
public int remove(ITerm term, int n, IUnifier unifier) {
final ITerm rep = unifier.findRecursive(term);
final int prev_n = terms.remove(rep, n);
if (prev_n <= n) {
varTerms.values().remove(rep);
}
return Math.min(prev_n, n);
}
use of mb.nabl2.terms.unification.IUnifier in project nabl by metaborg.
the class VarMultiset method remove.
public boolean remove(ITermVar var, int n, IUnifier unifier) {
final Multiset<ITermVar> reps = unifier.findRecursive(var).getVars();
boolean change = false;
for (ITermVar rep : reps) {
int prev_n = vars.remove(rep, n);
change |= prev_n > 0 && n > 0;
}
return change;
}
Aggregations