Changeset 15983 in josm
- Timestamp:
- 2020-03-01T23:35:55+01:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
r15982 r15983 47 47 import org.openstreetmap.josm.gui.mappaint.MultiCascade; 48 48 import org.openstreetmap.josm.gui.mappaint.mapcss.Condition; 49 import org.openstreetmap.josm.gui.mappaint.mapcss.Declaration; 49 50 import org.openstreetmap.josm.gui.mappaint.mapcss.Expression; 50 51 import org.openstreetmap.josm.gui.mappaint.mapcss.Instruction; 51 52 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSRule; 52 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSRule.Declaration;53 53 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource; 54 54 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource.MapCSSRuleIndex; -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Instruction.java
r15902 r15983 16 16 * For example a simple assignment like <code>width: 3;</code>, but may also 17 17 * be a set instruction (<code>set highway;</code>). 18 * A MapCSS {@link MapCSSRule.Declaration} is a list of instructions.18 * A MapCSS {@link Declaration} is a list of instructions. 19 19 */ 20 20 @FunctionalInterface -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj
r15935 r15983 26 26 import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.KeyMatchType; 27 27 import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.Op; 28 import org.openstreetmap.josm.gui.mappaint.mapcss.Declaration; 28 29 import org.openstreetmap.josm.gui.mappaint.mapcss.Expression; 29 30 import org.openstreetmap.josm.gui.mappaint.mapcss.ExpressionFactory; … … 33 34 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSException; 34 35 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSRule; 35 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSRule.Declaration;36 36 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource; 37 37 import org.openstreetmap.josm.gui.mappaint.mapcss.Selector; -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSRule.java
r15909 r15983 2 2 package org.openstreetmap.josm.gui.mappaint.mapcss; 3 3 4 import java.util.List;5 import java.util.Objects;6 4 import java.util.stream.Collectors; 7 5 8 6 import org.openstreetmap.josm.gui.mappaint.Environment; 9 import org.openstreetmap.josm.gui.mappaint.StyleSource;10 import org.openstreetmap.josm.tools.Utils;11 7 12 8 /** … … 27 23 */ 28 24 public final Declaration declaration; 29 30 /**31 * A declaration is a set of {@link Instruction}s32 */33 public static class Declaration {34 /**35 * The instructions in this declaration36 */37 public final List<Instruction> instructions;38 /**39 * The index of this declaration40 * <p>41 * declarations in the StyleSource are numbered consecutively42 */43 public final int idx;44 45 /**46 * Create a new {@link Declaration}47 * @param instructions The instructions for this dectlaration48 * @param idx The index in the {@link StyleSource}49 */50 public Declaration(List<Instruction> instructions, int idx) {51 this.instructions = Utils.toUnmodifiableList(instructions);52 this.idx = idx;53 }54 55 /**56 * <p>Executes the instructions against the environment {@code env}</p>57 *58 * @param env the environment59 */60 public void execute(Environment env) {61 for (Instruction i : instructions) {62 i.execute(env);63 }64 }65 66 @Override67 public int hashCode() {68 return Objects.hash(instructions, idx);69 }70 71 @Override72 public boolean equals(Object obj) {73 if (this == obj) return true;74 if (obj == null || getClass() != obj.getClass()) return false;75 Declaration that = (Declaration) obj;76 return idx == that.idx &&77 Objects.equals(instructions, that.instructions);78 }79 80 @Override81 public String toString() {82 return "Declaration [instructions=" + instructions + ", idx=" + idx + ']';83 }84 }85 25 86 26 /**
Note:
See TracChangeset
for help on using the changeset viewer.