All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.linuxforhealth.core.expression.condition.ConditionBiPredicates Maven / Gradle / Ivy

/*
 * (C) Copyright IBM Corp. 2020, 2021
 *
 * SPDX-License-Identifier: Apache-2.0
 */
package io.github.linuxforhealth.core.expression.condition;

import java.util.function.BiPredicate;
import org.apache.commons.lang3.StringUtils;

/**
 * This is a static class that defines different types of Rule predicates and their operations.
 * 
 * @author [email protected]
 *
 */

public class ConditionBiPredicates {

  public static final BiPredicate GREATER_THAN = (x, y) -> x > y;
  public static final BiPredicate EQUAL_TO = (x, y) -> x.equals(y);
  public static final BiPredicate NOT_EQUAL_TO = (x, y) -> !x.equals(y);
  public static final BiPredicate LESS_THAN = (x, y) -> x < y;
  public static final BiPredicate GREATER_THAN_OR_EQUAL_TO = (x, y) -> x >= y;
  public static final BiPredicate LESS_THAN_OR_EQUAL_TO = (x, y) -> x <= y;

  public static final BiPredicate EQUALS_IC = StringUtils::equalsIgnoreCase;
  public static final BiPredicate NOT_EQUALS = EQUALS_IC.negate();

  public static final BiPredicate STARTS_WITH = StringUtils::startsWithIgnoreCase;
  public static final BiPredicate NOT_STARTS_WITH = STARTS_WITH.negate();

  public static final BiPredicate ENDS_WITH = StringUtils::endsWithIgnoreCase;
  public static final BiPredicate NOT_ENDS_WITH = ENDS_WITH.negate();

  public static final BiPredicate CONTAINS = StringUtils::containsIgnoreCase;
  public static final BiPredicate NOT_CONTAINS = CONTAINS.negate();

  private ConditionBiPredicates() {}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy