public class Environment extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
IPrimitive |
child
The same for parent selector.
|
java.util.Set<IPrimitive> |
children
Set of matched children filled by ContainsFinder and CrossingFinder, null if nothing matched
|
private Condition.Context |
context |
java.lang.Integer |
count
count of nodes in parent way or members in parent relation.
|
static java.lang.String |
DEFAULT_LAYER
The name of the default layer.
|
java.lang.Integer |
index
index of node in parent way or member in parent relation.
|
java.lang.String |
layer
The current MapCSS layer
|
MultiCascade |
mc
The cascades that are currently evaluated
|
IPrimitive |
osm
The primitive that is currently evaluated
|
IPrimitive |
parent
If not null, this is the matching parent object if a condition or an expression
is evaluated in a
Selector.LinkSelector (within a child selector) |
StyleSource |
source
The style source that is evaluated
|
| Constructor and Description |
|---|
Environment()
Creates a new uninitialized environment.
|
Environment(Environment other)
Creates a clone of the environment
other. |
Environment(IPrimitive osm)
Creates a new environment.
|
Environment(IPrimitive osm,
MultiCascade mc,
java.lang.String layer,
StyleSource source)
Creates a new environment.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clearSelectorMatchingInformation()
Clears all matching context information
|
Cascade |
getCascade(java.lang.String layer)
Gets the current cascade for a given layer
|
Condition.Context |
getContext()
Replies the current context.
|
java.lang.String |
getRole()
Gets the role of the matching primitive in the relation
|
boolean |
hasParentRelation()
Determines if this environment has a relation as parent.
|
boolean |
isLinkContext()
Determines if the context of this environment is
Condition.Context.LINK. |
Environment |
withChild(IPrimitive child)
Creates a clone of this environment, with the specified child.
|
Environment |
withChildAndIndexAndLinkContext(IPrimitive child,
int index,
int count)
Creates a clone of this environment, with the specified child, index, and context set to
Condition.Context.LINK. |
Environment |
withContext(Condition.Context context)
Creates a clone of this environment, with the specified
Condition.Context. |
Environment |
withIndex(int index,
int count)
Creates a clone of this environment, with the specified index.
|
Environment |
withLinkContext()
Creates a clone of this environment, with context set to
Condition.Context.LINK. |
Environment |
withParent(IPrimitive parent)
Creates a clone of this environment, with the specified parent.
|
Environment |
withParentAndIndexAndLinkContext(IPrimitive parent,
int index,
int count)
Creates a clone of this environment, with the specified parent, index, and context set to
Condition.Context.LINK. |
Environment |
withPrimitive(IPrimitive osm)
Creates a clone of this environment, with the specified primitive.
|
public IPrimitive osm
public MultiCascade mc
public java.lang.String layer
public StyleSource source
private Condition.Context context
public static final java.lang.String DEFAULT_LAYER
public IPrimitive parent
Selector.LinkSelector (within a child selector)public IPrimitive child
public java.lang.Integer index
public java.lang.Integer count
public java.util.Set<IPrimitive> children
public Environment()
public Environment(IPrimitive osm)
osm - OSM primitivepublic Environment(IPrimitive osm, MultiCascade mc, java.lang.String layer, StyleSource source)
osm - OSM primitivemc - multi cascadelayer - layersource - style sourcepublic Environment(Environment other)
other.other - the other environment. Must not be null.java.lang.IllegalArgumentException - if param is nullpublic Environment withPrimitive(IPrimitive osm)
osm - OSM primitiveosmpublic Environment withParent(IPrimitive parent)
parent - the matching parent objectparentpublic Environment withParentAndIndexAndLinkContext(IPrimitive parent, int index, int count)
Condition.Context.LINK.parent - the matching parent objectindex - index of node in parent way or member in parent relationcount - count of nodes in parent way or members in parent relationCondition.Context.LINKparent,
indexpublic Environment withChild(IPrimitive child)
child - the matching child objectchildpublic Environment withChildAndIndexAndLinkContext(IPrimitive child, int index, int count)
Condition.Context.LINK.child - the matching child objectindex - index of node in parent way or member in parent relationcount - count of nodes in parent way or members in parent relationContext#LINKchild,
indexpublic Environment withIndex(int index, int count)
index - index of node in parent way or member in parent relationcount - count of nodes in parent way or members in parent relationindexpublic Environment withContext(Condition.Context context)
Condition.Context.context - contextContextpublic Environment withLinkContext()
Condition.Context.LINK.Context#LINKpublic boolean isLinkContext()
Condition.Context.LINK.true if the context of this environment is Context#LINK, false otherwisepublic boolean hasParentRelation()
true if this environment has a relation as parent, false otherwiseparentpublic Condition.Context getContext()
public java.lang.String getRole()
public void clearSelectorMatchingInformation()
public Cascade getCascade(java.lang.String layer)
layer - The layer to use, null to use the layer of the Environment