Returns <code>true</code> if a rule is 'IN' or 'EQUALS' on the attribute that should be
expanded
344448
private boolean isTransformableRule(QueryRule nestedRule, String expandAttribute) {
    return nestedRule != null
        && nestedRule.getField() != null
        && nestedRule.getField().equals(expandAttribute)
        && (nestedRule.getOperator() == QueryRule.Operator.IN
            || nestedRule.getOperator() == QueryRule.Operator.EQUALS);
  }
1030552
public static boolean validate(BiMap<Character, ObfuscationRule<Character, Character>> rules)
	{
		Set<Character> keySet = rules.keySet();
		for (Entry<Character, ObfuscationRule<Character, Character>> entry : rules.entrySet())
		{
			ObfuscationRule<Character, Character> value = entry.getValue();
			if (keySet.contains(value.getReplaceWith()))
			{
				return false;
			}
		}
		return true;
	}
1089858
private boolean matchesField(Format.Field attribute, int field) {
        if (this.attribute != null) {
            return this.attribute.equals(attribute);
        }
        return (field == this.field);
    }
1227601
private static boolean isValuelessAttribute(String attribName) {
    boolean valueless = VALUELESS_ATTRIB_NAMES.contains(
        Strings.toLowerCase(attribName));
    return valueless;
  }
387766
def attribute_match(equality, value)
      regexp = value.is_a?(Regexp) ? value : Regexp.escape(value.to_s)
      case equality
        when "=" then
          # Match the attribute value in full
          Regexp.new("^#{regexp}$")
        when "~=" then
          # Match a space-separated word within the attribute value
          Regexp.new("(^|\s)#{regexp}($|\s)")
        when "^="
          # Match the beginning of the attribute value
          Regexp.new("^#{regexp}")
        when "$="
          # Match the end of the attribute value
          Regexp.new("#{regexp}$")
        when "*="
          # Match substring of the attribute value
          regexp.is_a?(Regexp) ? regexp : Regexp.new(regexp)
        when "|=" then
          # Match the first space-separated item of the attribute value
          Regexp.new("^#{regexp}($|\s)")
        else
          raise InvalidSelectorError, "Invalid operation/value" unless value.empty?
          # Match all attributes values (existence check)
          //
      end
    end
1151996
private boolean isBroader(AttributeType enrichedTypeGuess, AttributeType columnTypeGuess) {
    if (columnTypeGuess == null && enrichedTypeGuess != null || columnTypeGuess == null) {
      return true;
    }

    switch (columnTypeGuess) {
      case INT:
        return enrichedTypeGuess.equals(INT)
            || enrichedTypeGuess.equals(LONG)
            || enrichedTypeGuess.equals(DECIMAL)
            || enrichedTypeGuess.equals(STRING)
            || enrichedTypeGuess.equals(TEXT);

      case DECIMAL:
        return enrichedTypeGuess.equals(DECIMAL)
            || enrichedTypeGuess.equals(DATE)
            || enrichedTypeGuess.equals(DATE_TIME)
            || enrichedTypeGuess.equals(STRING)
            || enrichedTypeGuess.equals(TEXT);
      case LONG:
        return enrichedTypeGuess.equals(LONG)
            || enrichedTypeGuess.equals(DECIMAL)
            || enrichedTypeGuess.equals(DATE)
            || enrichedTypeGuess.equals(DATE_TIME)
            || enrichedTypeGuess.equals(STRING)
            || enrichedTypeGuess.equals(TEXT);
      case BOOL:
        return enrichedTypeGuess.equals(STRING) || enrichedTypeGuess.equals(TEXT);
      case STRING:
        return enrichedTypeGuess.equals(STRING) || enrichedTypeGuess.equals(TEXT);
      case DATE_TIME:
        return enrichedTypeGuess.equals(STRING) || enrichedTypeGuess.equals(TEXT);
      case DATE:
        return enrichedTypeGuess.equals(STRING) || enrichedTypeGuess.equals(TEXT);
      default:
        return false;
    }
  }
1360233
public MultipleRuleContext<DPO, RI, RO> check(Rule<RI, RO> rule) {
        if (rule != null) {
            addedRules.add(rule);
        }

        // Stay in the same context and re-use the same instance because no type has changed
        return this;
    }
615705
def evaluate(attributes = {})
      return true unless rules.any?
      if evaluation_logic == 'any'
        !!rules.detect { |rule| rule.evaluate(attributes) }
      else
        rules.each do |rule|
          return false unless rule.evaluate(attributes)
        end
        true
      end
    end
