Ignore:
Timestamp:
2016-11-20T12:32:08+01:00 (8 years ago)
Author:
donvip
Message:

checkstyle

Location:
applications/editors/josm/plugins/terracer/src/terracer
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/terracer/src/terracer/HouseNumberInputDialog.java

    r32426 r33077  
    1 /**
    2  * Terracer: A JOSM Plugin for terraced houses.
    3  *
    4  * Copyright 2009 CloudMade Ltd.
    5  *
    6  * Released under the GPLv2, see LICENSE file for details.
    7  */
     1// License: GPL. For details, see LICENSE file.
    82package terracer;
    93
     
    4539 *  HouseNumberinputHandler class.
    4640 *
    47  * @author casualwalker
     41 * @author casualwalker - Copyright 2009 CloudMade Ltd
    4842 */
    4943public class HouseNumberInputDialog extends ExtendedDialog {
    5044    /*
    51     final static String MIN_NUMBER = "plugin.terracer.lowest_number";
    52     final static String MAX_NUMBER = "plugin.terracer.highest_number";
    53     final static String INTERPOLATION = "plugin.terracer.interpolation_mode";
     45    static final String MIN_NUMBER = "plugin.terracer.lowest_number";
     46    static final String MAX_NUMBER = "plugin.terracer.highest_number";
     47    static final String INTERPOLATION = "plugin.terracer.interpolation_mode";
    5448    */
    55     final static String DEFAULT_SEGMENTS = "plugins.terracer.segments";
    56     final static String HANDLE_RELATION = "plugins.terracer.handle_relation";
    57     final static String KEEP_OUTLINE = "plugins.terracer.keep_outline";
    58     final static String INTERPOLATION = "plugins.terracer.interpolation";
    59 
    60     //final private Way street;
    61     final private String streetName;
    62     final private String buildingType;
    63     final private boolean relationExists;
     49    static final String DEFAULT_SEGMENTS = "plugins.terracer.segments";
     50    static final String HANDLE_RELATION = "plugins.terracer.handle_relation";
     51    static final String KEEP_OUTLINE = "plugins.terracer.keep_outline";
     52    static final String INTERPOLATION = "plugins.terracer.interpolation";
     53
     54    //private final Way street;
     55    private final String streetName;
     56    private final String buildingType;
     57    private final boolean relationExists;
    6458    final ArrayList<Node> housenumbers;
    6559
     
    9791     * @param housenumbers a list of house numbers in this outline (may be empty)
    9892     */
    99     public HouseNumberInputDialog(HouseNumberInputHandler handler, Way street, String streetName, String buildingType, boolean relationExists, ArrayList<Node> housenumbers) {
     93    public HouseNumberInputDialog(HouseNumberInputHandler handler, Way street, String streetName,
     94            String buildingType, boolean relationExists, ArrayList<Node> housenumbers) {
    10095        super(Main.parent,
    10196                tr("Terrace a house"),
    102                 new String[] { tr("OK"), tr("Cancel")},
     97                new String[] {tr("OK"), tr("Cancel")},
    10398                true
    10499        );
     
    190185            inputPanel.add(messageLabel, c);
    191186
    192             inputPanel.add(loLabel, GBC.std().insets(3,3,0,0));
    193             inputPanel.add(getLo(), GBC.eol().fill(GBC.HORIZONTAL).insets(5,3,0,0));
    194             inputPanel.add(hiLabel, GBC.std().insets(3,3,0,0));
    195             inputPanel.add(getHi(), GBC.eol().fill(GBC.HORIZONTAL).insets(5,3,0,0));
    196             inputPanel.add(numbersLabel, GBC.std().insets(3,3,0,0));
    197             inputPanel.add(getNumbers(), GBC.eol().fill(GBC.HORIZONTAL).insets(5,3,0,0));
    198             inputPanel.add(interpolationLabel, GBC.std().insets(3,3,0,0));
    199             inputPanel.add(getInterpolation(), GBC.eol().insets(5,3,0,0));
    200             inputPanel.add(segmentsLabel, GBC.std().insets(3,3,0,0));
    201             inputPanel.add(getSegments(), GBC.eol().fill(GBC.HORIZONTAL).insets(5,3,0,0));
     187            inputPanel.add(loLabel, GBC.std().insets(3, 3, 0, 0));
     188            inputPanel.add(getLo(), GBC.eol().fill(GBC.HORIZONTAL).insets(5, 3, 0, 0));
     189            inputPanel.add(hiLabel, GBC.std().insets(3, 3, 0, 0));
     190            inputPanel.add(getHi(), GBC.eol().fill(GBC.HORIZONTAL).insets(5, 3, 0, 0));
     191            inputPanel.add(numbersLabel, GBC.std().insets(3, 3, 0, 0));
     192            inputPanel.add(getNumbers(), GBC.eol().fill(GBC.HORIZONTAL).insets(5, 3, 0, 0));
     193            inputPanel.add(interpolationLabel, GBC.std().insets(3, 3, 0, 0));
     194            inputPanel.add(getInterpolation(), GBC.eol().insets(5, 3, 0, 0));
     195            inputPanel.add(segmentsLabel, GBC.std().insets(3, 3, 0, 0));
     196            inputPanel.add(getSegments(), GBC.eol().fill(GBC.HORIZONTAL).insets(5, 3, 0, 0));
    202197            if (streetName == null) {
    203                 inputPanel.add(streetLabel, GBC.std().insets(3,3,0,0));
    204                 inputPanel.add(getStreet(), GBC.eol().insets(5,3,0,0));
     198                inputPanel.add(streetLabel, GBC.std().insets(3, 3, 0, 0));
     199                inputPanel.add(getStreet(), GBC.eol().insets(5, 3, 0, 0));
    205200            } else {
    206                 inputPanel.add(new JLabel(tr("Street name: ")+"\""+streetName+"\""), GBC.eol().insets(3,3,0,0));
    207             }
    208             inputPanel.add(buildingLabel, GBC.std().insets(3,3,0,0));
    209             inputPanel.add(getBuilding(), GBC.eol().insets(5,3,0,0));
    210             inputPanel.add(handleRelationCheckBox, GBC.eol().insets(3,3,0,0));
    211             inputPanel.add(keepOutlineCheckBox, GBC.eol().insets(3,3,0,0));
     201                inputPanel.add(new JLabel(tr("Street name: ")+"\""+streetName+"\""), GBC.eol().insets(3, 3, 0, 0));
     202            }
     203            inputPanel.add(buildingLabel, GBC.std().insets(3, 3, 0, 0));
     204            inputPanel.add(getBuilding(), GBC.eol().insets(5, 3, 0, 0));
     205            inputPanel.add(handleRelationCheckBox, GBC.eol().insets(3, 3, 0, 0));
     206            inputPanel.add(keepOutlineCheckBox, GBC.eol().insets(3, 3, 0, 0));
    212207
    213208            if (numbers.isVisible()) {
     
    275270            if (it.hasNext()) {
    276271                s.append(it.next().get("addr:housenumber"));
    277                 while (it.hasNext())
     272                while (it.hasNext()) {
    278273                    s.append(';').append(it.next().get("addr:housenumber"));
    279             }
    280             else {
     274                }
     275            } else {
    281276                numbersLabel.setVisible(false);
    282277                numbers.setVisible(false);
  • applications/editors/josm/plugins/terracer/src/terracer/HouseNumberInputHandler.java

    r31655 r33077  
    1 /**
    2  * Terracer: A JOSM Plugin for terraced houses.
    3  *
    4  * Copyright 2009 CloudMade Ltd.
    5  *
    6  * Released under the GPLv2, see LICENSE file for details.
    7  */
     1// License: GPL. For details, see LICENSE file.
    82package terracer;
    93
     
    4236 * is already cluttered with auto-generated layout code.
    4337 *
    44  * @author casualwalker
     38 * @author casualwalker - Copyright 2009 CloudMade Ltd
    4539 */
    4640public class HouseNumberInputHandler extends JosmAction implements ActionListener, FocusListener, ItemListener {
     
    9589     */
    9690    private static JButton getButton(Container root, String caption) {
    97         Component children[] = root.getComponents();
     91        Component[] children = root.getComponents();
    9892        for (Component child : children) {
    9993            JButton b;
     
    126120        // Allow non numeric characters for the low number as long as there is
    127121        // no high number of the segmentcount is 1
    128         if (dialog.hi.getText().length() > 0 && (segments()!= null || segments() < 1)) {
     122        if (dialog.hi.getText().length() > 0 && (segments() != null || segments() < 1)) {
    129123            isOk = isOk
    130124                    && checkNumberStringField(dialog.lo, tr("Lowest number"),
     
    306300                            doKeepOutline(), buildingType());
    307301                    } catch (UserCancelException ex) {
    308                         // Ignore
     302                        Main.trace(ex);
    309303                    }
    310304
     
    396390        } else {
    397391            String name;
    398             if (selected instanceof AutoCompletionListItem)
    399             {
    400                name = ((AutoCompletionListItem)selected).getValue();
    401             }
    402             else
    403             {
     392            if (selected instanceof AutoCompletionListItem) {
     393               name = ((AutoCompletionListItem) selected).getValue();
     394            } else {
    404395               name = selected.toString();
    405396            }
  • applications/editors/josm/plugins/terracer/src/terracer/ReverseTerraceAction.java

    r32426 r33077  
     1// License: GPL. For details, see LICENSE file.
    12package terracer;
    23
     
    100101                    for (OsmPrimitive prim : n.getReferrers()) {
    101102                        if (prim.keySet().contains("building") && prim instanceof Way) {
    102                             front.add((Way)prim);
     103                            front.add((Way) prim);
    103104                        }
    104105                    }
  • applications/editors/josm/plugins/terracer/src/terracer/TerracerAction.java

    r33031 r33077  
    1 /**
    2  * Terracer: A JOSM Plugin for terraced houses.
    3  *
    4  * Copyright 2009 CloudMade Ltd.
    5  *
    6  * Released under the GPLv2, see LICENSE file for details.
    7  */
     1// License: GPL. For details, see LICENSE file.
    82package terracer;
    93
     
    6054 * algorithm employed is naive, but it works in the simple case.
    6155 *
    62  * @author zere
     56 * @author zere - Copyright 2009 CloudMade Ltd
    6357 */
    6458public final class TerracerAction extends JosmAction {
     
    8175    }
    8276
    83     protected static final Set<Relation> findAssociatedStreets(Collection<OsmPrimitive> objects) {
     77    protected static Set<Relation> findAssociatedStreets(Collection<OsmPrimitive> objects) {
    8478        Set<Relation> result = new HashSet<>();
    8579        if (objects != null) {
     
    221215            // Don't open the dialog
    222216            try {
    223                 terraceBuilding(outline, init, street, associatedStreet, 0, null, null, 0, housenumbers, streetname, associatedStreet != null, false, "yes");
     217                terraceBuilding(outline, init, street, associatedStreet, 0, null, null, 0,
     218                        housenumbers, streetname, associatedStreet != null, false, "yes");
    224219            } catch (UserCancelException ex) {
    225                 // Ignore
     220                Main.trace(ex);
    226221            } finally {
    227222                this.commands.clear();
     
    270265                    // If the numbers are the same, the rest has to make the decision,
    271266                    // e.g. when comparing 23, 23a and 23b.
    272                     if (node1Int.equals(node2Int))
    273                     {
     267                    if (node1Int.equals(node2Int)) {
    274268                      String node2Rest = mat.group(2);
    275269                      return node1Rest.compareTo(node2Rest);
     
    295289     * @param init The node that hints at which side to start the numbering
    296290     * @param street The street, the buildings belong to (may be null)
    297      * @param associatedStreet
     291     * @param associatedStreet associated street relation
    298292     * @param segments The number of segments to generate
    299293     * @param start Starting housenumber
     
    308302     * @param keepOutline If the outline way should be kept
    309303     * @param buildingValue The value for {@code building} key to add
    310      * @throws UserCancelException
     304     * @throws UserCancelException if user cancels the operation
    311305     */
    312306    public void terraceBuilding(final Way outline, Node init, Way street, Relation associatedStreet, Integer segments,
     
    403397                List<Node> nodes = outline.getNodes();
    404398                ArrayList<Node> nodesToDelete = new ArrayList<>();
    405                 for (Node n : nodes)
     399                for (Node n : nodes) {
    406400                    if (!n.hasKeys() && n.getReferrers().size() == 1 && !reusedNodes.contains(n))
    407401                        nodesToDelete.add(n);
     402                }
    408403                if (!nodesToDelete.isEmpty())
    409404                    this.commands.add(DeleteCommand.delete(Main.getLayerManager().getEditLayer(), nodesToDelete));
     
    493488                        }
    494489                    } catch (UserCancelException e) {
    495                         // Ignore
     490                        Main.trace(e);
    496491                    }
    497492                }
     
    510505     * @param buildingValue The value for {@code building} key to add
    511506     * @return {@code outline}
    512      * @throws UserCancelException
     507     * @throws UserCancelException if user cancels the operation
    513508     */
    514509    private void addressBuilding(Way outline, Way street, String streetName, Relation associatedStreet,
     
    560555     */
    561556    private Node interpolateAlong(Way w, double l) {
    562         List<Pair<Node,Node>> pairs = w.getNodePairs(false);
     557        List<Pair<Node, Node>> pairs = w.getNodePairs(false);
    563558        for (int i = 0; i < pairs.size(); ++i) {
    564             Pair<Node,Node> p = pairs.get(i);
     559            Pair<Node, Node> p = pairs.get(i);
    565560            final double seg_length = p.a.getCoor().greatCircleDistance(p.b.getCoor());
    566561            if (l <= seg_length || i == pairs.size() - 1) {
     
    698693            public int i;
    699694
    700             public SortWithIndex(double a, int b) {
     695            SortWithIndex(double a, int b) {
    701696                x = a;
    702697                i = b;
  • applications/editors/josm/plugins/terracer/src/terracer/TerracerPlugin.java

    r29771 r33077  
    1 /**
    2  * Terracer: A JOSM Plugin for terraced houses.
    3  *
    4  * Copyright 2009 CloudMade Ltd.
    5  *
    6  * Released under the GPLv2, see LICENSE file for details.
    7  */
     1// License: GPL. For details, see LICENSE file.
    82package terracer;
    93
     
    1610 * Plugin interface implementation for Terracer.
    1711 *
    18  * @author zere
     12 * @author zere - Copyright 2009 CloudMade Ltd
    1913 */
    2014public class TerracerPlugin extends Plugin {
  • applications/editors/josm/plugins/terracer/src/terracer/TerracerRuntimeException.java

    r30612 r33077  
    1 /**
    2  * Terracer: A JOSM Plugin for terraced houses.
    3  *
    4  * Copyright 2009 CloudMade Ltd.
    5  *
    6  * Released under the GPLv2, see LICENSE file for details.
    7  */
     1// License: GPL. For details, see LICENSE file.
    82package terracer;
    93
     
    115 * The Class TerracerRuntimeException indicates errors from the Terracer Plugin.
    126 *
    13  * @author casualwalker
     7 * @author casualwalker - Copyright 2009 CloudMade Ltd
    148 */
    159public class TerracerRuntimeException extends RuntimeException {
     
    2216    }
    2317
    24     /**
    25      * @param message
    26      * @param cause
    27      */
    2818    public TerracerRuntimeException(String message, Throwable cause) {
    2919        super(message, cause);
    3020    }
    3121
    32     /**
    33      * @param message
    34      */
    3522    public TerracerRuntimeException(String message) {
    3623        super(message);
    3724    }
    3825
    39     /**
    40      * @param cause
    41      */
    4226    public TerracerRuntimeException(Throwable cause) {
    4327        super(cause);
Note: See TracChangeset for help on using the changeset viewer.