org.openstreetmap.josm.gui.mappaint.mapcss
Class Selector.ChildOrParentSelector

java.lang.Object
  extended by org.openstreetmap.josm.gui.mappaint.mapcss.Selector.ChildOrParentSelector
All Implemented Interfaces:
Selector
Enclosing interface:
Selector

public static class Selector.ChildOrParentSelector
extends java.lang.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)
 


Nested Class Summary
private  class Selector.ChildOrParentSelector.MatchingReferrerFinder
          Finds the first referrer matching left
 
Nested classes/interfaces inherited from interface org.openstreetmap.josm.gui.mappaint.mapcss.Selector
Selector.ChildOrParentSelector, Selector.GeneralSelector, Selector.LinkSelector
 
Field Summary
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 Summary
Selector.ChildOrParentSelector(Selector a, Selector.LinkSelector link, Selector b, boolean parentSelector)
           
 
Method Summary
 Range getRange()
           
 java.lang.String getSubpart()
           
 boolean matches(Environment e)
          Apply the selector to the primitive and check if it matches.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

left

private final Selector left

link

private final Selector.LinkSelector link

right

private final Selector right

parentSelector

private final boolean parentSelector
true, if this represents a parent selector (otherwise it is a child selector)

Constructor Detail

Selector.ChildOrParentSelector

public Selector.ChildOrParentSelector(Selector a,
                                      Selector.LinkSelector link,
                                      Selector b,
                                      boolean parentSelector)
Parameters:
a - the first selector
b - the second selector
parentSelector - if true, this is a parent selector; otherwise a child selector
Method Detail

matches

public boolean matches(Environment e)
Description copied from interface: Selector
Apply the selector to the primitive and check if it matches.

Specified by:
matches in interface Selector
Parameters:
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.
Returns:
true, if the selector applies

getSubpart

public java.lang.String getSubpart()
Specified by:
getSubpart in interface Selector

getRange

public Range getRange()
Specified by:
getRange in interface Selector

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


JOSM