Interface BooleanCondition

All Known Subinterfaces:
DeclarationCondition, MediaFeature, MediaFeaturePredicate, MediaQueryPredicate

public interface BooleanCondition
Boolean conditions.

Used by media queries and @supports conditions.

  • Method Details

    • getType

      The type of condition.
      Returns:
      the condition type.
    • getSubConditions

      List<BooleanCondition> getSubConditions()
      If this condition is composed by a set of conditions (forming an AND or OR expression), return it.

      The set of sub-conditions is returned as a list in specified order.

      Returns:
      the list of sub-conditions, or null if this condition contains no sub-conditions (i.e. NOT or PREDICATE).
    • getNestedCondition

      BooleanCondition getNestedCondition()
      If this is a NOT condition, return the negated condition.
      Returns:
      the negated condition, or null if this condition is not a NOT condition, or contains no negated condition.
    • getParentCondition

      BooleanCondition getParentCondition()
      Get the parent condition, if any.
      Returns:
      the parent condition, or null if none.
    • setParentCondition

      void setParentCondition(BooleanCondition parent)
      Set the parent condition, if this condition is nested into another.
      Parameters:
      parent - the parent condition.
    • addCondition

      void addCondition(BooleanCondition subCondition)
      Add a condition to a boolean condition.

      On a NOT condition this sets the negated condition, for grouping conditions (AND, OR), adds a condition to the set of sub-conditions.

      On a PREDICATE, should either do nothing or throw a runtime exception (behaviour is implementation-dependent).

      Parameters:
      subCondition - the sub-condition (or the negated condition).
    • replaceLast

      BooleanCondition replaceLast(BooleanCondition newCondition)
      Replace the last nested/sub condition added.
      Parameters:
      newCondition - the condition that replaces the last condition.
      Returns:
      the replaced condition.
    • appendText

      void appendText(StringBuilder buf)
      Append a serialization of the condition to the given buffer.
      Parameters:
      buf - the buffer to append to.
    • appendMinifiedText

      void appendMinifiedText(StringBuilder buf)
      Append a minified serialization of the condition to the given buffer.
      Parameters:
      buf - the buffer to append to.