public final class CompoundSelector extends Selector
Selectors
, along with an array of
CompoundSelectorRelationships
indicating the required relationship at each
stage. There must be exactly one less Combinator
than
there are selectors.
For example, the parameters [selector1, selector2, selector3]
and [Combinator.CHILD, Combinator.DESCENDANT]
will match
a component when all of the following conditions hold:
selector1 > selector2 selector3
. The greater-than (>)
between selector1 and selector2 specifies a direct CHILD, whereas the
whitespace between selector2 and selector3 corresponds to
Combinator.DESCENDANT
.Modifier and Type | Field and Description |
---|---|
private int |
hash |
private java.util.List<Combinator> |
relationships |
private java.util.List<SimpleSelector> |
selectors |
Modifier | Constructor and Description |
---|---|
private |
CompoundSelector() |
(package private) |
CompoundSelector(java.util.List<SimpleSelector> selectors,
java.util.List<Combinator> relationships)
Creates a
CompoundSelector from a list of selectors and a
list of Combinator relationships. |
Modifier and Type | Method and Description |
---|---|
boolean |
applies(Styleable styleable) |
private boolean |
applies(Styleable styleable,
int index,
java.util.Set<PseudoClass>[] triggerStates,
int depth) |
boolean |
applies(Styleable styleable,
java.util.Set<PseudoClass>[] triggerStates,
int depth) |
Match |
createMatch() |
boolean |
equals(java.lang.Object obj) |
java.util.List<SimpleSelector> |
getSelectors()
The selectors that make up this compound selector
|
int |
hashCode() |
(package private) static CompoundSelector |
readBinary(int bssVersion,
java.io.DataInputStream is,
java.lang.String[] strings) |
boolean |
stateMatches(Styleable styleable,
java.util.Set<PseudoClass> states)
Determines whether the current state of the node and its parents
matches the pseudo-classes defined (if any) for this selector.
|
private boolean |
stateMatches(Styleable styleable,
java.util.Set<PseudoClass> states,
int index) |
java.lang.String |
toString() |
protected void |
writeBinary(java.io.DataOutputStream os,
StyleConverter.StringStore stringStore) |
createSelector, getOrdinal, getRule, getUniversalSelector, setOrdinal, setRule
private final java.util.List<SimpleSelector> selectors
private final java.util.List<Combinator> relationships
private int hash
CompoundSelector(java.util.List<SimpleSelector> selectors, java.util.List<Combinator> relationships)
CompoundSelector
from a list of selectors and a
list of Combinator
relationships. There must be exactly one
less Combinator
than there are selectors.private CompoundSelector()
public java.util.List<SimpleSelector> getSelectors()
public Match createMatch()
createMatch
in class Selector
public boolean applies(Styleable styleable, java.util.Set<PseudoClass>[] triggerStates, int depth)
private boolean applies(Styleable styleable, int index, java.util.Set<PseudoClass>[] triggerStates, int depth)
public boolean stateMatches(Styleable styleable, java.util.Set<PseudoClass> states)
Selector
stateMatches
in class Selector
styleable
- the styleablestates
- the statetrue
if the current state of the node and its parents
matches the pseudo-classes defined (if any) for this selectorprivate boolean stateMatches(Styleable styleable, java.util.Set<PseudoClass> states, int index)
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
protected final void writeBinary(java.io.DataOutputStream os, StyleConverter.StringStore stringStore) throws java.io.IOException
writeBinary
in class Selector
java.io.IOException
static CompoundSelector readBinary(int bssVersion, java.io.DataInputStream is, java.lang.String[] strings) throws java.io.IOException
java.io.IOException