Ignore:
Timestamp:
2014-10-19T01:27:04+02:00 (11 years ago)
Author:
donvip
Message:

[josm_plugins] fix java 7 warnings / global usage of try-with-resource

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/relationfix/BoundaryFixer.java

    r28762 r30738  
    1616public class BoundaryFixer extends MultipolygonFixer {
    1717
    18         public BoundaryFixer() {
    19                 super("boundary", "multipolygon");
    20         }
     18    public BoundaryFixer() {
     19        super("boundary", "multipolygon");
     20    }
    2121
    22         /**
    23         * For boundary relations both "boundary" and "multipolygon" types are applicable, but
    24         * it should also have key boundary=administrative to be fully boundary.
    25         * @see http://wiki.openstreetmap.org/wiki/Relation:boundary
    26         */
    27         @Override
    28         public boolean isFixerApplicable(Relation rel) {
    29                 return super.isFixerApplicable(rel) && "administrative".equals(rel.get("boundary"));
    30         }
     22    /**
     23    * For boundary relations both "boundary" and "multipolygon" types are applicable, but
     24    * it should also have key boundary=administrative to be fully boundary.
     25    * @see http://wiki.openstreetmap.org/wiki/Relation:boundary
     26    */
     27    @Override
     28    public boolean isFixerApplicable(Relation rel) {
     29        return super.isFixerApplicable(rel) && "administrative".equals(rel.get("boundary"));
     30    }
    3131
    32         @Override
    33         public boolean isRelationGood(Relation rel) {
    34                 for( RelationMember m : rel.getMembers() ) {
     32    @Override
     33    public boolean isRelationGood(Relation rel) {
     34        for( RelationMember m : rel.getMembers() ) {
    3535            if (m.getType().equals(OsmPrimitiveType.RELATION) && !"subarea".equals(m.getRole())) {
    3636                setWarningMessage(tr("Relation without ''subarea'' role found"));
     
    4343            if (m.getType().equals(OsmPrimitiveType.WAY) && !("outer".equals(m.getRole()) || "inner".equals(m.getRole()))) {
    4444                setWarningMessage(tr("Way without ''inner'' or ''outer'' role found"));
    45                                 return false;
     45                return false;
    4646            }
    4747        }
    48                 clearWarningMessage();
    49                 return true;
    50         }
     48        clearWarningMessage();
     49        return true;
     50    }
    5151
    52         @Override
    53         public Command fixRelation(Relation rel) {
    54                 Relation r = rel;
    55                 Relation rr = fixMultipolygonRoles(r);
    56                 boolean fixed = false;
    57                 if (rr != null) {
    58                         fixed = true;
    59                         r = rr;
    60                 }
    61                 rr = fixBoundaryRoles(r);
    62                 if (rr != null) {
    63                         fixed = true;
    64                         r = rr;
    65                 }
    66                 return fixed ? new ChangeCommand(rel, r) : null;
    67         }
     52    @Override
     53    public Command fixRelation(Relation rel) {
     54        Relation r = rel;
     55        Relation rr = fixMultipolygonRoles(r);
     56        boolean fixed = false;
     57        if (rr != null) {
     58            fixed = true;
     59            r = rr;
     60        }
     61        rr = fixBoundaryRoles(r);
     62        if (rr != null) {
     63            fixed = true;
     64            r = rr;
     65        }
     66        return fixed ? new ChangeCommand(rel, r) : null;
     67    }
    6868
    69         private Relation fixBoundaryRoles( Relation source ) {
     69    private Relation fixBoundaryRoles( Relation source ) {
    7070        Relation r = new Relation(source);
    7171        boolean fixed = false;
Note: See TracChangeset for help on using the changeset viewer.