Changeset 10680 in josm


Ignore:
Timestamp:
2016-07-30T16:27:16+02:00 (8 years ago)
Author:
Don-vip
Message:

sonar - pmd:UseVarargs - Use Varargs

Location:
trunk/src/org/openstreetmap/josm
Files:
36 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/command/SequenceCommand.java

    r10452 r10680  
    117117    }
    118118
    119     protected final void setSequence(Command[] sequence) {
     119    protected final void setSequence(Command ... sequence) {
    120120        this.sequence = Utils.copyArray(sequence);
    121121    }
  • trunk/src/org/openstreetmap/josm/data/Bounds.java

    r9371 r10680  
    150150    }
    151151
    152     public Bounds(double[] coords) {
     152    public Bounds(double ... coords) {
    153153        this(coords, true);
    154154    }
  • trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java

    r10634 r10680  
    361361     * over all routes
    362362     */
    363     public Iterable<Collection<WayPoint>> getLinesIterable(final boolean[] trackVisibility) {
     363    public Iterable<Collection<WayPoint>> getLinesIterable(final boolean ... trackVisibility) {
    364364        return () -> new LinesIterator(this, trackVisibility);
    365365    }
     
    414414         * included in the iteration. Can be null, then all tracks are included.
    415415         */
    416         public LinesIterator(GpxData data, boolean[] trackVisibility) {
     416        public LinesIterator(GpxData data, boolean ... trackVisibility) {
    417417            itTracks = data.tracks.iterator();
    418418            idxTracks = -1;
  • trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java

    r10608 r10680  
    601601     * @throws XMLStreamException See {@link XMLStreamReader}
    602602     */
    603     private static boolean moveReaderToTag(XMLStreamReader reader, QName[] tags) throws XMLStreamException {
     603    private static boolean moveReaderToTag(XMLStreamReader reader, QName ... tags) throws XMLStreamException {
    604604        QName stopTag = reader.getName();
    605605        int currentLevel = 0;
  • trunk/src/org/openstreetmap/josm/data/osm/TagMap.java

    r10604 r10680  
    4848         * @param tags The tags array. It is never changed but should also not be changed by you.
    4949         */
    50         TagEntryInterator(String[] tags) {
     50        TagEntryInterator(String ... tags) {
    5151            super();
    5252            this.tags = tags;
     
    8787         * @param tags The tags array. It is never changed but should also not be changed by you.
    8888         */
    89         TagEntrySet(String[] tags) {
     89        TagEntrySet(String ... tags) {
    9090            super();
    9191            this.tags = tags;
     
    140140     * @param tags The tags array. It is not modified by this map.
    141141     */
    142     public TagMap(String[] tags) {
     142    public TagMap(String ... tags) {
    143143        if (tags == null || tags.length == 0) {
    144144            this.tags = EMPTY_TAGS;
  • trunk/src/org/openstreetmap/josm/data/projection/Ellipsoid.java

    r10033 r10680  
    322322     * @return The corresponding latitude and longitude in degrees
    323323     */
    324     public LatLon cart2LatLon(double[] xyz) {
     324    public LatLon cart2LatLon(double ... xyz) {
    325325        return cart2LatLon(xyz, 1e-11);
    326326    }
  • trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShiftFile.java

    r10305 r10680  
    167167     * @return an array of top level Sub Grids with lower level Sub Grids set.
    168168     */
    169     private static NTV2SubGrid[] createSubGridTree(NTV2SubGrid[] subGrid) {
     169    private static NTV2SubGrid[] createSubGridTree(NTV2SubGrid ... subGrid) {
    170170        int topLevelCount = 0;
    171171        Map<String, List<NTV2SubGrid>> subGridMap = new HashMap<>();
  • trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2SubGrid.java

    r10305 r10680  
    281281     * @param subGrid subgrids
    282282     */
    283     public void setSubGridArray(NTV2SubGrid[] subGrid) {
     283    public void setSubGridArray(NTV2SubGrid ... subGrid) {
    284284        this.subGrid = Utils.copyArray(subGrid);
    285285    }
  • trunk/src/org/openstreetmap/josm/data/validation/routines/DomainValidator.java

    r10679 r10680  
    18311831     * @since 1.5.0
    18321832     */
    1833     public static synchronized void updateTLDOverride(ArrayType table, String[] tlds) {
     1833    public static synchronized void updateTLDOverride(ArrayType table, String ... tlds) {
    18341834        if (inUse) {
    18351835            throw new IllegalStateException("Can only invoke this method before calling getInstance");
  • trunk/src/org/openstreetmap/josm/data/validation/routines/RegexValidator.java

    r10378 r10680  
    102102     * validate against
    103103     */
    104     public RegexValidator(String[] regexs) {
     104    public RegexValidator(String ... regexs) {
    105105        this(regexs, true);
    106106    }
  • trunk/src/org/openstreetmap/josm/data/validation/routines/UrlValidator.java

    r10420 r10680  
    218218     *        ignore the contents of schemes.
    219219     */
    220     public UrlValidator(String[] schemes) {
     220    public UrlValidator(String ... schemes) {
    221221        this(schemes, 0L);
    222222    }
  • trunk/src/org/openstreetmap/josm/data/validation/tests/ConditionalKeys.java

    r10678 r10680  
    7979    }
    8080
    81     private static boolean isKeyValid3Parts(String[] parts) {
     81    private static boolean isKeyValid3Parts(String ... parts) {
    8282        return parts.length == 3 && isRestrictionType(parts[0]) && isTransportationMode(parts[1]) && isDirection(parts[2]);
    8383    }
    8484
    85     private static boolean isKeyValid2Parts(String[] parts) {
     85    private static boolean isKeyValid2Parts(String ... parts) {
    8686        return parts.length == 2 && ((isRestrictionType(parts[0]) && (isTransportationMode(parts[1]) || isDirection(parts[1])))
    8787                                  || (isTransportationMode(parts[0]) && isDirection(parts[1])));
    8888    }
    8989
    90     private static boolean isKeyValid1Part(String[] parts) {
     90    private static boolean isKeyValid1Part(String ... parts) {
    9191        return parts.length == 1 && (isRestrictionType(parts[0]) || isTransportationMode(parts[0]));
    9292    }
  • trunk/src/org/openstreetmap/josm/data/validation/tests/SimilarNamedWays.java

    r10600 r10680  
    251251        private final String replacement;
    252252
    253         public SynonymRule(String replacement, String[] words) {
     253        public SynonymRule(String replacement, String ... words) {
    254254            this.replacement = replacement.toLowerCase(Locale.ENGLISH);
    255255            this.words = words;
  • trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java

    r10649 r10680  
    131131     * @param buttonTexts  String Array of the text that will appear on the buttons. The first button is the default one.
    132132     */
    133     public ExtendedDialog(Component parent, String title, String[] buttonTexts) {
     133    public ExtendedDialog(Component parent, String title, String ... buttonTexts) {
    134134        this(parent, title, buttonTexts, true, true);
    135135    }
     
    170170     * @return {@code this}
    171171     */
    172     public ExtendedDialog setButtonIcons(Icon[] buttonIcons) {
     172    public ExtendedDialog setButtonIcons(Icon ... buttonIcons) {
    173173        this.bIcons = Utils.copyArray(buttonIcons);
    174174        return this;
     
    180180     * @return {@code this}
    181181     */
    182     public ExtendedDialog setButtonIcons(String[] buttonIcons) {
     182    public ExtendedDialog setButtonIcons(String ... buttonIcons) {
    183183        bIcons = new Icon[buttonIcons.length];
    184184        for (int i = 0; i < buttonIcons.length; ++i) {
     
    195195     * @return {@code this}
    196196     */
    197     public ExtendedDialog setToolTipTexts(String[] toolTipTexts) {
     197    public ExtendedDialog setToolTipTexts(String ... toolTipTexts) {
    198198        this.bToolTipTexts = Utils.copyArray(toolTipTexts);
    199199        return this;
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r10645 r10680  
    242242     * @return command-line argument map
    243243     */
    244     public static Map<Option, Collection<String>> buildCommandLineArgumentMap(String[] args) {
     244    public static Map<Option, Collection<String>> buildCommandLineArgumentMap(String ... args) {
    245245
    246246        List<LongOpt> los = new ArrayList<>();
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/ComparePairType.java

    r10378 r10680  
    3333    private ListRole[] participatingRoles;
    3434
    35     ComparePairType(String displayName, ListRole[] participatingRoles) {
     35    ComparePairType(String displayName, ListRole ... participatingRoles) {
    3636        this.displayName = displayName;
    3737        this.participatingRoles = Utils.copyArray(participatingRoles);
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/ListMergeModel.java

    r10378 r10680  
    273273    }
    274274
    275     protected void copyToTop(ListRole role, int[] rows) {
     275    protected void copyToTop(ListRole role, int ... rows) {
    276276        copy(role, rows, 0);
    277277        mergedEntriesSelectionModel.setSelectionInterval(0, rows.length -1);
     
    285285     * @param rows the indices
    286286     */
    287     public void copyMyToTop(int[] rows) {
     287    public void copyMyToTop(int ... rows) {
    288288        copyToTop(MY_ENTRIES, rows);
    289289    }
     
    296296     * @param rows the indices
    297297     */
    298     public void copyTheirToTop(int[] rows) {
     298    public void copyTheirToTop(int ... rows) {
    299299        copyToTop(THEIR_ENTRIES, rows);
    300300    }
     
    309309     */
    310310
    311     public void copyToEnd(ListRole source, int[] rows) {
     311    public void copyToEnd(ListRole source, int ... rows) {
    312312        copy(source, rows, getMergedEntriesSize());
    313313        mergedEntriesSelectionModel.setSelectionInterval(getMergedEntriesSize()-rows.length, getMergedEntriesSize() -1);
     
    322322     * @param rows the indices
    323323     */
    324     public void copyMyToEnd(int[] rows) {
     324    public void copyMyToEnd(int ... rows) {
    325325        copyToEnd(MY_ENTRIES, rows);
    326326    }
     
    333333     * @param rows the indices
    334334     */
    335     public void copyTheirToEnd(int[] rows) {
     335    public void copyTheirToEnd(int ... rows) {
    336336        copyToEnd(THEIR_ENTRIES, rows);
    337337    }
     
    491491     *
    492492     */
    493     public void moveUpMerged(int[] rows) {
     493    public void moveUpMerged(int ... rows) {
    494494        if (rows == null || rows.length == 0)
    495495            return;
     
    516516     * @param rows the indices
    517517     */
    518     public void moveDownMerged(int[] rows) {
     518    public void moveDownMerged(int ... rows) {
    519519        if (rows == null || rows.length == 0)
    520520            return;
     
    542542     * @param rows the indices
    543543     */
    544     public void removeMerged(int[] rows) {
     544    public void removeMerged(int ... rows) {
    545545        if (rows == null || rows.length == 0)
    546546            return;
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/tags/TagMerger.java

    r10378 r10680  
    238238    }
    239239
    240     private void selectNextConflict(int[] rows) {
     240    private void selectNextConflict(int ... rows) {
    241241        int max = rows[0];
    242242        for (int row: rows) {
  • trunk/src/org/openstreetmap/josm/gui/dialogs/OsmIdSelectionDialog.java

    r10638 r10680  
    5252    protected final transient GroupLayout layout = new GroupLayout(panel);
    5353
    54     public OsmIdSelectionDialog(Component parent, String title, String[] buttonTexts) {
     54    public OsmIdSelectionDialog(Component parent, String title, String ... buttonTexts) {
    5555        super(parent, title, buttonTexts);
    5656    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java

    r10611 r10680  
    343343        }
    344344
    345         public void selectPrimitivesOwnedBy(int[] rows) {
     345        public void selectPrimitivesOwnedBy(int ... rows) {
    346346            Set<User> users = new HashSet<>();
    347347            for (int index: rows) {
     
    358358        }
    359359
    360         public List<User> getSelectedUsers(int[] rows) {
     360        public List<User> getSelectedUsers(int ... rows) {
    361361            List<User> ret = new LinkedList<>();
    362362            if (rows == null || rows.length == 0)
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    r10662 r10680  
    958958        }
    959959
    960         protected void deleteTags(int[] rows) {
     960        protected void deleteTags(int ... rows) {
    961961            // convert list of rows to HashMap (and find gap for nextKey)
    962962            Map<String, String> tags = new HashMap<>(rows.length);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java

    r10662 r10680  
    529529        protected AutoCompletingComboBox values;
    530530
    531         AbstractTagsDialog(Component parent, String title, String[] buttonTexts) {
     531        AbstractTagsDialog(Component parent, String title, String ... buttonTexts) {
    532532            super(parent, title, buttonTexts);
    533533            addMouseListener(new PopupMenuLauncher(popupMenu));
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java

    r10616 r10680  
    254254    }
    255255
    256     public void moveUp(int[] selectedRows) {
     256    public void moveUp(int ... selectedRows) {
    257257        if (!canMoveUp(selectedRows))
    258258            return;
     
    275275    }
    276276
    277     public void moveDown(int[] selectedRows) {
     277    public void moveDown(int ... selectedRows) {
    278278        if (!canMoveDown(selectedRows))
    279279            return;
     
    298298    }
    299299
    300     public void remove(int[] selectedRows) {
     300    public void remove(int ... selectedRows) {
    301301        if (!canRemove(selectedRows))
    302302            return;
     
    312312    }
    313313
    314     public boolean canMoveUp(int[] rows) {
     314    public boolean canMoveUp(int ... rows) {
    315315        if (rows == null || rows.length == 0)
    316316            return false;
     
    319319    }
    320320
    321     public boolean canMoveDown(int[] rows) {
     321    public boolean canMoveDown(int ... rows) {
    322322        if (rows == null || rows.length == 0)
    323323            return false;
     
    326326    }
    327327
    328     public boolean canRemove(int[] rows) {
     328    public boolean canRemove(int ... rows) {
    329329        if (rows == null || rows.length == 0)
    330330            return false;
  • trunk/src/org/openstreetmap/josm/gui/history/TwoColumnDiff.java

    r10670 r10680  
    6464    boolean referenceReversed;
    6565
    66     TwoColumnDiff(Object[] reference, Object[] current) {
     66    TwoColumnDiff(Object[] reference, Object ... current) {
    6767        this.reference = Utils.copyArray(reference);
    6868        this.current = Utils.copyArray(current);
  • trunk/src/org/openstreetmap/josm/gui/io/UploadSelectionDialog.java

    r10619 r10680  
    239239        }
    240240
    241         public List<OsmPrimitive> getPrimitives(int[] indices) {
     241        public List<OsmPrimitive> getPrimitives(int ... indices) {
    242242            if (indices == null || indices.length == 0)
    243243                return Collections.emptyList();
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/ChooseTrackVisibilityAction.java

    r10611 r10680  
    128128     * @return non-editable table
    129129     */
    130     private JTable buildTable(Object[][] content) {
     130    private JTable buildTable(Object[]... content) {
    131131        final String[] headers = {tr("Name"), tr("Description"), tr("Timespan"), tr("Length"), tr("URL")};
    132132        DefaultTableModel model = new DefaultTableModel(content, headers);
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportImagesAction.java

    r9305 r10680  
    4141    }
    4242
    43     private static void addRecursiveFiles(List<File> files, File[] sel) {
     43    private static void addRecursiveFiles(List<File> files, File ... sel) {
    4444        if (sel == null) { // listFiles might return null
    4545            return;
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/NodeElement.java

    r10420 r10680  
    142142    }
    143143
    144     public static MapImage createIcon(final Environment env, final String[] keys) {
     144    public static MapImage createIcon(final Environment env, final String ... keys) {
    145145        CheckParameterUtil.ensureParameterNotNull(env, "env");
    146146        CheckParameterUtil.ensureParameterNotNull(keys, "keys");
  • trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java

    r10647 r10680  
    272272     * @param tagIndices a list of tag indices
    273273     */
    274     public void deleteTagNames(int[] tagIndices) {
     274    public void deleteTagNames(int ... tagIndices) {
    275275        if (tags == null)
    276276            return;
     
    291291     * @param tagIndices the lit of tag indices
    292292     */
    293     public void deleteTagValues(int[] tagIndices) {
     293    public void deleteTagValues(int ... tagIndices) {
    294294        if (tags == null)
    295295            return;
     
    334334     * @param tagIndices the list of tag indices
    335335     */
    336     public void deleteTags(int[] tagIndices) {
     336    public void deleteTags(int ... tagIndices) {
    337337        if (tags == null)
    338338            return;
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSelector.java

    r10657 r10680  
    118118        }
    119119
    120         private static int isMatching(Collection<String> values, String[] searchString) {
     120        private static int isMatching(Collection<String> values, String ... searchString) {
    121121            int sum = 0;
    122122            for (String word: searchString) {
     
    142142        }
    143143
    144         int isMatchingGroup(String[] words) {
     144        int isMatchingGroup(String ... words) {
    145145            return isMatching(groups, words);
    146146        }
    147147
    148         int isMatchingName(String[] words) {
     148        int isMatchingName(String ... words) {
    149149            return isMatching(names, words);
    150150        }
    151151
    152         int isMatchingTags(String[] words) {
     152        int isMatchingTags(String ... words) {
    153153            return isMatching(tags, words);
    154154        }
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java

    r10590 r10680  
    158158        private final String delimiter;
    159159
    160         protected ConcatenatingJList(String del, PresetListEntry[] o) {
     160        protected ConcatenatingJList(String del, PresetListEntry ... o) {
    161161            super(o);
    162162            delimiter = del;
  • trunk/src/org/openstreetmap/josm/gui/widgets/QuadStateCheckBox.java

    r10672 r10680  
    5353     * @param allowed The allowed states
    5454     */
    55     public QuadStateCheckBox(String text, Icon icon, State initial, State[] allowed) {
     55    public QuadStateCheckBox(String text, Icon icon, State initial, State ... allowed) {
    5656        super(text, icon);
    5757        this.allowed = Utils.copyArray(allowed);
     
    8686     * @param allowed The allowed states
    8787     */
    88     public QuadStateCheckBox(String text, State initial, State[] allowed) {
     88    public QuadStateCheckBox(String text, State initial, State ... allowed) {
    8989        this(text, null, initial, allowed);
    9090    }
  • trunk/src/org/openstreetmap/josm/tools/Diff.java

    r10600 r10680  
    567567         * @see #equivCount()
    568568         */
    569         private byte[] discardable(final int[] counts) {
     569        private byte[] discardable(final int ... counts) {
    570570            final int end = bufferedLines;
    571571            final byte[] discards = new byte[end];
  • trunk/src/org/openstreetmap/josm/tools/ImageProvider.java

    r10627 r10680  
    18381838    }
    18391839
    1840     private static Color parseRGB(String[] s) {
     1840    private static Color parseRGB(String ... s) {
    18411841        int[] rgb = new int[3];
    18421842        try {
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r10657 r10680  
    405405     * @since 6222
    406406     */
    407     public static char[] copyArray(char[] array) {
     407    public static char[] copyArray(char ... array) {
    408408        if (array != null) {
    409409            return Arrays.copyOf(array, array.length);
     
    418418     * @since 7436
    419419     */
    420     public static int[] copyArray(int[] array) {
     420    public static int[] copyArray(int ... array) {
    421421        if (array != null) {
    422422            return Arrays.copyOf(array, array.length);
     
    928928    }
    929929
    930     private static String strip(final String str, final char[] skipChars) {
     930    private static String strip(final String str, final char ... skipChars) {
    931931
    932932        int start = 0;
  • trunk/src/org/openstreetmap/josm/tools/template_engine/CompoundTemplateEntry.java

    r9079 r10680  
    1313    }
    1414
    15     private CompoundTemplateEntry(TemplateEntry[] entries) {
     15    private CompoundTemplateEntry(TemplateEntry ... entries) {
    1616        this.entries = entries;
    1717    }
Note: See TracChangeset for help on using the changeset viewer.