use of il.org.spartan.Leonidas.plugin.leonidas.BasicBlocks.GenericEncapsulator in project Main by SpartanRefactoring.
the class Replacer method getReplacingForest.
/**
* @param m the mapping between generic element index to concrete elements of the user.
* @param r rewrite object
* @return the template of the replacer with the concrete elements inside it.
*/
private List<PsiElement> getReplacingForest(List<Encapsulator> rootsCopy, Map<Integer, List<PsiElement>> m, PsiRewrite r) {
List<PsiElement> elements = new LinkedList<>();
rootsCopy.forEach(rootCopy -> {
if (rootCopy.isGeneric()) {
GenericEncapsulator ge = az.generic(rootCopy);
elements.addAll(ge.replaceByRange(m.get(az.generic(rootCopy).getId()), m, r));
} else {
rootCopy.accept(e -> {
if (!e.isGeneric())
return;
GenericEncapsulator ge = az.generic(e);
ge.replaceByRange(m.get(ge.getId()), m, r);
});
elements.add(rootCopy.getInner());
}
});
return elements;
}
Aggregations