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() |
|
CompoundSelector(java.util.List<SimpleSelector> selectors,
java.util.List<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) |
(package private) boolean |
applies(Styleable styleable,
java.util.Set<PseudoClass>[] triggerStates,
int depth) |
(package private) Match |
createMatch() |
boolean |
equals(java.lang.Object obj) |
java.util.List<Combinator> |
getRelationships()
The relationships between the selectors
|
java.util.List<SimpleSelector> |
getSelectors()
The selectors that make up this compound selector
|
int |
hashCode() |
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() |
void |
writeBinary(java.io.DataOutputStream os,
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
public CompoundSelector(java.util.List<SimpleSelector> selectors, java.util.List<Combinator> relationships)
private CompoundSelector()
public java.util.List<SimpleSelector> getSelectors()
public java.util.List<Combinator> getRelationships()
Match createMatch()
createMatch
in class Selector
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
private 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
public final void writeBinary(java.io.DataOutputStream os, StringStore stringStore) throws java.io.IOException
writeBinary
in class Selector
java.io.IOException
public static CompoundSelector readBinary(int bssVersion, java.io.DataInputStream is, java.lang.String[] strings) throws java.io.IOException
java.io.IOException