Changeset 8415 in josm
- Timestamp:
- 2015-05-22T21:15:05+02:00 (9 years ago)
- Location:
- trunk
- Files:
-
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadSessionTask.java
r8093 r8415 22 22 23 23 private static final String PATTERN_SESSION = "https?://.*/.*\\.jo(s|z)"; 24 24 25 25 private Loader loader; 26 27 /**28 * Constructs a new {@code DownloadSessionTask}.29 */30 public DownloadSessionTask() {31 }32 26 33 27 @Override … … 75 69 /** 76 70 * Do not allow to load a session file via remotecontrol. 77 * 71 * 78 72 * Session importers can be added by plugins and there is currently 79 73 * no way to ensure that these are safe for remotecontol. -
trunk/src/org/openstreetmap/josm/data/imagery/Shape.java
r8394 r8415 21 21 public class Shape { 22 22 23 private List<Coordinate> coords = new ArrayList<>();23 private final List<Coordinate> coords = new ArrayList<>(); 24 24 25 25 public Shape(String asString, String separator) { … … 33 33 } 34 34 35 /** 36 * Constructs a new empty {@code Shape}. 37 */ 35 38 public Shape() { 39 // shape contents can be set later with addPoint() 36 40 } 37 41 … … 107 111 return true; 108 112 } 109 110 111 113 } -
trunk/src/org/openstreetmap/josm/data/oauth/OAuthParameters.java
r8291 r8415 113 113 */ 114 114 public OAuthParameters() { 115 // contents can be set later with setters 115 116 } 116 117 -
trunk/src/org/openstreetmap/josm/data/osm/NodeData.java
r8365 r8415 19 19 */ 20 20 public NodeData() { 21 21 // contents can be set later with setters 22 22 } 23 23 -
trunk/src/org/openstreetmap/josm/data/osm/RelationData.java
r7005 r8415 11 11 private List<RelationMemberData> members = new ArrayList<>(); 12 12 13 /** 14 * Constructs a new {@code RelationData}. 15 */ 13 16 public RelationData() { 14 17 // contents can be set later with setters 15 18 } 16 19 20 /** 21 * Constructs a new {@code RelationData}. 22 * @param data relation data to copy 23 */ 17 24 public RelationData(RelationData data) { 18 25 super(data); -
trunk/src/org/openstreetmap/josm/data/osm/TagCollection.java
r8338 r8415 27 27 * A TagCollection can be created: 28 28 * <ul> 29 * <li>from the tags managed by a specific {@link org.openstreetmap.josm.data.osm.OsmPrimitive} with {@link #from(org.openstreetmap.josm.data.osm.Tagged)}</li> 30 * <li>from the union of all tags managed by a collection of {@link org.openstreetmap.josm.data.osm.OsmPrimitive}s with {@link #unionOfAllPrimitives(java.util.Collection)}</li> 31 * <li>from the union of all tags managed by a {@link org.openstreetmap.josm.data.osm.DataSet} with {@link #unionOfAllPrimitives(org.openstreetmap.josm.data.osm.DataSet)}</li> 32 * <li>from the intersection of all tags managed by a collection of primitives with {@link #commonToAllPrimitives(java.util.Collection)}</li> 29 * <li>from the tags managed by a specific {@link org.openstreetmap.josm.data.osm.OsmPrimitive} 30 * with {@link #from(org.openstreetmap.josm.data.osm.Tagged)}</li> 31 * <li>from the union of all tags managed by a collection of {@link org.openstreetmap.josm.data.osm.OsmPrimitive}s 32 * with {@link #unionOfAllPrimitives(java.util.Collection)}</li> 33 * <li>from the union of all tags managed by a {@link org.openstreetmap.josm.data.osm.DataSet} 34 * with {@link #unionOfAllPrimitives(org.openstreetmap.josm.data.osm.DataSet)}</li> 35 * <li>from the intersection of all tags managed by a collection of primitives 36 * with {@link #commonToAllPrimitives(java.util.Collection)}</li> 33 37 * </ul> 34 38 * … … 36 40 * 37 41 * Basic set operations allow to create the union, the intersection and the difference 38 * of tag collections, see {@link #union(org.openstreetmap.josm.data.osm.TagCollection)}, {@link #intersect(org.openstreetmap.josm.data.osm.TagCollection)},39 * and {@link #minus(org.openstreetmap.josm.data.osm.TagCollection)}.42 * of tag collections, see {@link #union(org.openstreetmap.josm.data.osm.TagCollection)}, 43 * {@link #intersect(org.openstreetmap.josm.data.osm.TagCollection)}, and {@link #minus(org.openstreetmap.josm.data.osm.TagCollection)}. 40 44 * 41 * 45 * @since 2008 42 46 */ 43 47 public class TagCollection implements Iterable<Tag> { … … 145 149 146 150 /** 147 * Creates an empty tag collection 151 * Creates an empty tag collection. 148 152 */ 149 153 public TagCollection() { 154 // contents can be set later with add() 150 155 } 151 156 -
trunk/src/org/openstreetmap/josm/data/osm/WayData.java
r8376 r8415 11 11 private List<Long> nodes = new ArrayList<>(); 12 12 13 /** 14 * Constructs a new {@code NodeData}. 15 */ 13 16 public WayData() { 14 17 // contents can be set later with setters 15 18 } 16 19 20 /** 21 * Constructs a new {@code WayData}. 22 * @param data way data to copy 23 */ 17 24 public WayData(WayData data) { 18 25 super(data); -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapRendererFactory.java
r8291 r8415 35 35 * 36 36 * </pre> 37 * 37 * @since 4087 38 38 */ 39 39 public final class MapRendererFactory { … … 45 45 46 46 public static class MapRendererFactoryException extends RuntimeException { 47 public MapRendererFactoryException() {48 }49 47 50 48 public MapRendererFactoryException(String message, Throwable cause) { -
trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java
r8393 r8415 120 120 */ 121 121 public CustomProjection() { 122 // contents can be set later with update() 122 123 } 123 124 -
trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShift.java
r8308 r8415 55 55 */ 56 56 public NTV2GridShift() { 57 } 58 57 // contents can be set later with setters 58 } 59 60 /** 61 * Constructs a new {@code NTV2GridShift} from a {@code LatLon}. 62 * @param p lat/lon 63 */ 59 64 public NTV2GridShift(LatLon p) { 60 65 setLatDegrees(p.lat()); -
trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShiftFile.java
r8379 r8415 83 83 private NTV2SubGrid lastSubGrid; 84 84 85 /**86 * Constructs a new {@code NTV2GridShiftFile}.87 */88 public NTV2GridShiftFile() {89 }90 91 85 private void readBytes(InputStream in, byte[] b) throws IOException { 92 86 if (in.read(b) < b.length) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
r8404 r8415 163 163 final String s; 164 164 if (obj instanceof Expression) { 165 s = (String) ((Expression) obj).evaluate(new Environment( ).withPrimitive(p));165 s = (String) ((Expression) obj).evaluate(new Environment(p)); 166 166 } else if (obj instanceof String) { 167 167 s = (String) obj; … … 371 371 372 372 Selector whichSelectorMatchesPrimitive(OsmPrimitive primitive) { 373 return whichSelectorMatchesEnvironment(new Environment( ).withPrimitive(primitive));373 return whichSelectorMatchesEnvironment(new Environment(primitive)); 374 374 } 375 375 … … 475 475 return String.valueOf( 476 476 val instanceof Expression 477 ? ((Expression) val).evaluate(new Environment( ).withPrimitive(p))477 ? ((Expression) val).evaluate(new Environment(p)) 478 478 : val 479 479 ); … … 522 522 */ 523 523 TestError getErrorForPrimitive(OsmPrimitive p) { 524 final Environment env = new Environment( ).withPrimitive(p);524 final Environment env = new Environment(p); 525 525 return getErrorForPrimitive(p, whichSelectorMatchesEnvironment(env), env); 526 526 } -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r8404 r8415 77 77 */ 78 78 public class MainApplication extends Main { 79 79 80 /** 80 * Allow subclassing (see JOSM.java)81 * Constructs a new {@code MainApplication}. 81 82 */ 82 public MainApplication() {} 83 public MainApplication() { 84 // Allow subclassing (see JOSM.java) 85 } 83 86 84 87 /** … … 200 203 OFFLINE(true), 201 204 /** --skip-plugins */ 202 SKIP_PLUGINS(false), 203 ; 205 SKIP_PLUGINS(false); 204 206 205 207 private final String name; … … 225 227 public boolean requiresArgument() { 226 228 return requiresArg; 227 }228 229 public static Map<Option, Collection<String>> fromStringMap(Map<String, Collection<String>> opts) {230 Map<Option, Collection<String>> res = new EnumMap<>(Option.class);231 for (Map.Entry<String, Collection<String>> e : opts.entrySet()) {232 Option o = Option.valueOf(e.getKey().toUpperCase(Locale.ENGLISH).replace("-", "_"));233 if (o != null) {234 res.put(o, e.getValue());235 }236 }237 return res;238 229 } 239 230 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RunnableAction.java
r6084 r8415 8 8 public abstract class RunnableAction extends AbstractAction implements Runnable { 9 9 10 public RunnableAction() {11 }12 13 10 @Override 14 11 public abstract void run(); -
trunk/src/org/openstreetmap/josm/gui/io/UploadSelectionDialog.java
r8308 r8415 179 179 180 180 public OsmPrimitiveList() { 181 super(new OsmPrimitiveListModel()); 182 init(); 181 this(new OsmPrimitiveListModel()); 183 182 } 184 183 … … 195 194 static class OsmPrimitiveListModel extends AbstractListModel<OsmPrimitive> { 196 195 private transient List<OsmPrimitive> data; 197 198 public OsmPrimitiveListModel() {199 }200 196 201 197 protected void sort() { … … 216 212 } 217 213 218 public OsmPrimitiveListModel(List<OsmPrimitive> data) {219 setPrimitives(data);220 }221 222 214 public void setPrimitives(List<OsmPrimitive> data) { 223 215 this.data = data; -
trunk/src/org/openstreetmap/josm/gui/mappaint/Environment.java
r8291 r8415 47 47 * Creates a new uninitialized environment. 48 48 */ 49 public Environment() {} 49 public Environment() { 50 // environment can be initialized later through with* methods 51 } 52 53 /** 54 * Creates a new environment. 55 * @since 8415 56 */ 57 public Environment(OsmPrimitive osm) { 58 this.osm = osm; 59 } 50 60 51 61 /** -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java
r8345 r8415 256 256 @Override 257 257 public void visit(Way w) { 258 if (e.child == null && left.matches(new Environment( ).withPrimitive(w))) {258 if (e.child == null && left.matches(new Environment(w))) { 259 259 if (e.osm instanceof Way && Geometry.PolygonIntersection.CROSSING.equals(Geometry.polygonIntersection(w.getNodes(), ((Way) e.osm).getNodes()))) { 260 260 e.child = w; … … 272 272 @Override 273 273 public void visit(Node n) { 274 if (e.child == null && left.matches(new Environment( ).withPrimitive(n))) {274 if (e.child == null && left.matches(new Environment(n))) { 275 275 if (e.osm instanceof Way && Geometry.nodeInsidePolygon(n, ((Way) e.osm).getNodes()) 276 276 || e.osm instanceof Relation && ((Relation) e.osm).isMultipolygon() && Geometry.isNodeInsideMultiPolygon(n, (Relation) e.osm, null)) { … … 282 282 @Override 283 283 public void visit(Way w) { 284 if (e.child == null && left.matches(new Environment( ).withPrimitive(w))) {284 if (e.child == null && left.matches(new Environment(w))) { 285 285 if (e.osm instanceof Way && Geometry.PolygonIntersection.FIRST_INSIDE_SECOND.equals(Geometry.polygonIntersection(w.getNodes(), ((Way) e.osm).getNodes())) 286 286 || e.osm instanceof Relation && ((Relation) e.osm).isMultipolygon() && Geometry.isPolygonInsideMultiPolygon(w.getNodes(), (Relation) e.osm, null)) { … … 317 317 final Relation multipolygon = multipolygons.iterator().next(); 318 318 if (multipolygon == null) throw new NoSuchElementException(); 319 containsFinder = new ContainsFinder(new Environment( ).withPrimitive(multipolygon)) {319 containsFinder = new ContainsFinder(new Environment(multipolygon)) { 320 320 @Override 321 321 public boolean isPrimitiveUsable(OsmPrimitive p) { -
trunk/src/org/openstreetmap/josm/gui/mappaint/xml/Prototype.java
r6986 r8415 20 20 } 21 21 22 /** 23 * Constructs a new {@code Prototype}. 24 */ 22 25 public Prototype() { 26 // Allows subclassing 23 27 } 24 28 -
trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java
r8390 r8415 519 519 sessionId.userName = osmUserName; 520 520 if (canceled) 521 throw new OsmTransferCanceledException( );521 throw new OsmTransferCanceledException("Authorization canceled"); 522 522 monitor.worked(1); 523 523 … … 525 525 authenticateOsmSession(sessionId, osmUserName, osmPassword); 526 526 if (canceled) 527 throw new OsmTransferCanceledException( );527 throw new OsmTransferCanceledException("Authorization canceled"); 528 528 monitor.worked(1); 529 529 … … 531 531 sendAuthorisationRequest(sessionId, requestToken, privileges); 532 532 if (canceled) 533 throw new OsmTransferCanceledException( );533 throw new OsmTransferCanceledException("Authorization canceled"); 534 534 monitor.worked(1); 535 535 … … 537 537 logoutOsmSession(sessionId); 538 538 if (canceled) 539 throw new OsmTransferCanceledException( );539 throw new OsmTransferCanceledException("Authorization canceled"); 540 540 monitor.worked(1); 541 541 } catch(OsmOAuthAuthorizationException e) { -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java
r8413 r8415 141 141 142 142 /** 143 * Constru xts a new {@code PresetListEntry}, uninitialized.143 * Constructs a new {@code PresetListEntry}, uninitialized. 144 144 */ 145 145 public PresetListEntry() { -
trunk/src/org/openstreetmap/josm/gui/widgets/DisableShortcutsOnFocusGainedTextField.java
r8399 r8415 29 29 30 30 /** 31 * Constructs a new <code>TextField</code>. A default model is created, 32 * the initial string is <code>null</code>, 33 * and the number of columns is set to 0. 31 * Constructs a new <code>TextField</code>. A default model is created, 32 * the initial string is <code>null</code>, and the number of columns is set to 0. 34 33 */ 35 34 public DisableShortcutsOnFocusGainedTextField() { 35 // Contents can be set with parent methods 36 36 } 37 37 38 38 /** 39 39 * Constructs a new <code>TextField</code> initialized with the 40 * specified text. A default model is created and the number of 41 * columns is 0. 40 * specified text. A default model is created and the number of columns is 0. 42 41 * 43 42 * @param text the text to be displayed, or <code>null</code> … … 48 47 49 48 /** 50 * Constructs a new empty <code>TextField</code> with the specified 51 * number of columns. 52 * A default model is created and the initial string is set to 53 * <code>null</code>. 49 * Constructs a new empty <code>TextField</code> with the specified number of columns. 50 * A default model is created and the initial string is set to <code>null</code>. 54 51 * 55 52 * @param columns the number of columns to use to calculate 56 53 * the preferred width; if columns is set to zero, the 57 * preferred width will be whatever naturally results from 58 * the component implementation 54 * preferred width will be whatever naturally results from the component implementation 59 55 */ 60 56 public DisableShortcutsOnFocusGainedTextField(int columns) { … … 69 65 * @param columns the number of columns to use to calculate 70 66 * the preferred width; if columns is set to zero, the 71 * preferred width will be whatever naturally results from 72 * the component implementation 67 * preferred width will be whatever naturally results from the component implementation 73 68 */ 74 69 public DisableShortcutsOnFocusGainedTextField(String text, int columns) { -
trunk/src/org/openstreetmap/josm/gui/widgets/JosmHTMLEditorKit.java
r7937 r8415 12 12 public class JosmHTMLEditorKit extends HTMLEditorKit { 13 13 14 /**15 * Constructs a new {@code JosmHTMLEditorKit}16 */17 public JosmHTMLEditorKit() {18 }19 20 14 protected StyleSheet ss = super.getStyleSheet(); 21 15 22 16 /** 23 17 * Set the set of styles to be used to render the various HTML elements. 24 * These styles are specified in terms of CSS specifications. 18 * These styles are specified in terms of CSS specifications. 25 19 * Each document produced by the kit will have a copy of the sheet which 26 * it can add the document specific styles to. 27 * 28 * Unlike the base implementation, the StyleSheet specified is NOT shared 20 * it can add the document specific styles to. 21 * 22 * Unlike the base implementation, the StyleSheet specified is NOT shared 29 23 * by all HTMLEditorKit instances, to provide a finer granularity. 30 24 … … 38 32 /** 39 33 * Get the set of styles currently being used to render the HTML elements. 40 * 41 * Unlike the base implementation, the StyleSheet specified is NOT shared 34 * 35 * Unlike the base implementation, the StyleSheet specified is NOT shared 42 36 * by all HTMLEditorKit instances, to provide a finer granularity. 43 * 37 * 44 38 * @see #setStyleSheet 45 39 */ -
trunk/src/org/openstreetmap/josm/gui/widgets/MultiSplitLayout.java
r8413 r8415 1051 1051 1052 1052 /** 1053 * Create a Leaf node. 1053 * Create a Leaf node. The default value of name is "". 1054 1054 */ 1055 1055 public Leaf() { 1056 1057 } 1058 1059 /** 1060 * Create a Leaf node with the specified name. Name can not 1061 * be null. 1056 // Name can be set later with setName() 1057 } 1058 1059 /** 1060 * Create a Leaf node with the specified name. Name can not be null. 1062 1061 * 1063 1062 * @param name value of the Leaf's name property … … 1095 1094 sb.append(" \"") 1096 1095 .append(getName()) 1097 .append('\"') 1098 .append(" weight=") 1096 .append("\" weight=") 1099 1097 .append(getWeight()) 1100 1098 .append(' ') -
trunk/src/org/openstreetmap/josm/gui/widgets/TextContextualPopupMenu.java
r8308 r8415 74 74 */ 75 75 protected TextContextualPopupMenu() { 76 // Restricts visibility 76 77 } 77 78 -
trunk/src/org/openstreetmap/josm/io/ChangesetQuery.java
r8394 r8415 50 50 /** a collection of changeset ids to query for */ 51 51 private Collection<Long> changesetIds = null; 52 53 /**54 * Constructs a new {@code ChangesetQuery}.55 */56 public ChangesetQuery() {57 58 }59 52 60 53 /** -
trunk/src/org/openstreetmap/josm/io/OsmApi.java
r8394 r8415 562 562 } 563 563 if (cancel) 564 throw new OsmTransferCanceledException( );564 throw new OsmTransferCanceledException("Operation canceled" + (i > 0 ? " in retry #"+i : "")); 565 565 try { 566 566 Thread.sleep(1000); -
trunk/src/org/openstreetmap/josm/io/OsmChangeReader.java
r8291 r8415 30 30 */ 31 31 protected OsmChangeReader() { 32 // Restricts visibility 32 33 } 33 34 -
trunk/src/org/openstreetmap/josm/io/OsmReader.java
r8378 r8415 78 78 */ 79 79 protected OsmReader() { 80 // Restricts visibility 80 81 } 81 82 -
trunk/src/org/openstreetmap/josm/io/OsmServerReader.java
r8390 r8415 143 143 } 144 144 if (cancel) 145 throw new OsmTransferCanceledException( );145 throw new OsmTransferCanceledException("Operation canceled"); 146 146 if (Main.pref.getBoolean("osm-server.use-compression", true)) { 147 147 activeConnection.setRequestProperty("Accept-Encoding", "gzip, deflate"); … … 171 171 172 172 if (activeConnection.getResponseCode() == HttpURLConnection.HTTP_PROXY_AUTH) 173 throw new OsmTransferCanceledException( );173 throw new OsmTransferCanceledException("Proxy Authentication Required"); 174 174 175 175 String encoding = activeConnection.getContentEncoding(); -
trunk/src/org/openstreetmap/josm/io/OsmTransferCanceledException.java
r7509 r8415 8 8 9 9 /** 10 * Constructs a new {@code OsmTransferCanceledException}, without root cause. 10 * Constructs a new {@code OsmTransferCanceledException}, without message. 11 * @param message The detail message (which is saved for later retrieval by the {@link #getMessage} method) 12 * @since 8415 11 13 */ 12 public OsmTransferCanceledException( ) {13 14 public OsmTransferCanceledException(String message) { 15 super(message); 14 16 } 15 17 -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java
r8395 r8415 276 276 public static class RequestHandlerException extends Exception { 277 277 278 /** 279 * Constructs a new {@code RequestHandlerException}. 280 * @param message the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method. 281 */ 278 282 public RequestHandlerException(String message) { 279 283 super(message); 280 284 } 285 286 /** 287 * Constructs a new {@code RequestHandlerException}. 288 * @param message the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method. 289 * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). 290 */ 281 291 public RequestHandlerException(String message, Throwable cause) { 282 292 super(message, cause); 283 293 } 294 295 /** 296 * Constructs a new {@code RequestHandlerException}. 297 * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). 298 */ 284 299 public RequestHandlerException(Throwable cause) { 285 300 super(cause); 286 }287 public RequestHandlerException() {288 301 } 289 302 } -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ChildOrParentSelectorTest.groovy
r7081 r8415 140 140 r.addMember(new RelationMember("another role", w3)) 141 141 142 Environment e = new Environment( ).withPrimitive(r)142 Environment e = new Environment(r) 143 143 assert selector.matches(e) 144 144 } … … 165 165 r.addMember(new RelationMember("another role", w3)) 166 166 167 Environment e = new Environment( ).withPrimitive(w1)167 Environment e = new Environment(w1) 168 168 assert !selector.matches(e) 169 169 170 e = new Environment( ).withPrimitive(w2)170 e = new Environment(w2) 171 171 assert !selector.matches(e) 172 172 173 e = new Environment( ).withPrimitive(w3)173 e = new Environment(w3) 174 174 assert selector.matches(e) 175 175 } -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyConditionTest.groovy
r8206 r8415 77 77 r.addMember(new RelationMember("my_role", n)) 78 78 79 Environment e = new Environment( ).withPrimitive(n).withParent(r).withIndex(0, r.membersCount).withLinkContext()79 Environment e = new Environment(n).withParent(r).withIndex(0, r.membersCount).withLinkContext() 80 80 81 81 Condition cond = Condition.createKeyCondition("my_role", false, null, Context.LINK) … … 92 92 r.addMember(new RelationMember("my_role", n)) 93 93 94 Environment e = new Environment( ).withPrimitive(n).withParent(r).withIndex(0, r.membersCount).withLinkContext()94 Environment e = new Environment(n).withParent(r).withIndex(0, r.membersCount).withLinkContext() 95 95 96 96 Condition cond = Condition.createKeyCondition("another_role", false, null, Context.LINK) -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyValueConditionTest.groovy
r8206 r8415 63 63 r.addMember(new RelationMember("my_role", n)) 64 64 65 Environment e = new Environment( ).withPrimitive(n).withParent(r).withLinkContext().withIndex(0, r.membersCount)65 Environment e = new Environment(n).withParent(r).withLinkContext().withIndex(0, r.membersCount) 66 66 67 67 Condition cond = new Condition.RoleCondition("my_role", Op.EQ) … … 78 78 r.addMember(new RelationMember("my_role", n)) 79 79 80 Environment e = new Environment( ).withPrimitive(n).withParent(r).withIndex(0, r.membersCount).withLinkContext()80 Environment e = new Environment(n).withParent(r).withIndex(0, r.membersCount).withLinkContext() 81 81 82 82 Condition cond = Condition.createKeyValueCondition("role", "my_role", Op.NEQ, Context.LINK, false) -
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.groovy
r7938 r8415 19 19 20 20 protected static Environment getEnvironment(String key, String value) { 21 return new Environment( ).withPrimitive(OsmUtils.createPrimitive("way " + key + "=" + value))21 return new Environment(OsmUtils.createPrimitive("way " + key + "=" + value)) 22 22 } 23 23 … … 192 192 public void testNRegexKeyConditionSelector() throws Exception { 193 193 def s1 = getParser("*[sport][tourism != hotel]").selector() 194 assert s1.matches(new Environment( ).withPrimitive(OsmUtils.createPrimitive("node sport=foobar")))195 assert !s1.matches(new Environment( ).withPrimitive(OsmUtils.createPrimitive("node sport=foobar tourism=hotel")))194 assert s1.matches(new Environment(OsmUtils.createPrimitive("node sport=foobar"))) 195 assert !s1.matches(new Environment(OsmUtils.createPrimitive("node sport=foobar tourism=hotel"))) 196 196 def s2 = getParser("*[sport][tourism != hotel][leisure !~ /^(sports_centre|stadium|)\$/]").selector() 197 assert s2.matches(new Environment( ).withPrimitive(OsmUtils.createPrimitive("node sport=foobar")))198 assert !s2.matches(new Environment( ).withPrimitive(OsmUtils.createPrimitive("node sport=foobar tourism=hotel")))199 assert !s2.matches(new Environment( ).withPrimitive(OsmUtils.createPrimitive("node sport=foobar leisure=stadium")))197 assert s2.matches(new Environment(OsmUtils.createPrimitive("node sport=foobar"))) 198 assert !s2.matches(new Environment(OsmUtils.createPrimitive("node sport=foobar tourism=hotel"))) 199 assert !s2.matches(new Environment(OsmUtils.createPrimitive("node sport=foobar leisure=stadium"))) 200 200 } 201 201 … … 206 206 w1.put("foo", "123") 207 207 w1.put("bar", "456") 208 assert !c1.applies(new Environment( ).withPrimitive(w1))208 assert !c1.applies(new Environment(w1)) 209 209 w1.put("bar", "123") 210 assert c1.applies(new Environment( ).withPrimitive(w1))210 assert c1.applies(new Environment(w1)) 211 211 def c2 = (Condition.KeyValueCondition) getParser("[foo =~ */bar/]").condition(Condition.Context.PRIMITIVE) 212 212 def w2 = new Way(w1) 213 213 w2.put("bar", "[0-9]{3}") 214 assert c2.applies(new Environment( ).withPrimitive(w2))214 assert c2.applies(new Environment(w2)) 215 215 w2.put("bar", "[0-9]") 216 assert c2.applies(new Environment( ).withPrimitive(w2))216 assert c2.applies(new Environment(w2)) 217 217 w2.put("bar", "^[0-9]\$") 218 assert !c2.applies(new Environment( ).withPrimitive(w2))218 assert !c2.applies(new Environment(w2)) 219 219 } 220 220 … … 301 301 w.addNode(n2) 302 302 303 def e = new Environment( ).withPrimitive(n2)303 def e = new Environment(n2) 304 304 assert s1.matches(e) 305 305 assert e.osm == n2 306 306 assert e.child == n1 307 307 assert e.parent == w 308 assert !s1.matches(new Environment( ).withPrimitive(n1))309 assert !s1.matches(new Environment( ).withPrimitive(w))308 assert !s1.matches(new Environment(n1)) 309 assert !s1.matches(new Environment(w)) 310 310 } 311 311 … … 332 332 w.addNode(n3) 333 333 334 assert s1.right.matches(new Environment( ).withPrimitive(n3))335 assert s1.left.matches(new Environment( ).withPrimitive(n2).withChild(n3).withParent(w))336 assert s1.matches(new Environment( ).withPrimitive(n3))337 assert !s1.matches(new Environment( ).withPrimitive(n1))338 assert !s1.matches(new Environment( ).withPrimitive(n2))339 assert !s1.matches(new Environment( ).withPrimitive(w))334 assert s1.right.matches(new Environment(n3)) 335 assert s1.left.matches(new Environment(n2).withChild(n3).withParent(w)) 336 assert s1.matches(new Environment(n3)) 337 assert !s1.matches(new Environment(n1)) 338 assert !s1.matches(new Environment(n2)) 339 assert !s1.matches(new Environment(w)) 340 340 } 341 341
Note:
See TracChangeset
for help on using the changeset viewer.