protected void printFeatures(FSTNode node, boolean start) { if (node.getType().equals("CompilationUnit") || !coveredByParent(node, node.getParent())) { if (start) printToken(startIfdef(FeatureExpressions.get(node))); else printToken(endIfdef(FeatureExpressions.get(node))); } }
/** * extracts the feature name * * @param node `Feature` node or descendant of a `Feature` node. * @return name of the feature this node is a descendant of, e.g. "Base". */ public String getFeatureName(FSTNode node) { if (node.getType().equals("Feature")) return node.getName(); else return getFeatureName(node.getParent()); }
private static String getFeatureName(FSTNode node) { if (node.getType().equals("Feature")) return node.getName().toLowerCase() + (FSTGenComposerExtension.key ? "" : "()"); else return getFeatureName(node.getParent()); }
private boolean coveredByParent(FSTNode node, FSTNode parent) { if (GuidslFileLoader.featureModel.checkCondition( new Implies(FeatureExpressions.get(parent), FeatureExpressions.get(node)))) return true; if (parent.getParent() != null) return coveredByParent(node, parent.getParent()); return false; }