764072
private boolean isSetAttribute(PluralAttribute<? super X, ?, ?> attribute)
    {
        return attribute != null && attribute.getCollectionType().equals(CollectionType.SET);
    }
871516
public boolean hasRuleBlock(String name) {
        for (RuleBlock ruleBlock : this.ruleBlocks) {
            if (ruleBlock.getName().equals(name)) {
                return true;
            }
        }
        return false;
    }
342680
public boolean isRule(final String symbol) {
    return ((symbol != null) && (RULES.contains(symbol.toLowerCase(Locale.ENGLISH))));
  }
678829
function hasParentRule(rule) {
  if (!rule.parent) {
    return false
  }

  if (rule.parent.type === 'rule') {
    return true
  }

  return hasParentRule(rule.parent)
}
497828
function (elements, rule, type) {
            var foundElements = [];
            // The length is a special case, where the placeholders
            // of the search pattern (X,Y) first must be replaced by
            // the value(s) specified in the attribute.
            if (type === "length") {
                for (var i = 0; i < elements.length; i++) {
                    // Length attribute is not a substitute for the
                    // required attribute. Length just states what
                    // min/max-length an element should have, if it
                    // is filled in.
                    if (elements[i].value === "")
                        continue;
                    var length = elements[i].getAttribute("data-length");
                    var format = elements[i].getAttribute("data-format");
                    // Format can be either max or min. The length
                    // attribute combined with the format attribute
                    // must only contain one digit for it to be
                    // considered valid.
                    if (format === "max") {
                        if (/^([0-9]$)/.test(length))
                            var string = new RegExp(rule.replace("X,Y", "0," + length));
                        else
                            continue;
                    } else if (format === "min") {
                        if (/^([0-9]$)/.test(length))
                            var string = new RegExp(rule.replace("X,Y", length + ","));
                        else
                            continue
                    } else {
                        // Even if a format attribute is not set, the validation
                        // of the element should differ, depending on how the
                        // length attribute is set up.
                        if (/^([0-9]\,[0-9]$)/.test(length))
                            // Normal case, a max and min is specified ("1,5").
                            var string = new RegExp(rule.replace("X,Y", length));
                        else if (/^([0-9]\,$)/.test(length))
                            // A single digit with a comma at the end is to be
                            // considered minimum length ("1,")
                            var string = new RegExp(rule.replace("X,Y", length));
                        else if (/^([0-9]$)/.test(length))
                            // A single digit without a comma should be treated
                            // as max length, but for the regex to work a zero
                            // needs to be added at the beginning. ("5") => ("0,5")
                            var string = new RegExp(rule.replace("X,Y", "0," + length));
                        else
                            // If none of the above checks out it is not a valid
                            // value, skip this one and move to the next.
                            continue;
                    }
                    if (string.test(elements[i].value) === false)
                        foundElements.push(elements[i]);
                }
            } else if (type === "date") {
                // Date is also a special case, where the regex pattern
                // needs to be build depending on the format specified.
                // The date delimiter can be almost any non-word
                // character, therefore the regex pattern \W.
                var delimiterPattern = new RegExp(/([\W])/), delimiterMatches;
                for (var i = 0; i < elements.length; i++) {
                    var elementValue = elements[i].value;
                    if (elementValue.length < 1)
                        continue;
                    // Retrieve the date format from the element
                    var format = elements[i].getAttribute("data-format");
                    if (format === null)
                        format = this.settings.dateFormat;
                    if ((delimiterMatches = delimiterPattern.exec(format)) !== null) {
                        var dateComponents = format.split(delimiterMatches[0]);
                        var dateBrokenDown = elementValue.split(delimiterMatches[0]);
                        var date = [];
                        // Begin building the date pattern
                        var validDatePattern = "^(";
                        for (var x = 0; x < dateComponents.length; x++) {
                            // Create an array out of the components and inputed date
                            // for later use, to make sure that it is an actual date.
                            var key = dateComponents[x][0].toUpperCase();
                            date[key] = dateBrokenDown[x];
                            // Dates and months should have an interval-length,
                            // so that if they are set to max 2 digits (MM) the
                            // user should not have to write a leading zero, as
                            // this often isn't how date parsers read a date.
                            if (key !== "Y")
                                var length = "1," + dateComponents[x].length;
                            else
                                var length = dateComponents[x].length;
                            validDatePattern += "\\d{" + length + "}";
                            // Add the delimiter, but not to the last digit.
                            if (dateComponents.length > x+1)
                                validDatePattern += "\\" + delimiterMatches[0];
                        }
                        // Close the date pattern.
                        validDatePattern += ")$";
                        var validDate = new RegExp(validDatePattern);
                        if (validDate.test(elementValue) === false) {
                            foundElements.push(elements[i]);
                        } else {
                            // Even if the date has the right format, it may not be an
                            // actual date. This will make sure that the date exists.
                            // The year must be four digits, so add the first two digits
                            // if they are missing.
                            if (date["Y"].length == 2)
                                date["Y"] = new Date().getFullYear().toString().substr(0,2) + date["Y"];
                            // Also, remove 0 if month and date begins with one.
                            date["M"] = date["M"].replace(/^0/, '');
                            date["D"] = date["D"].replace(/^0/, '');
                            // Create the date object, and retrieve the individual
                            // components to compare it to the inputed date. If the
                            // date is wrong, the parsed date will not be the same
                            // as the user inputed one (JS will parse for example
                            // 31st of february as a valid date).
                            var dateObject = new Date(date["Y"], (date["M"]-1), date["D"]);
                            var dateParsed = dateObject.getFullYear() +''+ (dateObject.getMonth()+1) +''+ dateObject.getDate();
                            var dateString = date["Y"] +''+ date["M"] +''+ date["D"];
                            if (dateParsed !== dateString)
                                foundElements.push(elements[i]);
                        }
                    }
                }
            } else {
                var string = new RegExp(rule);
                for (var i = 0; i < elements.length; i++) {
                    if (string.test(elements[i].value) === false) {
                        if (type === "required" ||
                            type !== "required" && elements[i].value.length > 0)
                            foundElements.push(elements[i]);
                    }

                }

            }
            return foundElements;
        }
