Changeset 11817 in josm


Ignore:
Timestamp:
2017-04-01T02:28:03+02:00 (6 months ago)
Author:
Don-vip
Message:

sonar - squid:S1610 - Abstract classes without fields should be converted to interfaces

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/draw/MapViewPath.java

    r11811 r11817  
    1414import org.openstreetmap.josm.gui.MapViewState.MapViewPoint;
    1515import org.openstreetmap.josm.gui.MapViewState.MapViewRectangle;
    16 
    1716
    1817/**
     
    186185     */
    187186    public void appendFromEastNorth(Path2D.Double path) {
    188         new AbstractPathVisitor() {
     187        new PathVisitor() {
    189188            @Override
    190             void visitMoveTo(double x, double y) {
     189            public void visitMoveTo(double x, double y) {
    191190                moveTo(new EastNorth(x, y));
    192191            }
    193192
    194193            @Override
    195             void visitLineTo(double x, double y) {
     194            public void visitLineTo(double x, double y) {
    196195                lineTo(new EastNorth(x, y));
    197196            }
    198197
    199198            @Override
    200             void visitClose() {
     199            public void visitClose() {
    201200                closePath();
    202201            }
     
    302301    }
    303302
    304     private abstract static class AbstractPathVisitor {
     303    private interface PathVisitor {
    305304        /**
    306305         * Append a path to this one. The path is clipped to the current view.
     
    308307         * @return true if adding the path was successful.
    309308         */
    310         public boolean visit(Path2D.Double path) {
     309        default boolean visit(Path2D.Double path) {
    311310            double[] coords = new double[8];
    312311            PathIterator it = path.getPathIterator(null);
     
    332331        }
    333332
    334         abstract void visitClose();
    335 
    336         abstract void visitMoveTo(double x, double y);
    337 
    338         abstract void visitLineTo(double x, double y);
    339     }
    340 
    341     private abstract class AbstractMapPathVisitor extends AbstractPathVisitor {
     333        void visitClose();
     334
     335        void visitMoveTo(double x, double y);
     336
     337        void visitLineTo(double x, double y);
     338    }
     339
     340    private abstract class AbstractMapPathVisitor implements PathVisitor {
    342341        private MapViewPoint lastMoveTo;
    343342
    344343        @Override
    345         void visitMoveTo(double x, double y) {
     344        public void visitMoveTo(double x, double y) {
    346345            MapViewPoint move = state.getForView(x, y);
    347346            lastMoveTo = move;
     
    352351
    353352        @Override
    354         void visitLineTo(double x, double y) {
     353        public void visitLineTo(double x, double y) {
    355354            visitLineTo(state.getForView(x, y));
    356355        }
     
    359358
    360359        @Override
    361         void visitClose() {
     360        public void visitClose() {
    362361            visitLineTo(lastMoveTo);
    363362        }
Note: See TracChangeset for help on using the changeset viewer.