- All Known Subinterfaces:
DeclarationCondition,DeclarationPredicate,MediaFeature,MediaFeaturePredicate,MediaQueryPredicate,SelectorFunction
public interface BooleanCondition
Boolean conditions.
Used by media queries and @supports conditions.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCondition(BooleanCondition subCondition) Add a condition to a boolean condition.default voidAppend a minified serialization of the condition to the given buffer.voidappendText(StringBuilder buf) Append a serialization of the condition to the given buffer.If this is aNOTcondition, return the negated condition.Get the parent condition, if any.If this condition is composed by a set of conditions (forming anANDorORexpression), return it.getType()The type of condition.replaceLast(BooleanCondition newCondition) Replace the last nested/sub condition added.voidsetParentCondition(BooleanCondition parent) Set the parent condition, if this condition is nested into another.
-
Method Details
-
getType
BooleanCondition.Type getType()The type of condition.- Returns:
- the condition type.
-
getSubConditions
List<BooleanCondition> getSubConditions()If this condition is composed by a set of conditions (forming anANDorORexpression), return it.The set of sub-conditions is returned as a list in specified order.
- Returns:
- the list of sub-conditions, or
nullif this condition contains no sub-conditions (i.e.NOTorPREDICATE).
-
getNestedCondition
BooleanCondition getNestedCondition()If this is aNOTcondition, return the negated condition.- Returns:
- the negated condition, or
nullif this condition is not aNOTcondition, or contains no negated condition.
-
getParentCondition
BooleanCondition getParentCondition()Get the parent condition, if any.- Returns:
- the parent condition, or
nullif none.
-
setParentCondition
Set the parent condition, if this condition is nested into another.- Parameters:
parent- the parent condition.
-
addCondition
Add a condition to a boolean condition.On a
NOTcondition 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
Replace the last nested/sub condition added.- Parameters:
newCondition- the condition that replaces the last condition.- Returns:
- the replaced condition.
-
appendText
Append a serialization of the condition to the given buffer.- Parameters:
buf- the buffer to append to.
-
appendMinifiedText
Append a minified serialization of the condition to the given buffer.- Parameters:
buf- the buffer to append to.
-