Changeset 15983 in josm for trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSRule.java
- Timestamp:
- 2020-03-01T23:35:55+01:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.