Ejemplo n.º 1
0
 /**
  * Evaluate the has plugin for the given set of features.
  *
  * @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 The evaluated resource based on provided features. If a lack of features prevents us
  *     from being able to determine the resource, then null is returned. If the required features
  *     are provided but the evaluation results in no module name, then the empty string is
  *     returned.
  */
 public String evaluate(
     Features features, Set<String> discovered, boolean coerceUndefinedToFalse) {
   if (feature != null && discovered != null) {
     discovered.add(feature);
   }
   if (feature == null) {
     return nodeName;
   } else if (!coerceUndefinedToFalse && !features.contains(feature)) {
     return null;
   } else {
     if (features.isFeature(feature)) {
       return trueNode.evaluate(features, discovered, coerceUndefinedToFalse);
     } else {
       return falseNode.evaluate(features, discovered, coerceUndefinedToFalse);
     }
   }
 }