Changeset 14905 in josm


Ignore:
Timestamp:
2019-03-19T06:19:07+01:00 (5 weeks ago)
Author:
GerdP
Message:

fix #17440: remove confusing code
fixes several sonar lint issues "Local variables should not shadow class fields"

Location:
trunk/src/org/openstreetmap/josm/data/osm
Files:
5 edited

Legend:

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

    r14434 r14905  
    234234    @Override
    235235    public long getId() {
    236         long id = this.id;
    237236        return id >= 0 ? id : 0;
    238237    }
     
    470469    @Override
    471470    public void visitKeys(KeyValueVisitor visitor) {
    472         final String[] keys = this.keys;
    473471        if (keys != null) {
    474472            for (int i = 0; i < keys.length; i += 2) {
     
    640638    @Override
    641639    public final String get(String key) {
    642         String[] keys = this.keys;
    643640        if (key == null)
    644641            return null;
     
    657654     */
    658655    public final String getIgnoreCase(String key) {
    659         String[] keys = this.keys;
    660656        if (key == null)
    661657            return null;
     
    670666    @Override
    671667    public final int getNumKeys() {
    672         String[] keys = this.keys;
    673668        return keys == null ? 0 : keys.length / 2;
    674669    }
     
    676671    @Override
    677672    public final Collection<String> keySet() {
    678         final String[] keys = this.keys;
    679673        if (keys == null) {
    680674            return Collections.emptySet();
     
    845839    public Map<String, String> getInterestingTags() {
    846840        Map<String, String> result = new HashMap<>();
    847         String[] keys = this.keys;
    848841        if (keys != null) {
    849842            for (int i = 0; i < keys.length; i += 2) {
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

    r14654 r14905  
    817817        }
    818818        checkDataset();
    819         final Object referrers = this.referrers;
    820819        if (referrers == null) {
    821820            return Stream.empty();
     
    895894        // Count only referrers that are members of the same dataset (primitive can have some fake references, for example
    896895        // when way is cloned
    897         Object referrers = this.referrers;
    898896        if (referrers == null) return false;
    899897        checkDataset();
  • trunk/src/org/openstreetmap/josm/data/osm/Relation.java

    r13957 r14905  
    464464        DataSet dataSet = getDataSet();
    465465        if (dataSet != null) {
    466             RelationMember[] members = this.members;
    467466            for (RelationMember rm: members) {
    468467                if (rm.getMember().getDataSet() != dataSet)
     
    494493    @Override
    495494    public boolean hasIncompleteMembers() {
    496         RelationMember[] members = this.members;
    497495        for (RelationMember rm: members) {
    498496            if (rm.getMember().isIncomplete()) return true;
     
    509507    public Collection<OsmPrimitive> getIncompleteMembers() {
    510508        Set<OsmPrimitive> ret = new HashSet<>();
    511         RelationMember[] members = this.members;
    512509        for (RelationMember rm: members) {
    513510            if (!rm.getMember().isIncomplete()) {
  • trunk/src/org/openstreetmap/josm/data/osm/TagMap.java

    r11747 r14905  
    176176    @Override
    177177    public String get(Object key) {
    178         String[] tags = this.tags;
    179178        int index = indexOfKey(tags, key);
    180179        return index < 0 ? null : tags[index + 1];
     
    183182    @Override
    184183    public boolean containsValue(Object value) {
    185         String[] tags = this.tags;
    186184        for (int i = 1; i < tags.length; i += 2) {
    187185            if (value.equals(tags[i])) {
  • trunk/src/org/openstreetmap/josm/data/osm/Way.java

    r14302 r14905  
    120120        if (node == null) return false;
    121121
    122         Node[] nodes = this.nodes;
    123122        for (Node n : nodes) {
    124123            if (n.equals(node))
     
    140139        if (node == null) return neigh;
    141140
    142         Node[] nodes = this.nodes;
    143141        for (int i = 0; i < nodes.length; i++) {
    144142            if (nodes[i].equals(node)) {
     
    164162        if (isIncomplete()) return chunkSet;
    165163        Node lastN = null;
    166         Node[] nodes = this.nodes;
    167164        for (Node n : nodes) {
    168165            if (lastN == null) {
     
    466463        if (isIncomplete()) return false;
    467464
    468         Node[] nodes = this.nodes;
    469465        return nodes.length >= 3 && nodes[nodes.length-1] == nodes[0];
    470466    }
     
    492488    @Override
    493489    public Node lastNode() {
    494         Node[] nodes = this.nodes;
    495490        if (isIncomplete() || nodes.length == 0) return null;
    496491        return nodes[nodes.length-1];
     
    499494    @Override
    500495    public Node firstNode() {
    501         Node[] nodes = this.nodes;
    502496        if (isIncomplete() || nodes.length == 0) return null;
    503497        return nodes[0];
     
    506500    @Override
    507501    public boolean isFirstLastNode(INode n) {
    508         Node[] nodes = this.nodes;
    509502        if (isIncomplete() || nodes.length == 0) return false;
    510503        return n == nodes[0] || n == nodes[nodes.length -1];
     
    513506    @Override
    514507    public boolean isInnerNode(INode n) {
    515         Node[] nodes = this.nodes;
    516508        if (isIncomplete() || nodes.length <= 2) return false;
    517509        /* circular ways have only inner nodes, so return true for them! */
     
    536528        DataSet dataSet = getDataSet();
    537529        if (dataSet != null) {
    538             Node[] nodes = this.nodes;
    539530            for (Node n: nodes) {
    540531                if (n.getDataSet() != dataSet)
     
    598589     */
    599590    public boolean hasIncompleteNodes() {
    600         Node[] nodes = this.nodes;
    601591        for (Node node : nodes) {
    602592            if (node.isIncomplete())
     
    612602     */
    613603    public boolean hasOnlyLocatableNodes() {
    614         Node[] nodes = this.nodes;
    615604        for (Node node : nodes) {
    616605            if (!node.isLatLonKnown())
Note: See TracChangeset for help on using the changeset viewer.