Ignore:
Timestamp:
2015-05-23T01:40:23+02:00 (7 years ago)
Author:
Don-vip
Message:

Sonar: various code style cleanup:

  • fix copyright
  • classes that should be final
  • order of javadoc At-clauses
  • unexpected spaces before parenthesis
Location:
trunk/src/org/openstreetmap/josm/tools
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/AlphanumComparator.java

    r8378 r8419  
    4040 *
    4141 */
    42 public class AlphanumComparator implements Comparator<String>, Serializable {
     42public final class AlphanumComparator implements Comparator<String>, Serializable {
    4343
    4444    private static final long serialVersionUID = 1L;
  • trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java

    r8413 r8419  
    7979                throw new InterruptedException();
    8080        }
    81         protected void failed (Exception e) {
     81        protected void failed(Exception e) {
    8282            exception = e;
    8383            result = Result.FAILED;
    8484            state = State.NOTPLAYING;
    8585        }
    86         protected void ok (State newState) {
     86        protected void ok(State newState) {
    8787            result = Result.OK;
    8888            state = newState;
  • trunk/src/org/openstreetmap/josm/tools/ColorScale.java

    r7937 r8419  
    1010 * @since 7319
    1111 */
    12 public class ColorScale {
     12public final class ColorScale {
    1313    private double min, max;
    1414    private Color noDataColor;
  • trunk/src/org/openstreetmap/josm/tools/Diff.java

    r8395 r8419  
    152152     It cannot cause incorrect diff output.  */
    153153
    154     private int diag (int xoff, int xlim, int yoff, int ylim) {
     154    private int diag(int xoff, int xlim, int yoff, int ylim) {
    155155        final int[] fd = fdiag; // Give the compiler a chance.
    156156        final int[] bd = bdiag; // Additional help for the compiler.
     
    323323     All line numbers are origin-0 and discarded lines are not counted.  */
    324324
    325     private void compareseq (int xoff, int xlim, int yoff, int ylim) {
     325    private void compareseq(int xoff, int xlim, int yoff, int ylim) {
    326326        /* Slide down the bottom initial diagonal. */
    327327        while (xoff < xlim && yoff < ylim && xvec[xoff] == yvec[yoff]) {
     
    345345            /* Find a point of correspondence in the middle of the files.  */
    346346
    347             int d = diag (xoff, xlim, yoff, ylim);
     347            int d = diag(xoff, xlim, yoff, ylim);
    348348            int c = cost;
    349349            int b = bdiag[bdiagoff + d];
     
    357357            else {
    358358                /* Use that point to split this problem into two subproblems.  */
    359                 compareseq (xoff, b, yoff, b - d);
     359                compareseq(xoff, b, yoff, b - d);
    360360                /* This used to use f instead of b,
    361361                   but that is incorrect!
    362362                   It is not necessarily the case that diagonal d
    363363                   has a snake from b to f.  */
    364                 compareseq (b, xlim, b - d, ylim);
     364                compareseq(b, xlim, b - d, ylim);
    365365            }
    366366        }
     
    494494       and avoid even thinking about them in the main comparison algorithm.  */
    495495
    496         discard_confusing_lines ();
     496        discard_confusing_lines();
    497497
    498498        /* Now do the main comparison algorithm, considering just the
     
    509509        bdiagoff = filevec[1].nondiscardedLines + 1;
    510510
    511         compareseq (0, filevec[0].nondiscardedLines,
     511        compareseq(0, filevec[0].nondiscardedLines,
    512512                0, filevec[1].nondiscardedLines);
    513513        fdiag = null;
     
    517517       in cases where that can validly be done.  */
    518518
    519         shift_boundaries ();
     519        shift_boundaries();
    520520
    521521        /* Get the results of comparison in the form of a chain
     
    631631         * Mark to be discarded each line that matches no line of another file.
    632632         * If a line matches many lines, mark it as provisionally discardable.
     633         * @param counts The count of each equivalence number for the other file.
     634         * @return 0=nondiscardable, 1=discardable or 2=provisionally discardable for each line
    633635         * @see #equivCount()
    634          * @param counts The count of each equivalence number for the other file.
    635          * @return 0=nondiscardable, 1=discardable or 2=provisionally discardable
    636          *  for each line
    637636         */
    638637        private byte[] discardable(final int[] counts) {
  • trunk/src/org/openstreetmap/josm/tools/FontsManager.java

    r8308 r8419  
    1717 * @since 7383
    1818 */
    19 public class FontsManager {
     19public final class FontsManager {
    2020
    2121    /**
  • trunk/src/org/openstreetmap/josm/tools/Geometry.java

    r8395 r8419  
    424424     * @param point Point for which a closest point is searched on line (P1,P2)
    425425     * @return The closest point found on line. It may be outside the segment [P1,P2].
     426     * @see #closestPointToSegment
    426427     * @since 4134
    427      * @see #closestPointToSegment
    428428     */
    429429    public static EastNorth closestPointToLine(EastNorth lineP1, EastNorth lineP2, EastNorth point) {
     
    690690    /**
    691691     * Determines whether path from nodes list is oriented clockwise.
    692      * @see #isClockwise(Way)
    693692     * @param nodes Nodes list to be checked.
    694693     * @return true if and only if way is oriented clockwise.
    695694     * @throws IllegalArgumentException if way is not closed (see {@link Way#isClosed}).
     695     * @see #isClockwise(Way)
    696696     */
    697697    public static boolean isClockwise(List<Node> nodes) {
  • trunk/src/org/openstreetmap/josm/tools/ImageProvider.java

    r8412 r8419  
    466466     * Limit the maximum width of the image.
    467467     * @param maxWidth maximum image width
     468     * @return the current object, for convenience
    468469     * @see #setMaxSize
    469      * @return the current object, for convenience
    470470     */
    471471    public ImageProvider setMaxWidth(int maxWidth) {
     
    477477     * Limit the maximum height of the image.
    478478     * @param maxHeight maximum image height
     479     * @return the current object, for convenience
    479480     * @see #setMaxSize
    480      * @return the current object, for convenience
    481481     */
    482482    public ImageProvider setMaxHeight(int maxHeight) {
     
    11021102            parser.setEntityResolver(new EntityResolver() {
    11031103                @Override
    1104                 public InputSource resolveEntity (String publicId, String systemId) {
     1104                public InputSource resolveEntity(String publicId, String systemId) {
    11051105                    return new InputSource(new ByteArrayInputStream(new byte[0]));
    11061106                }
     
    15451545     * @return the {@code TransparentColor} defined in image reader metadata, or {@code null}
    15461546     * @throws IOException if an error occurs during reading
     1547     * @see <a href="http://docs.oracle.com/javase/7/docs/api/javax/imageio/metadata/doc-files/standard_metadata.html">javax_imageio_1.0 metadata</a>
    15471548     * @since 7499
    1548      * @see <a href="http://docs.oracle.com/javase/7/docs/api/javax/imageio/metadata/doc-files/standard_metadata.html">javax_imageio_1.0 metadata</a>
    15491549     */
    15501550    public static Color getTransparentColor(ColorModel model, ImageReader reader) throws IOException {
  • trunk/src/org/openstreetmap/josm/tools/LanguageInfo.java

    r8404 r8419  
    225225     *
    226226     * @param locale the locale to use, <code>null</code> for default locale
     227     * @return list of codes
    227228     * @since 8283
    228      * @return list of codes
    229229     */
    230230    public static Collection<String> getLanguageCodes(Locale l) {
  • trunk/src/org/openstreetmap/josm/tools/Shortcut.java

    r8395 r8419  
    218218        if (keyStroke == null) return "";
    219219        String modifText = KeyEvent.getKeyModifiersText(keyStroke.getModifiers());
    220         if ("".equals (modifText)) return KeyEvent.getKeyText (keyStroke.getKeyCode ());
    221         return modifText + "+" + KeyEvent.getKeyText(keyStroke.getKeyCode ());
     220        if ("".equals (modifText)) return KeyEvent.getKeyText(keyStroke.getKeyCode());
     221        return modifText + "+" + KeyEvent.getKeyText(keyStroke.getKeyCode());
    222222    }
    223223
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r8404 r8419  
    878878    /**
    879879     * An alternative to {@link String#trim()} to effectively remove all leading and trailing white characters, including Unicode ones.
    880      * @see <a href="http://closingbraces.net/2008/11/11/javastringtrim/">Java’s String.trim has a strange idea of whitespace</a>
    881      * @see <a href="https://bugs.openjdk.java.net/browse/JDK-4080617">JDK bug 4080617</a>
    882880     * @param str The string to strip
    883881     * @return <code>str</code>, without leading and trailing characters, according to
    884882     *         {@link Character#isWhitespace(char)} and {@link Character#isSpaceChar(char)}.
     883     * @see <a href="http://closingbraces.net/2008/11/11/javastringtrim/">Java’s String.trim has a strange idea of whitespace</a>
     884     * @see <a href="https://bugs.openjdk.java.net/browse/JDK-4080617">JDK bug 4080617</a>
    885885     * @since 5772
    886886     */
  • trunk/src/org/openstreetmap/josm/tools/XmlObjectParser.java

    r8390 r8419  
    5454
    5555        @Override
    56         public void startElement (String uri, String localName, String qName, Attributes atts) throws SAXException {
     56        public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
    5757            if ("".equals(uri)) {
    5858                super.startElement(namespace, localName, qName, atts);
Note: See TracChangeset for help on using the changeset viewer.