source: josm/trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSRule.java@ 7064

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.
2package org.openstreetmap.josm.gui.mappaint.mapcss;
3
4import java.util.List;
5
6import org.openstreetmap.josm.gui.mappaint.Environment;
7import org.openstreetmap.josm.tools.Utils;
8
9public 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.