public static class MapCSSStyleSource.MapCSSRuleIndex extends java.lang.Object
MapCSSRule
s, that are indexed by tag key and value.
Speeds up the process of finding all rules that match a certain primitive.
Rules with a Condition.SimpleKeyValueCondition
[key=value] are indexed by
key and value in a HashMap. Now you only need to loop the tags of a
primitive to retrieve the possibly matching rules.
Rules with no SimpleKeyValueCondition in the selector have to be
checked separately.
The order of rules gets mixed up by this and needs to be sorted later.Modifier and Type | Field and Description |
---|---|
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Set<MapCSSRule>>> |
index |
java.util.Set<MapCSSRule> |
remaining |
java.util.List<MapCSSRule> |
rules |
Constructor and Description |
---|
MapCSSRuleIndex() |
Modifier and Type | Method and Description |
---|---|
void |
add(MapCSSRule rule) |
void |
clear()
Clear the index.
|
java.util.Collection<MapCSSRule> |
getRuleCandidates(OsmPrimitive osm)
Get a subset of all rules that might match the primitive.
|
void |
initIndex()
Initialize the index.
|
public final java.util.List<MapCSSRule> rules
public final java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Set<MapCSSRule>>> index
public final java.util.Set<MapCSSRule> remaining
public MapCSSRuleIndex()
public void add(MapCSSRule rule)
public void initIndex()
public java.util.Collection<MapCSSRule> getRuleCandidates(OsmPrimitive osm)
osm
- the primitive to matchpublic void clear()