public static class MapCSSTagChecker.TagCheck extends java.lang.Object implements Predicate<OsmPrimitive>
Modifier and Type | Field and Description |
---|---|
protected java.util.List<java.lang.String> |
alternatives |
protected java.util.Map<java.lang.String,java.lang.Boolean> |
assertions |
protected boolean |
deletion |
protected java.util.Map<Instruction.AssignmentInstruction,Severity> |
errors |
protected java.util.List<MapCSSTagChecker.FixCommand> |
fixCommands |
private static java.lang.String |
POSSIBLE_THROWS |
protected MapCSSTagChecker.GroupedMapCSSRule |
rule |
protected java.util.Set<java.lang.String> |
setClassExpressions |
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)
|
boolean |
evaluate(OsmPrimitive primitive)
Determines whether the object passes the test or not
|
(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) |
(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) |
java.lang.String |
toString() |
(package private) Selector |
whichSelectorMatchesEnvironment(Environment env) |
(package private) Selector |
whichSelectorMatchesPrimitive(OsmPrimitive primitive) |
protected final MapCSSTagChecker.GroupedMapCSSRule rule
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
protected final java.util.Map<java.lang.String,java.lang.Boolean> assertions
protected final java.util.Set<java.lang.String> setClassExpressions
protected boolean deletion
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 evaluate(OsmPrimitive primitive)
Predicate
evaluate
in interface Predicate<OsmPrimitive>
primitive
- The object to evaluatetrue
if the object passes the test, false
otherwiseSelector whichSelectorMatchesPrimitive(OsmPrimitive primitive)
Selector whichSelectorMatchesEnvironment(Environment env)
static java.lang.String determineArgument(Selector.GeneralSelector matchingSelector, int index, java.lang.String type, OsmPrimitive p)
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
.Command 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)
java.lang.String getDescription(OsmPrimitive p)
getDescriptionForMatchingSelector(org.openstreetmap.josm.data.osm.OsmPrimitive, org.openstreetmap.josm.gui.mappaint.mapcss.Selector)
java.lang.String getDescriptionForMatchingSelector(OsmPrimitive p, Selector matchingSelector)
Severity 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)
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()