- 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 TypeMethodDescriptionvoid
addCondition
(BooleanCondition subCondition) Add a condition to a boolean condition.default void
Append a minified serialization of the condition to the given buffer.void
appendText
(StringBuilder buf) Append a serialization of the condition to the given buffer.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 nested/sub 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 (i.e.NOT
orPREDICATE
).
-
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 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.
-