Changeset 14436 in josm for trunk/src/org


Ignore:
Timestamp:
2018-11-20T02:07:07+01:00 (6 years ago)
Author:
Don-vip
Message:

fix SonarQube issues

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

Legend:

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

    r14397 r14436  
    9393     * @return ImageryInfo object that's ready to be used to create TileSource
    9494     */
    95     private ImageryInfo convertImagery(ImageryInfo info) {
     95    private static ImageryInfo convertImagery(ImageryInfo info) {
    9696        try {
    9797            switch(info.getImageryType()) {
  • trunk/src/org/openstreetmap/josm/data/imagery/AbstractWMSTileSource.java

    r14403 r14436  
    231231    }
    232232
    233     private String getBboxstr(double x1, double x2, double x3, double x4) {
     233    private static String getBboxstr(double x1, double x2, double x3, double x4) {
    234234        return new StringBuilder(64)
    235235                .append(LATLON_FORMAT.format(x1))
  • trunk/src/org/openstreetmap/josm/data/imagery/GetCapabilitiesParseHelper.java

    r13901 r14436  
    66import java.net.URL;
    77import java.util.Locale;
    8 import java.util.function.BiFunction;
     8import java.util.function.BiPredicate;
    99
    1010import javax.xml.namespace.QName;
     
    167167     */
    168168    public static boolean moveReaderToTag(XMLStreamReader reader,
    169             BiFunction<QName, QName, Boolean> equalsFunc, QName... tags) throws XMLStreamException {
     169            BiPredicate<QName, QName> equalsFunc, QName... tags) throws XMLStreamException {
    170170        QName stopTag = reader.getName();
    171171        int currentLevel = 0;
     
    175175
    176176        for (int event = 0; //skip current element, so we will not skip it as a whole
    177                 reader.hasNext() && !(event == XMLStreamReader.END_ELEMENT && equalsFunc.apply(stopTag, reader.getName()));
     177                reader.hasNext() && !(event == XMLStreamReader.END_ELEMENT && equalsFunc.test(stopTag, reader.getName()));
    178178                event = reader.next()) {
    179             if (event == XMLStreamReader.END_ELEMENT && skipTag != null && equalsFunc.apply(skipTag, reader.getName())) {
     179            if (event == XMLStreamReader.END_ELEMENT && skipTag != null && equalsFunc.test(skipTag, reader.getName())) {
    180180                skipTag = null;
    181181            }
    182182            if (skipTag == null) {
    183183                if (event == XMLStreamReader.START_ELEMENT) {
    184                     if (equalsFunc.apply(searchTag, reader.getName())) {
     184                    if (equalsFunc.test(searchTag, reader.getName())) {
    185185                        currentLevel += 1;
    186186                        if (currentLevel >= tags.length) {
     
    194194                }
    195195
    196                 if (event == XMLStreamReader.END_ELEMENT && parentTag != null && equalsFunc.apply(parentTag, reader.getName())) {
     196                if (event == XMLStreamReader.END_ELEMENT && parentTag != null && equalsFunc.test(parentTag, reader.getName())) {
    197197                    currentLevel -= 1;
    198198                    searchTag = parentTag;
  • trunk/src/org/openstreetmap/josm/data/osm/MultipolygonBuilder.java

    r13649 r14436  
    7070         * @return the intersection result for a2 and a1
    7171         */
    72         private PolygonIntersection getReverseIntersectionResult(PolygonIntersection intersection) {
     72        private static PolygonIntersection getReverseIntersectionResult(PolygonIntersection intersection) {
    7373            switch (intersection) {
    7474                case FIRST_INSIDE_SECOND:
  • trunk/src/org/openstreetmap/josm/data/projection/ProjectionCLI.java

    r14435 r14436  
    1414import java.util.Arrays;
    1515import java.util.List;
    16 import java.util.function.Function;
     16import java.util.function.ToDoubleFunction;
    1717
    1818import org.openstreetmap.josm.cli.CLIModule;
     
    166166    }
    167167
    168     private EastNorth parseEastNorth(String s, Function<String, Double> parser) {
     168    private EastNorth parseEastNorth(String s, ToDoubleFunction<String> parser) {
    169169        String[] en = s.split("[;, ]+");
    170170        if (en.length != 2)
    171171            throw new IllegalArgumentException(tr("Expected two coordinates, separated by white space, found {0} in ''{1}''", en.length, s));
    172         double east = parser.apply(en[0]);
    173         double north = parser.apply(en[1]);
     172        double east = parser.applyAsDouble(en[0]);
     173        double north = parser.applyAsDouble(en[1]);
    174174        if (this.argSwitchInput)
    175175            return new EastNorth(north, east);
  • trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java

    r14408 r14436  
    316316     * @return true if one or more ways are in the set of known ways
    317317     */
    318     private boolean hasIntersectionWay(PolyData pd, Set<Way> intersectionWays) {
     318    private static boolean hasIntersectionWay(PolyData pd, Set<Way> intersectionWays) {
    319319        for (Way w : intersectionWays) {
    320320            if (pd.getWayIds().contains(w.getUniqueId())) {
  • trunk/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java

    r14273 r14436  
    150150    }
    151151
    152     private boolean checkMemberType(Role r, RelationMember member) {
     152    private static boolean checkMemberType(Role r, RelationMember member) {
    153153        if (r.types != null) {
    154154            switch (member.getDisplayType()) {
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ConditionFactory.java

    r14214 r14436  
    99import java.util.Objects;
    1010import java.util.Set;
    11 import java.util.function.BiFunction;
     11import java.util.function.BiPredicate;
    1212import java.util.function.IntFunction;
    1313import java.util.function.Predicate;
     
    181181        static final Set<Op> NEGATED_OPS = EnumSet.of(NEQ, NREGEX);
    182182
    183         private final BiFunction<String, String, Boolean> function;
     183        private final BiPredicate<String, String> function;
    184184
    185185        private final boolean negated;
     
    189189         * @param func The function to apply during {@link #eval(String, String)}.
    190190         */
    191         Op(BiFunction<String, String, Boolean> func) {
     191        Op(BiPredicate<String, String> func) {
    192192            this.function = func;
    193193            negated = false;
     
    219219         */
    220220        Op(Op negate) {
    221             this.function = (a, b) -> !negate.function.apply(a, b);
     221            this.function = (a, b) -> !negate.function.test(a, b);
    222222            negated = true;
    223223        }
     
    233233                return negated;
    234234            else
    235                 return function.apply(testString, prototypeString);
     235                return function.test(testString, prototypeString);
    236236        }
    237237    }
  • trunk/src/org/openstreetmap/josm/io/NoteReader.java

    r14101 r14436  
    1111import java.util.Locale;
    1212import java.util.Optional;
    13 import java.util.function.Function;
     13import java.util.function.UnaryOperator;
    1414
    1515import javax.xml.parsers.ParserConfigurationException;
     
    176176    }
    177177
    178     static LatLon parseLatLon(Function<String, String> attrs) {
     178    static LatLon parseLatLon(UnaryOperator<String> attrs) {
    179179        double lat = Double.parseDouble(attrs.apply("lat"));
    180180        double lon = Double.parseDouble(attrs.apply("lon"));
     
    186186    }
    187187
    188     static Note parseNoteBasic(Function<String, String> attrs) {
     188    static Note parseNoteBasic(UnaryOperator<String> attrs) {
    189189        return new Note(parseLatLon(attrs));
    190190    }
     
    194194    }
    195195
    196     static Note parseNoteFull(Function<String, String> attrs) {
     196    static Note parseNoteFull(UnaryOperator<String> attrs) {
    197197        Note note = parseNoteBasic(attrs);
    198198        String id = attrs.apply("id");
  • trunk/src/org/openstreetmap/josm/io/OsmApi.java

    r14121 r14436  
    2121import java.util.Map;
    2222import java.util.function.Consumer;
    23 import java.util.function.Function;
     23import java.util.function.UnaryOperator;
    2424
    2525import javax.xml.parsers.ParserConfigurationException;
     
    367367
    368368    private void individualPrimitiveModification(String method, String verb, IPrimitive osm, ProgressMonitor monitor,
    369             Consumer<String> consumer, Function<String, String> errHandler) throws OsmTransferException {
     369            Consumer<String> consumer, UnaryOperator<String> errHandler) throws OsmTransferException {
    370370        String ret = "";
    371371        try {
  • trunk/src/org/openstreetmap/josm/tools/HiDPISupport.java

    r13849 r14436  
    1515import java.util.Optional;
    1616import java.util.function.Function;
     17import java.util.function.UnaryOperator;
    1718import java.util.stream.Collectors;
    1819import java.util.stream.IntStream;
     
    170171     * for each resolution variant
    171172     */
    172     public static Image processMRImage(Image img, Function<Image, Image> processor) {
     173    public static Image processMRImage(Image img, UnaryOperator<Image> processor) {
    173174        return processMRImages(Collections.singletonList(img), imgs -> processor.apply(imgs.get(0)));
    174175    }
Note: See TracChangeset for help on using the changeset viewer.