001 // License: GPL. For details, see LICENSE file.
002 package org.openstreetmap.josm.gui.mappaint.mapcss;
003
004 import java.util.List;
005
006 import org.openstreetmap.josm.gui.mappaint.Environment;
007 import org.openstreetmap.josm.tools.Utils;
008
009 public class MapCSSRule {
010
011 public List<Selector> selectors;
012 public List<Instruction> declaration;
013
014 public MapCSSRule(List<Selector> selectors, List<Instruction> declaration) {
015 this.selectors = selectors;
016 this.declaration = declaration;
017 }
018
019 /**
020 * <p>Executes the instructions against the environment {@code env}</p>
021 *
022 * @param env the environment
023 */
024 public void execute(Environment env) {
025 for (Instruction i : declaration) {
026 i.execute(env);
027 }
028 }
029
030 @Override
031 public String toString() {
032 return Utils.join(",", selectors) + " {\n " + Utils.join("\n ", declaration) + "\n}";
033 }
034 }
035