public static class Selector.ChildOrParentSelector extends Object implements Selector
Represents a child selector or a parent selector.
In addition to the standard CSS notation for child selectors, JOSM also supports an "inverse" notation:
selector_a > selector_b { ... } // the standard notation (child selector) relation[type=route] > way { ... } // example (all ways of a route) selector_a < selector_b { ... } // the inverse notation (parent selector) node[traffic_calming] < way { ... } // example (way that has a traffic calming node)
Modifier and Type | Class and Description |
---|---|
private class |
Selector.ChildOrParentSelector.MatchingReferrerFinder
Finds the first referrer matching
left
The visitor works on an environment and it saves the matching
referrer in e.parent and its relative position in the
list referrers "child list" in e.index . |
Selector.AbstractSelector, Selector.ChildOrParentSelector, Selector.GeneralSelector, Selector.LinkSelector
Modifier and Type | Field and Description |
---|---|
private Selector |
left |
private Selector.LinkSelector |
link |
private boolean |
parentSelector
true, if this represents a parent selector (otherwise it is a child selector)
|
private Selector |
right |
Constructor and Description |
---|
ChildOrParentSelector(Selector a,
Selector.LinkSelector link,
Selector b,
boolean parentSelector) |
Modifier and Type | Method and Description |
---|---|
Range |
getRange() |
String |
getSubpart() |
boolean |
matches(Environment e)
Apply the selector to the primitive and check if it matches.
|
String |
toString() |
private final Selector.LinkSelector link
private final boolean parentSelector
public ChildOrParentSelector(Selector a, Selector.LinkSelector link, Selector b, boolean parentSelector)
a
- the first selectorb
- the second selectorparentSelector
- if true, this is a parent selector; otherwise a child selectorpublic boolean matches(Environment e)
Selector
matches
in interface Selector
e
- the Environment. env.mc and env.layer are read-only when matching a selector.
env.source is not needed. This method will set the matchingReferrers field of env as
a side effect! Make sure to clear it before invoking this method.public String getSubpart()
getSubpart
in interface Selector