Changeset 8415 in josm


Ignore:
Timestamp:
2015-05-22T21:15:05+02:00 (9 years ago)
Author:
Don-vip
Message:

code style/cleanup - Uncommented Empty Constructor

Location:
trunk
Files:
35 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadSessionTask.java

    r8093 r8415  
    2222
    2323    private static final String PATTERN_SESSION =  "https?://.*/.*\\.jo(s|z)";
    24    
     24
    2525    private Loader loader;
    26    
    27     /**
    28      * Constructs a new {@code DownloadSessionTask}.
    29      */
    30     public DownloadSessionTask() {
    31     }
    3226
    3327    @Override
     
    7569    /**
    7670     * Do not allow to load a session file via remotecontrol.
    77      * 
     71     *
    7872     * Session importers can be added by plugins and there is currently
    7973     * no way to ensure that these are safe for remotecontol.
  • trunk/src/org/openstreetmap/josm/data/imagery/Shape.java

    r8394 r8415  
    2121public class Shape {
    2222
    23     private List<Coordinate> coords = new ArrayList<>();
     23    private final List<Coordinate> coords = new ArrayList<>();
    2424
    2525    public Shape(String asString, String separator) {
     
    3333    }
    3434
     35    /**
     36     * Constructs a new empty {@code Shape}.
     37     */
    3538    public Shape() {
     39        // shape contents can be set later with addPoint()
    3640    }
    3741
     
    107111        return true;
    108112    }
    109 
    110 
    111113}
  • trunk/src/org/openstreetmap/josm/data/oauth/OAuthParameters.java

    r8291 r8415  
    113113     */
    114114    public OAuthParameters() {
     115        // contents can be set later with setters
    115116    }
    116117
  • trunk/src/org/openstreetmap/josm/data/osm/NodeData.java

    r8365 r8415  
    1919     */
    2020    public NodeData() {
    21 
     21        // contents can be set later with setters
    2222    }
    2323
  • trunk/src/org/openstreetmap/josm/data/osm/RelationData.java

    r7005 r8415  
    1111    private List<RelationMemberData> members = new ArrayList<>();
    1212
     13    /**
     14     * Constructs a new {@code RelationData}.
     15     */
    1316    public RelationData() {
    14 
     17        // contents can be set later with setters
    1518    }
    1619
     20    /**
     21     * Constructs a new {@code RelationData}.
     22     * @param data relation data to copy
     23     */
    1724    public RelationData(RelationData data) {
    1825        super(data);
  • trunk/src/org/openstreetmap/josm/data/osm/TagCollection.java

    r8338 r8415  
    2727 * A TagCollection can be created:
    2828 * <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>
    3337 * </ul>
    3438 *
     
    3640 *
    3741 * 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)}.
    4044 *
    41  *
     45 * @since 2008
    4246 */
    4347public class TagCollection implements Iterable<Tag> {
     
    145149
    146150    /**
    147      * Creates an empty tag collection
     151     * Creates an empty tag collection.
    148152     */
    149153    public TagCollection() {
     154        // contents can be set later with add()
    150155    }
    151156
  • trunk/src/org/openstreetmap/josm/data/osm/WayData.java

    r8376 r8415  
    1111    private List<Long> nodes = new ArrayList<>();
    1212
     13    /**
     14     * Constructs a new {@code NodeData}.
     15     */
    1316    public WayData() {
    14 
     17        // contents can be set later with setters
    1518    }
    1619
     20    /**
     21     * Constructs a new {@code WayData}.
     22     * @param data way data to copy
     23     */
    1724    public WayData(WayData data) {
    1825        super(data);
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapRendererFactory.java

    r8291 r8415  
    3535 *
    3636 * </pre>
    37  *
     37 * @since 4087
    3838 */
    3939public final class MapRendererFactory {
     
    4545
    4646    public static class MapRendererFactoryException extends RuntimeException {
    47         public MapRendererFactoryException() {
    48         }
    4947
    5048        public MapRendererFactoryException(String message, Throwable cause) {
  • trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java

    r8393 r8415  
    120120     */
    121121    public CustomProjection() {
     122        // contents can be set later with update()
    122123    }
    123124
  • trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShift.java

    r8308 r8415  
    5555     */
    5656    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     */
    5964    public NTV2GridShift(LatLon p) {
    6065        setLatDegrees(p.lat());
  • trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShiftFile.java

    r8379 r8415  
    8383    private NTV2SubGrid lastSubGrid;
    8484
    85     /**
    86      * Constructs a new {@code NTV2GridShiftFile}.
    87      */
    88     public NTV2GridShiftFile() {
    89     }
    90 
    9185    private void readBytes(InputStream in, byte[] b) throws IOException {
    9286        if (in.read(b) < b.length) {
  • trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java

    r8404 r8415  
    163163            final String s;
    164164            if (obj instanceof Expression) {
    165                 s = (String) ((Expression) obj).evaluate(new Environment().withPrimitive(p));
     165                s = (String) ((Expression) obj).evaluate(new Environment(p));
    166166            } else if (obj instanceof String) {
    167167                s = (String) obj;
     
    371371
    372372        Selector whichSelectorMatchesPrimitive(OsmPrimitive primitive) {
    373             return whichSelectorMatchesEnvironment(new Environment().withPrimitive(primitive));
     373            return whichSelectorMatchesEnvironment(new Environment(primitive));
    374374        }
    375375
     
    475475                return String.valueOf(
    476476                        val instanceof Expression
    477                                 ? ((Expression) val).evaluate(new Environment().withPrimitive(p))
     477                                ? ((Expression) val).evaluate(new Environment(p))
    478478                                : val
    479479                );
     
    522522         */
    523523        TestError getErrorForPrimitive(OsmPrimitive p) {
    524             final Environment env = new Environment().withPrimitive(p);
     524            final Environment env = new Environment(p);
    525525            return getErrorForPrimitive(p, whichSelectorMatchesEnvironment(env), env);
    526526        }
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r8404 r8415  
    7777 */
    7878public class MainApplication extends Main {
     79
    7980    /**
    80      * Allow subclassing (see JOSM.java)
     81     * Constructs a new {@code MainApplication}.
    8182     */
    82     public MainApplication() {}
     83    public MainApplication() {
     84       // Allow subclassing (see JOSM.java)
     85    }
    8386
    8487    /**
     
    200203        OFFLINE(true),
    201204        /** --skip-plugins */
    202         SKIP_PLUGINS(false),
    203         ;
     205        SKIP_PLUGINS(false);
    204206
    205207        private final String name;
     
    225227        public boolean requiresArgument() {
    226228            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;
    238229        }
    239230    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RunnableAction.java

    r6084 r8415  
    88public abstract class RunnableAction extends AbstractAction implements Runnable {
    99
    10     public RunnableAction() {
    11     }
    12 
    1310    @Override
    1411    public abstract void run();
  • trunk/src/org/openstreetmap/josm/gui/io/UploadSelectionDialog.java

    r8308 r8415  
    179179
    180180        public OsmPrimitiveList() {
    181             super(new OsmPrimitiveListModel());
    182             init();
     181            this(new OsmPrimitiveListModel());
    183182        }
    184183
     
    195194    static class OsmPrimitiveListModel extends AbstractListModel<OsmPrimitive> {
    196195        private transient List<OsmPrimitive> data;
    197 
    198         public OsmPrimitiveListModel() {
    199         }
    200196
    201197        protected void sort() {
     
    216212        }
    217213
    218         public OsmPrimitiveListModel(List<OsmPrimitive> data) {
    219             setPrimitives(data);
    220         }
    221 
    222214        public void setPrimitives(List<OsmPrimitive> data) {
    223215            this.data = data;
  • trunk/src/org/openstreetmap/josm/gui/mappaint/Environment.java

    r8291 r8415  
    4747     * Creates a new uninitialized environment.
    4848     */
    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    }
    5060
    5161    /**
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java

    r8345 r8415  
    256256            @Override
    257257            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))) {
    259259                    if (e.osm instanceof Way && Geometry.PolygonIntersection.CROSSING.equals(Geometry.polygonIntersection(w.getNodes(), ((Way) e.osm).getNodes()))) {
    260260                        e.child = w;
     
    272272            @Override
    273273            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))) {
    275275                    if (e.osm instanceof Way && Geometry.nodeInsidePolygon(n, ((Way) e.osm).getNodes())
    276276                            || e.osm instanceof Relation && ((Relation) e.osm).isMultipolygon() && Geometry.isNodeInsideMultiPolygon(n, (Relation) e.osm, null)) {
     
    282282            @Override
    283283            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))) {
    285285                    if (e.osm instanceof Way && Geometry.PolygonIntersection.FIRST_INSIDE_SECOND.equals(Geometry.polygonIntersection(w.getNodes(), ((Way) e.osm).getNodes()))
    286286                            || e.osm instanceof Relation && ((Relation) e.osm).isMultipolygon() && Geometry.isPolygonInsideMultiPolygon(w.getNodes(), (Relation) e.osm, null)) {
     
    317317                    final Relation multipolygon = multipolygons.iterator().next();
    318318                    if (multipolygon == null) throw new NoSuchElementException();
    319                     containsFinder = new ContainsFinder(new Environment().withPrimitive(multipolygon)) {
     319                    containsFinder = new ContainsFinder(new Environment(multipolygon)) {
    320320                        @Override
    321321                        public boolean isPrimitiveUsable(OsmPrimitive p) {
  • trunk/src/org/openstreetmap/josm/gui/mappaint/xml/Prototype.java

    r6986 r8415  
    2020    }
    2121
     22    /**
     23     * Constructs a new {@code Prototype}.
     24     */
    2225    public Prototype() {
     26        // Allows subclassing
    2327    }
    2428
  • trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java

    r8390 r8415  
    519519            sessionId.userName = osmUserName;
    520520            if (canceled)
    521                 throw new OsmTransferCanceledException();
     521                throw new OsmTransferCanceledException("Authorization canceled");
    522522            monitor.worked(1);
    523523
     
    525525            authenticateOsmSession(sessionId, osmUserName, osmPassword);
    526526            if (canceled)
    527                 throw new OsmTransferCanceledException();
     527                throw new OsmTransferCanceledException("Authorization canceled");
    528528            monitor.worked(1);
    529529
     
    531531            sendAuthorisationRequest(sessionId, requestToken, privileges);
    532532            if (canceled)
    533                 throw new OsmTransferCanceledException();
     533                throw new OsmTransferCanceledException("Authorization canceled");
    534534            monitor.worked(1);
    535535
     
    537537            logoutOsmSession(sessionId);
    538538            if (canceled)
    539                 throw new OsmTransferCanceledException();
     539                throw new OsmTransferCanceledException("Authorization canceled");
    540540            monitor.worked(1);
    541541        } catch(OsmOAuthAuthorizationException e) {
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java

    r8413 r8415  
    141141
    142142        /**
    143          * Construxts a new {@code PresetListEntry}, uninitialized.
     143         * Constructs a new {@code PresetListEntry}, uninitialized.
    144144         */
    145145        public PresetListEntry() {
  • trunk/src/org/openstreetmap/josm/gui/widgets/DisableShortcutsOnFocusGainedTextField.java

    r8399 r8415  
    2929
    3030    /**
    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.
    3433     */
    3534    public DisableShortcutsOnFocusGainedTextField() {
     35        // Contents can be set with parent methods
    3636    }
    3737
    3838    /**
    3939     * 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.
    4241     *
    4342     * @param text the text to be displayed, or <code>null</code>
     
    4847
    4948    /**
    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>.
    5451     *
    5552     * @param columns  the number of columns to use to calculate
    5653     *   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
    5955     */
    6056    public DisableShortcutsOnFocusGainedTextField(int columns) {
     
    6965     * @param columns  the number of columns to use to calculate
    7066     *   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
    7368     */
    7469    public DisableShortcutsOnFocusGainedTextField(String text, int columns) {
  • trunk/src/org/openstreetmap/josm/gui/widgets/JosmHTMLEditorKit.java

    r7937 r8415  
    1212public class JosmHTMLEditorKit extends HTMLEditorKit {
    1313
    14     /**
    15      * Constructs a new {@code JosmHTMLEditorKit}
    16      */
    17     public JosmHTMLEditorKit() {
    18     }
    19    
    2014    protected StyleSheet ss = super.getStyleSheet();
    2115
    2216    /**
    2317     * 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.
    2519     * 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
    2923     * by all HTMLEditorKit instances, to provide a finer granularity.
    3024
     
    3832    /**
    3933     * 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
    4236     * by all HTMLEditorKit instances, to provide a finer granularity.
    43      * 
     37     *
    4438     * @see #setStyleSheet
    4539     */
  • trunk/src/org/openstreetmap/josm/gui/widgets/MultiSplitLayout.java

    r8413 r8415  
    10511051
    10521052        /**
    1053          * Create a Leaf node.  The default value of name is "".
     1053         * Create a Leaf node. The default value of name is "".
    10541054         */
    10551055        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.
    10621061         *
    10631062         * @param name value of the Leaf's name property
     
    10951094            sb.append(" \"")
    10961095              .append(getName())
    1097               .append('\"')
    1098               .append(" weight=")
     1096              .append("\" weight=")
    10991097              .append(getWeight())
    11001098              .append(' ')
  • trunk/src/org/openstreetmap/josm/gui/widgets/TextContextualPopupMenu.java

    r8308 r8415  
    7474     */
    7575    protected TextContextualPopupMenu() {
     76        // Restricts visibility
    7677    }
    7778
  • trunk/src/org/openstreetmap/josm/io/ChangesetQuery.java

    r8394 r8415  
    5050    /** a collection of changeset ids to query for */
    5151    private Collection<Long> changesetIds = null;
    52 
    53     /**
    54      * Constructs a new {@code ChangesetQuery}.
    55      */
    56     public ChangesetQuery() {
    57 
    58     }
    5952
    6053    /**
  • trunk/src/org/openstreetmap/josm/io/OsmApi.java

    r8394 r8415  
    562562            }
    563563            if (cancel)
    564                 throw new OsmTransferCanceledException();
     564                throw new OsmTransferCanceledException("Operation canceled" + (i > 0 ? " in retry #"+i : ""));
    565565            try {
    566566                Thread.sleep(1000);
  • trunk/src/org/openstreetmap/josm/io/OsmChangeReader.java

    r8291 r8415  
    3030     */
    3131    protected OsmChangeReader() {
     32        // Restricts visibility
    3233    }
    3334
  • trunk/src/org/openstreetmap/josm/io/OsmReader.java

    r8378 r8415  
    7878     */
    7979    protected OsmReader() {
     80        // Restricts visibility
    8081    }
    8182
  • trunk/src/org/openstreetmap/josm/io/OsmServerReader.java

    r8390 r8415  
    143143            }
    144144            if (cancel)
    145                 throw new OsmTransferCanceledException();
     145                throw new OsmTransferCanceledException("Operation canceled");
    146146            if (Main.pref.getBoolean("osm-server.use-compression", true)) {
    147147                activeConnection.setRequestProperty("Accept-Encoding", "gzip, deflate");
     
    171171
    172172                if (activeConnection.getResponseCode() == HttpURLConnection.HTTP_PROXY_AUTH)
    173                     throw new OsmTransferCanceledException();
     173                    throw new OsmTransferCanceledException("Proxy Authentication Required");
    174174
    175175                String encoding = activeConnection.getContentEncoding();
  • trunk/src/org/openstreetmap/josm/io/OsmTransferCanceledException.java

    r7509 r8415  
    88
    99    /**
    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
    1113     */
    12     public OsmTransferCanceledException() {
    13 
     14    public OsmTransferCanceledException(String message) {
     15        super(message);
    1416    }
    1517
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java

    r8395 r8415  
    276276    public static class RequestHandlerException extends Exception {
    277277
     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         */
    278282        public RequestHandlerException(String message) {
    279283            super(message);
    280284        }
     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         */
    281291        public RequestHandlerException(String message, Throwable cause) {
    282292            super(message, cause);
    283293        }
     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         */
    284299        public RequestHandlerException(Throwable cause) {
    285300            super(cause);
    286         }
    287         public RequestHandlerException() {
    288301        }
    289302    }
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ChildOrParentSelectorTest.groovy

    r7081 r8415  
    140140        r.addMember(new RelationMember("another role", w3))
    141141
    142         Environment e = new Environment().withPrimitive(r)
     142        Environment e = new Environment(r)
    143143        assert selector.matches(e)
    144144    }
     
    165165        r.addMember(new RelationMember("another role", w3))
    166166
    167         Environment e = new Environment().withPrimitive(w1)
     167        Environment e = new Environment(w1)
    168168        assert !selector.matches(e)
    169169
    170         e = new Environment().withPrimitive(w2)
     170        e = new Environment(w2)
    171171        assert !selector.matches(e)
    172172
    173         e = new Environment().withPrimitive(w3)
     173        e = new Environment(w3)
    174174        assert selector.matches(e)
    175175    }
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyConditionTest.groovy

    r8206 r8415  
    7777        r.addMember(new RelationMember("my_role", n))
    7878
    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()
    8080
    8181        Condition cond = Condition.createKeyCondition("my_role", false, null, Context.LINK)
     
    9292        r.addMember(new RelationMember("my_role", n))
    9393
    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()
    9595
    9696        Condition cond = Condition.createKeyCondition("another_role", false, null, Context.LINK)
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyValueConditionTest.groovy

    r8206 r8415  
    6363        r.addMember(new RelationMember("my_role", n))
    6464
    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)
    6666
    6767        Condition cond = new Condition.RoleCondition("my_role", Op.EQ)
     
    7878        r.addMember(new RelationMember("my_role", n))
    7979
    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()
    8181
    8282        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  
    1919
    2020    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))
    2222    }
    2323
     
    192192    public void testNRegexKeyConditionSelector() throws Exception {
    193193        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")))
    196196        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")))
    200200    }
    201201
     
    206206        w1.put("foo", "123")
    207207        w1.put("bar", "456")
    208         assert !c1.applies(new Environment().withPrimitive(w1))
     208        assert !c1.applies(new Environment(w1))
    209209        w1.put("bar", "123")
    210         assert c1.applies(new Environment().withPrimitive(w1))
     210        assert c1.applies(new Environment(w1))
    211211        def c2 = (Condition.KeyValueCondition) getParser("[foo =~ */bar/]").condition(Condition.Context.PRIMITIVE)
    212212        def w2 = new Way(w1)
    213213        w2.put("bar", "[0-9]{3}")
    214         assert c2.applies(new Environment().withPrimitive(w2))
     214        assert c2.applies(new Environment(w2))
    215215        w2.put("bar", "[0-9]")
    216         assert c2.applies(new Environment().withPrimitive(w2))
     216        assert c2.applies(new Environment(w2))
    217217        w2.put("bar", "^[0-9]\$")
    218         assert !c2.applies(new Environment().withPrimitive(w2))
     218        assert !c2.applies(new Environment(w2))
    219219    }
    220220
     
    301301        w.addNode(n2)
    302302
    303         def e = new Environment().withPrimitive(n2)
     303        def e = new Environment(n2)
    304304        assert s1.matches(e)
    305305        assert e.osm == n2
    306306        assert e.child == n1
    307307        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))
    310310    }
    311311
     
    332332        w.addNode(n3)
    333333
    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))
    340340    }
    341341
Note: See TracChangeset for help on using the changeset viewer.