/** * Recursively resolves the current node with the specified features. Any conditionals for * features contained in <code>features</code> will be replaced with the result of the evaluation. * * @param features The features passed to the aggregator. * @param discovered A map in which all features encountered in the evaluation will be placed. * This will not necessarily contain all features in the dependency expression. Only the ones * in the evaluation chain will be included. * @param coerceUndefinedToFalse If true, then a feature not being defined will be treated the * same as if the feature were defined with a value of false. * @return this node */ public HasNode resolve( Features features, Set<String> discovered, boolean coerceUndefinedToFalse) { if (feature != null && discovered != null) { discovered.add(feature); } if (feature != null && (features.contains(feature) || coerceUndefinedToFalse)) { replaceWith(features.isFeature(feature) ? trueNode : falseNode); resolve(features, discovered, coerceUndefinedToFalse); } if (trueNode != null) { trueNode.resolve(features, discovered, coerceUndefinedToFalse); } if (falseNode != null) { falseNode.resolve(features, discovered, coerceUndefinedToFalse); } return this; }