public static class MapCSSTagChecker.TagCheck extends java.lang.Object implements java.util.function.Predicate<OsmPrimitive>
Modifier and Type | Field and Description |
---|---|
protected java.util.List<java.lang.String> |
alternatives
Tags (or arbitraty strings) of alternatives to be presented to the user
|
protected java.util.Map<java.lang.String,java.lang.Boolean> |
assertions
Unit tests
|
protected boolean |
deletion
Denotes whether the object should be deleted for fixing it
|
protected java.util.Map<Instruction.AssignmentInstruction,Severity> |
errors
|
protected java.util.List<MapCSSTagChecker.FixCommand> |
fixCommands
Commands to apply in order to fix a matching primitive
|
protected java.lang.String |
group
A string used to group similar tests
|
private static java.lang.String |
POSSIBLE_THROWS |
protected MapCSSTagChecker.GroupedMapCSSRule |
rule
The selector of this
TagCheck |
protected java.util.Set<java.lang.String> |
setClassExpressions
MapCSS Classes to set on matching primitives
|
Constructor and Description |
---|
TagCheck(MapCSSTagChecker.GroupedMapCSSRule rule) |
Modifier and Type | Method and Description |
---|---|
(package private) static java.lang.String |
determineArgument(Selector.GeneralSelector matchingSelector,
int index,
java.lang.String type,
OsmPrimitive p)
|
(package private) Command |
fixPrimitive(OsmPrimitive p)
Constructs a fix in terms of a
Command for the OsmPrimitive
if the error is fixable, or null otherwise. |
java.util.Set<java.lang.String> |
getClassesIds()
Returns the list of ids of all MapCSS classes referenced in the rule selectors.
|
(package private) java.lang.String |
getDescription(OsmPrimitive p)
Constructs a (localized) description for this deprecation check.
|
(package private) java.lang.String |
getDescriptionForMatchingSelector(OsmPrimitive p,
Selector matchingSelector)
Constructs a (localized) description for this deprecation check
where any placeholders are replaced by values of the matched selector.
|
(package private) TestError |
getErrorForPrimitive(OsmPrimitive p)
Constructs a
TestError for the given primitive, or returns null if the primitive does not give rise to an error. |
(package private) TestError |
getErrorForPrimitive(OsmPrimitive p,
Selector matchingSelector,
Environment env,
Test tester) |
(package private) java.lang.String |
getMessage(OsmPrimitive p)
Constructs a (localized) message for this deprecation check.
|
(package private) Severity |
getSeverity() |
java.util.Set<MapCSSTagChecker.TagCheck> |
getTagCheckDependencies(java.util.Collection<MapCSSTagChecker.TagCheck> schecks)
Returns the set of tagchecks on which this check depends on.
|
(package private) static java.lang.String |
insertArguments(Selector matchingSelector,
java.lang.String s,
OsmPrimitive p)
Replaces occurrences of
{i.key} , {i.value} , {i.tag} in s by the corresponding
key/value/tag of the index -th Condition of matchingSelector . |
(package private) static MapCSSTagChecker.TagCheck |
ofMapCSSRule(MapCSSTagChecker.GroupedMapCSSRule rule) |
(package private) static java.lang.String |
possibleThrows() |
(package private) static MapCSSTagChecker.ParseResult |
readMapCSS(java.io.Reader css) |
private static void |
removeMetaRules(MapCSSStyleSource source) |
boolean |
test(OsmPrimitive primitive) |
java.lang.String |
toString() |
(package private) Selector |
whichSelectorMatchesEnvironment(Environment env) |
(package private) Selector |
whichSelectorMatchesPrimitive(OsmPrimitive primitive) |
protected final MapCSSTagChecker.GroupedMapCSSRule rule
TagCheck
protected final java.util.List<MapCSSTagChecker.FixCommand> fixCommands
protected final java.util.List<java.lang.String> alternatives
protected final java.util.Map<Instruction.AssignmentInstruction,Severity> errors
Instruction.AssignmentInstruction
-Severity
pair.
Is evaluated on the matching primitive to give the error message. Map is checked to contain exactly one element.protected final java.util.Map<java.lang.String,java.lang.Boolean> assertions
protected final java.util.Set<java.lang.String> setClassExpressions
protected boolean deletion
protected java.lang.String group
private static final java.lang.String POSSIBLE_THROWS
TagCheck(MapCSSTagChecker.GroupedMapCSSRule rule)
static final java.lang.String possibleThrows()
static MapCSSTagChecker.TagCheck ofMapCSSRule(MapCSSTagChecker.GroupedMapCSSRule rule) throws IllegalDataException
IllegalDataException
static MapCSSTagChecker.ParseResult readMapCSS(java.io.Reader css) throws ParseException
ParseException
private static void removeMetaRules(MapCSSStyleSource source)
public boolean test(OsmPrimitive primitive)
test
in interface java.util.function.Predicate<OsmPrimitive>
Selector whichSelectorMatchesPrimitive(OsmPrimitive primitive)
Selector whichSelectorMatchesEnvironment(Environment env)
static java.lang.String determineArgument(Selector.GeneralSelector matchingSelector, int index, java.lang.String type, OsmPrimitive p)
matchingSelector
- matching selectorindex
- indextype
- selector type ("key", "value" or "tag")p
- OSM primitivenull
static java.lang.String insertArguments(Selector matchingSelector, java.lang.String s, OsmPrimitive p)
{i.key}
, {i.value}
, {i.tag}
in s
by the corresponding
key/value/tag of the index
-th Condition
of matchingSelector
.matchingSelector
- matching selectors
- any stringp
- OSM primitiveCommand fixPrimitive(OsmPrimitive p)
Command
for the OsmPrimitive
if the error is fixable, or null
otherwise.p
- the primitive to construct the fix fornull
java.lang.String getMessage(OsmPrimitive p)
p
- OSM primitivejava.lang.String getDescription(OsmPrimitive p)
p
- OSM primitivegetDescriptionForMatchingSelector(org.openstreetmap.josm.data.osm.OsmPrimitive, org.openstreetmap.josm.gui.mappaint.mapcss.Selector)
java.lang.String getDescriptionForMatchingSelector(OsmPrimitive p, Selector matchingSelector)
matchingSelector
- matching selectorp
- OSM primitiveSeverity getSeverity()
public java.lang.String toString()
toString
in class java.lang.Object
TestError getErrorForPrimitive(OsmPrimitive p)
TestError
for the given primitive, or returns null if the primitive does not give rise to an error.p
- the primitive to construct the error forTestError
, or returns null if the primitive does not give rise to an error.TestError getErrorForPrimitive(OsmPrimitive p, Selector matchingSelector, Environment env, Test tester)
public java.util.Set<MapCSSTagChecker.TagCheck> getTagCheckDependencies(java.util.Collection<MapCSSTagChecker.TagCheck> schecks)
schecks
- the collection of tagcheks to search inpublic java.util.Set<java.lang.String> getClassesIds()