Changeset 6105 in josm


Ignore:
Timestamp:
2013-08-03T00:17:44+02:00 (6 years ago)
Author:
Don-vip
Message:

see #8902 - Small performance enhancements / coding style (patch by shinigami):

  • removed useles null checks before instanceof
Location:
trunk/src/org/openstreetmap/josm
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/Node.java

    r6069 r6105  
    267267    @Override
    268268    public boolean hasEqualSemanticAttributes(OsmPrimitive other) {
    269         if (other == null || ! (other instanceof Node) )
     269        if (!(other instanceof Node))
    270270            return false;
    271271        if (! super.hasEqualSemanticAttributes(other))
  • trunk/src/org/openstreetmap/josm/data/osm/Relation.java

    r6009 r6105  
    281281    @Override
    282282    public boolean hasEqualSemanticAttributes(OsmPrimitive other) {
    283         if (other == null || ! (other instanceof Relation) )
     283        if (!(other instanceof Relation))
    284284            return false;
    285285        if (! super.hasEqualSemanticAttributes(other))
  • trunk/src/org/openstreetmap/josm/data/osm/Way.java

    r6104 r6105  
    327327    @Override
    328328    public boolean hasEqualSemanticAttributes(OsmPrimitive other) {
    329         if (other == null || ! (other instanceof Way) )
     329        if (!(other instanceof Way))
    330330            return false;
    331331        if (! super.hasEqualSemanticAttributes(other))
  • trunk/src/org/openstreetmap/josm/gui/MapMover.java

    r6084 r6105  
    224224     */
    225225    public static boolean isPlatformOsx() {
    226         return Main.platform != null && Main.platform instanceof PlatformHookOsx;
     226        return Main.platform instanceof PlatformHookOsx;
    227227    }
    228228
  • trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java

    r6070 r6105  
    228228     */
    229229    protected void initFromLayer(Layer layer) {
    230         if (layer == null || ! (layer instanceof OsmDataLayer)) {
     230        if (!(layer instanceof OsmDataLayer)) {
    231231            model.setRelations(null);
    232232            return;
     
    677677    public void tagsChanged(TagsChangedEvent event) {
    678678        OsmPrimitive prim = event.getPrimitive();
    679         if (prim == null || ! (prim instanceof Relation))
     679        if (!(prim instanceof Relation))
    680680            return;
    681681        // trigger a sort of the relation list because the display name may
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationDialogManager.java

    r6084 r6105  
    185185    @Override
    186186    public void layerRemoved(Layer oldLayer) {
    187         if (oldLayer == null || ! (oldLayer instanceof OsmDataLayer))
     187        if (!(oldLayer instanceof OsmDataLayer))
    188188            return;
    189189        OsmDataLayer dataLayer = (OsmDataLayer)oldLayer;
  • trunk/src/org/openstreetmap/josm/gui/help/HelpBrowser.java

    r6084 r6105  
    581581            AttributeSet set = e.getSourceElement().getAttributes();
    582582            Object value = set.getAttribute(Tag.A);
    583             if (value == null || ! (value instanceof SimpleAttributeSet)) return null;
     583            if (!(value instanceof SimpleAttributeSet)) return null;
    584584            SimpleAttributeSet atts = (SimpleAttributeSet)value;
    585585            value = atts.getAttribute(javax.swing.text.html.HTML.Attribute.HREF);
  • trunk/src/org/openstreetmap/josm/gui/history/CoordinateInfoViewer.java

    r6084 r6105  
    252252            HistoryOsmPrimitive p = getPrimitive();
    253253            HistoryOsmPrimitive  opposite = getOppositePrimitive();
    254             if (p == null || ! ( p instanceof HistoryNode)) return;
    255             if (opposite == null || ! (opposite instanceof HistoryNode)) return;
     254            if (!(p instanceof HistoryNode)) return;
     255            if (!(opposite instanceof HistoryNode)) return;
    256256            HistoryNode node = (HistoryNode)p;
    257257            HistoryNode oppositeNode = (HistoryNode) opposite;
     
    325325            HistoryOsmPrimitive p = getPrimitive();
    326326            HistoryOsmPrimitive opposite = getOppositePrimitive();
    327             if (p == null || ! ( p instanceof HistoryNode)) return;
    328             if (opposite == null || ! (opposite instanceof HistoryNode)) return;
     327            if (!(p instanceof HistoryNode)) return;
     328            if (!(opposite instanceof HistoryNode)) return;
    329329            HistoryNode node = (HistoryNode) p;
    330330            HistoryNode oppositeNode = (HistoryNode) opposite;
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java

    r6084 r6105  
    755755    @Override
    756756    public void activeLayerChange(Layer oldLayer, Layer newLayer) {
    757         if (oldLayer != null && oldLayer instanceof OsmDataLayer) {
     757        if (oldLayer instanceof OsmDataLayer) {
    758758            OsmDataLayer l = (OsmDataLayer)oldLayer;
    759759            l.data.removeDataSetListener(this);
    760760        }
    761         if (newLayer == null || ! (newLayer instanceof OsmDataLayer)) {
     761        if (!(newLayer instanceof OsmDataLayer)) {
    762762            latest = null;
    763763            fireModelChange();
  • trunk/src/org/openstreetmap/josm/gui/mappaint/BoxTextElemStyle.java

    r5571 r6105  
    6969        @Override
    7070        public boolean equals(Object obj) {
    71             if (obj == null || !(obj instanceof BoxProvider))
     71            if (!(obj instanceof BoxProvider))
    7272                return false;
    7373            final BoxProvider other = (BoxProvider) obj;
  • trunk/src/org/openstreetmap/josm/gui/mappaint/Environment.java

    r6070 r6105  
    107107
    108108    public boolean hasParentRelation() {
    109         return parent != null && parent instanceof Relation;
     109        return parent instanceof Relation;
    110110    }
    111111
     
    123123            return null;
    124124
    125         if (parent != null && parent instanceof Relation)
     125        if (parent instanceof Relation)
    126126            return ((Relation) parent).getMember(index).getRole();
    127127        if (child != null && osm instanceof Relation)
  • trunk/src/org/openstreetmap/josm/gui/mappaint/MapImage.java

    r5484 r6105  
    130130        @Override
    131131        public boolean equals(Object obj) {
    132             if (obj == null || !(obj instanceof BoxProvider))
     132            if (!(obj instanceof BoxProvider))
    133133                return false;
    134134            if (obj instanceof MapImageBoxProvider) {
Note: See TracChangeset for help on using the changeset viewer.