java.lang.Object
org.opendaylight.yangtools.yang.model.api.stmt.IfFeatureExpr
All Implemented Interfaces:
Predicate<FeatureSet>, Immutable

public abstract sealed class IfFeatureExpr extends Object implements Immutable, Predicate<FeatureSet>
A resolved if-feature expression, implementing a Predicate. Internal representation is that of a tree of expressions, optimized for memory usage. negate() performs an efficient logical negation without relying on default predicate methods. Other Predicate methods, like Predicate.and(Predicate) are not optimized in this implementation.

The set of features referenced in this expression is available through getReferencedFeatures().

  • Constructor Details

    • IfFeatureExpr

      public IfFeatureExpr()
  • Method Details

    • isPresent

      public static final @NonNull IfFeatureExpr isPresent(QName qname)
      Construct an assertion that a feature is present in the set passed to test(FeatureSet).
      Parameters:
      qname - Feature QName
      Returns:
      An expression
      Throws:
      NullPointerException - if qname is null
    • and

      public static final @NonNull IfFeatureExpr and(Set<IfFeatureExpr> exprs)
      Construct a intersection (logical AND) expression of specified expressions.
      Parameters:
      exprs - Constituent expressions
      Returns:
      An expression
      Throws:
      NullPointerException - if exprs or any of its members is null
      IllegalArgumentException - if exprs is empty
    • or

      public static final @NonNull IfFeatureExpr or(Set<IfFeatureExpr> exprs)
      Construct a union (logical OR) expression of specified expressions.
      Parameters:
      exprs - Constituent expressions
      Returns:
      An expression
      Throws:
      NullPointerException - if exprs or any of its members is null
      IllegalArgumentException - if exprs is empty
    • getReferencedFeatures

      public abstract @NonNull Set<QName> getReferencedFeatures()
      Returns the set of all features referenced by this expression. Each feature is identified by its QName.
      Returns:
      The set of referenced features. Mutability of the returned Set and order of features is undefined.
    • negate

      public abstract @NonNull IfFeatureExpr negate()
      Specified by:
      negate in interface Predicate<FeatureSet>
    • test

      public abstract boolean test(FeatureSet supportedFeatures)
      Specified by:
      test in interface Predicate<FeatureSet>
    • hashCode

      public abstract int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public abstract boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public abstract String toString()
      Overrides:
      toString in class Object