- All Known Subinterfaces:
MediaFeaturePredicate
public interface BooleanCondition
Boolean conditions.
Used by media queries and @supports
conditions.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addCondition
(BooleanCondition subCondition) Add a condition to a boolean condition.void
Append a minified serialization of the condition.void
appendText
(StringBuilder buf) Append a serialization of the condition.If this is aNOT
condition, return the negated condition.Get the parent condition, if any.If this condition is composed by a set of conditions (forming anAND
orOR
expression), return it.getType()
The type of condition.replaceLast
(BooleanCondition newCondition) Replace the last condition added.void
setParentCondition
(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 anAND
orOR
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.
-
getNestedCondition
BooleanCondition getNestedCondition()If this is aNOT
condition, return the negated condition.- Returns:
- the negated condition, or
null
if this condition is not aNOT
condition, or contains no negated condition.
-
getParentCondition
BooleanCondition getParentCondition()Get the parent condition, if any.- Returns:
- the parent condition, or
null
if 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
NOT
condition this adds 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.
-
replaceLast
Replace the last condition added.- Parameters:
newCondition
- the condition that replaces the last condition.- Returns:
- the replaced condition.
-
appendText
Append a serialization of the condition.- Parameters:
buf
- the buffer to append to.
-
appendMinifiedText
Append a minified serialization of the condition.- Parameters:
buf
- the buffer to append to.
-