1250062
function expandElementRule (element, selectors = [], originalRule) {
  /** early return if we don't have any selectors */
  if (selectors.length === 0) return []

  let usedProps = []
  let expandedRules = []
  let defaultRules = []

  /** create the base rule */
  const baseRule = originalRule.clone()
  baseRule.selectors = selectors
  baseRule.selector = replaceElementTagMentions(element, baseRule.selector)

  /** create postcss rules for each element rule */
  for (const [ ruleSelector, ruleDecls ] of Object.entries(element.rules)) {
    const isRoot = element.pseudos.root === ruleSelector
    const isDefault = element.defaults.includes(ruleSelector)
    const expandedRule = baseRule.clone()

    /** gather all rules that get decls be default */
    if (isDefault) { defaultRules.push(expandedRule) }

    /** map all the selectors to target this rule selector */
    if (!isRoot) { expandedRule.selectors = expandedRule.selectors.map((selector) => `${selector} ${ruleSelector}`) }

    /** strip any non whitelisted props, run tranforms, gather used props */
    expandedRule.walkDecls((decl) => {
      const matchedRuleDecls = ruleDecls.filter(({ prop }) => prop.test(decl.prop))

      if (matchedRuleDecls.length === 0) { return decl.remove() }

      usedProps.push(decl.prop)
      matchedRuleDecls.forEach(({ transform }) => transform(decl, originalRule))
    })

    expandedRules.push(expandedRule)
  }

  baseRule.walkDecls((decl) => {
    if (!usedProps.includes(decl.prop)) {
      defaultRules.forEach((defaultRule) => defaultRule.prepend(decl.clone()))
    }
  })

  return expandedRules
}
632215
protected boolean isExpanded(Map<String,String> parameters)
    {
        String all = parameters.get("expanded");
        return all != null && Boolean.valueOf(all);
    }
232525
private boolean matches(EvaluationContext ctx, Object[] params, DTDecisionRule rule) {
        for( int i = 0; i < params.length; i++ ) {
            CompiledExpression compiledInput = inputs.get(i).getCompiledInput();
            if ( compiledInput instanceof CompiledFEELExpression) {
                ctx.setValue("?", ((CompiledFEELExpression) compiledInput).apply(ctx));
            }
            if( ! satisfies( ctx, params[i], rule.getInputEntry().get( i ) ) ) {
                return false;
            }
        }
        return true;
    }
460062
public boolean hasDouble(String attributeName) {
        String attr = attributes.get(attributeName);
        if (attr == null || attr.isEmpty()) {
            return false;
        }
        try {
            Double.parseDouble(attr);
            return true;
        } catch (NumberFormatException ex) {
            return false;
        }
    }