static class MapCSSTagChecker.TagCheck extends Object implements Predicate<OsmPrimitive>
Modifier and Type | Class and Description |
---|---|
(package private) static class |
MapCSSTagChecker.TagCheck.PrimitiveToTag
A function mapping the matched
OsmPrimitive to a Tag . |
Modifier and Type | Field and Description |
---|---|
protected List<String> |
alternatives |
protected Map<String,Boolean> |
assertions |
protected List<MapCSSTagChecker.TagCheck.PrimitiveToTag> |
change |
protected boolean |
deletion |
protected Map<Instruction.AssignmentInstruction,Severity> |
errors |
protected Map<String,String> |
keyChange |
(package private) static String |
POSSIBLE_THROWS |
protected MapCSSTagChecker.GroupedMapCSSRule |
rule |
protected Set<String> |
setClassExpressions |
Constructor and Description |
---|
MapCSSTagChecker.TagCheck(MapCSSTagChecker.GroupedMapCSSRule rule) |
Modifier and Type | Method and Description |
---|---|
(package private) static String |
determineArgument(Selector.GeneralSelector matchingSelector,
int index,
String type)
|
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. |
Set<String> |
getClassesIds()
Returns the list of ids of all MapCSS classes referenced in the rule selectors.
|
(package private) String |
getDescription(OsmPrimitive p)
Constructs a (localized) description for this deprecation check.
|
(package private) 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) String |
getMessage(OsmPrimitive p)
Constructs a (localized) message for this deprecation check.
|
(package private) Severity |
getSeverity() |
Set<MapCSSTagChecker.TagCheck> |
getTagCheckDependencies(Collection<MapCSSTagChecker.TagCheck> schecks)
Returns the set of tagchecks on which this check depends on.
|
(package private) static String |
insertArguments(Selector matchingSelector,
String s)
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 String |
possibleThrows() |
(package private) static List<MapCSSTagChecker.TagCheck> |
readMapCSS(MapCSSParser css) |
(package private) static List<MapCSSTagChecker.TagCheck> |
readMapCSS(Reader css) |
private static void |
removeMetaRules(MapCSSStyleSource source) |
String |
toString() |
(package private) Selector |
whichSelectorMatchesEnvironment(Environment env) |
(package private) Selector |
whichSelectorMatchesPrimitive(OsmPrimitive primitive) |
protected final MapCSSTagChecker.GroupedMapCSSRule rule
protected final List<MapCSSTagChecker.TagCheck.PrimitiveToTag> change
protected final List<String> alternatives
protected final Map<Instruction.AssignmentInstruction,Severity> errors
protected final Map<String,Boolean> assertions
protected final Set<String> setClassExpressions
protected boolean deletion
static final String POSSIBLE_THROWS
MapCSSTagChecker.TagCheck(MapCSSTagChecker.GroupedMapCSSRule rule)
static final String possibleThrows()
static MapCSSTagChecker.TagCheck ofMapCSSRule(MapCSSTagChecker.GroupedMapCSSRule rule) throws IllegalDataException
IllegalDataException
static List<MapCSSTagChecker.TagCheck> readMapCSS(Reader css) throws ParseException
ParseException
static List<MapCSSTagChecker.TagCheck> readMapCSS(MapCSSParser 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 String determineArgument(Selector.GeneralSelector matchingSelector, int index, String type)
static String insertArguments(Selector matchingSelector, String s)
{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
String getMessage(OsmPrimitive p)
String getDescription(OsmPrimitive p)
getDescriptionForMatchingSelector(org.openstreetmap.josm.data.osm.OsmPrimitive, org.openstreetmap.josm.gui.mappaint.mapcss.Selector)
String getDescriptionForMatchingSelector(OsmPrimitive p, Selector matchingSelector)
Severity getSeverity()
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 Set<MapCSSTagChecker.TagCheck> getTagCheckDependencies(Collection<MapCSSTagChecker.TagCheck> schecks)
schecks
- the collection of tagcheks to search inpublic Set<String> getClassesIds()