Last change
on this file since 7064 was 7064, checked in by bastiK, 10 years ago |
see #9691 - add back reverted optimization [7056] (modified so it is thread safe)
|
-
Property svn:eol-style
set to
native
|
File size:
1.2 KB
|
Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.mappaint.mapcss;
|
---|
3 |
|
---|
4 | import java.util.List;
|
---|
5 |
|
---|
6 | import org.openstreetmap.josm.gui.mappaint.Environment;
|
---|
7 | import org.openstreetmap.josm.tools.Utils;
|
---|
8 |
|
---|
9 | public class MapCSSRule {
|
---|
10 |
|
---|
11 | public final Selector selector;
|
---|
12 | public final Declaration declaration;
|
---|
13 |
|
---|
14 | public static class Declaration {
|
---|
15 | public final List<Instruction> instructions;
|
---|
16 | // declarations in the StyleSource are numbered consecutively
|
---|
17 | public final int idx;
|
---|
18 |
|
---|
19 | public Declaration(List<Instruction> instructions, int idx) {
|
---|
20 | this.instructions = instructions;
|
---|
21 | this.idx = idx;
|
---|
22 | }
|
---|
23 | }
|
---|
24 |
|
---|
25 | public MapCSSRule(Selector selector, Declaration declaration) {
|
---|
26 | this.selector = selector;
|
---|
27 | this.declaration = declaration;
|
---|
28 | }
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * <p>Executes the instructions against the environment {@code env}</p>
|
---|
32 | *
|
---|
33 | * @param env the environment
|
---|
34 | */
|
---|
35 | public void execute(Environment env) {
|
---|
36 | for (Instruction i : declaration.instructions) {
|
---|
37 | i.execute(env);
|
---|
38 | }
|
---|
39 | }
|
---|
40 |
|
---|
41 | @Override
|
---|
42 | public String toString() {
|
---|
43 | return selector + " {\n " + Utils.join("\n ", declaration.instructions) + "\n}";
|
---|
44 | }
|
---|
45 | }
|
---|
46 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.