Ignore:
Timestamp:
2016-02-23T02:11:42+01:00 (8 years ago)
Author:
Don-vip
Message:

sonar - squid:S2272 - "Iterator.next()" methods should throw "NoSuchElementException" + javadoc/code style

File:
1 edited

Legend:

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

    r9243 r9854  
    77import java.util.Iterator;
    88import java.util.List;
     9import java.util.NoSuchElementException;
    910
    1011import org.openstreetmap.josm.Main;
     
    475476    }
    476477
     478    /**
     479     * Converts to list.
     480     * @return elements as list
     481     */
    477482    public List<T> toList() {
    478483        List<T> a = new ArrayList<>();
     
    498503        private int iteratedOver;
    499504
    500         final QBLevel<T> next_content_node(QBLevel<T> q) {
     505        final QBLevel<T> nextContentNode(QBLevel<T> q) {
    501506            if (q == null)
    502507                return null;
     
    514519                currentNode = qb.root;
    515520            } else {
    516                 currentNode = next_content_node(qb.root);
     521                currentNode = nextContentNode(qb.root);
    517522            }
    518523            iteratedOver = 0;
     
    531536            while ((currentNode.content == null) || (contentIndex >= currentNode.content.size())) {
    532537                contentIndex = 0;
    533                 currentNode = next_content_node(currentNode);
     538                currentNode = nextContentNode(currentNode);
    534539                if (currentNode == null) {
    535540                    break;
     
    544549        public T next() {
    545550            T ret = peek();
     551            if (ret == null)
     552                throw new NoSuchElementException();
    546553            contentIndex++;
    547554            iteratedOver++;
     
    576583    }
    577584
    578     public List<T> search(BBox search_bbox) {
     585    public List<T> search(BBox searchBbox) {
    579586        List<T> ret = new ArrayList<>();
    580587        // Doing this cuts down search cost on a real-life data set by about 25%
     
    583590        }
    584591        // Walk back up the tree when the last search spot can not cover the current search
    585         while (searchCache != null && !searchCache.bbox().bounds(search_bbox)) {
     592        while (searchCache != null && !searchCache.bbox().bounds(searchBbox)) {
    586593            searchCache = searchCache.parent;
    587594        }
     
    589596        if (searchCache == null) {
    590597            searchCache = root;
    591             Main.info("bbox: " + search_bbox + " is out of the world");
     598            Main.info("bbox: " + searchBbox + " is out of the world");
    592599        }
    593600
     
    595602        QBLevel<T> tmp = searchCache.parent;
    596603
    597         searchCache.search(search_bbox, ret);
     604        searchCache.search(searchBbox, ret);
    598605
    599606        // A way that spans this bucket may be stored in one
    600607        // of the nodes which is a parent of the search cache
    601608        while (tmp != null) {
    602             tmp.search_contents(search_bbox, ret);
     609            tmp.search_contents(searchBbox, ret);
    603610            tmp = tmp.parent;
    604611        }
Note: See TracChangeset for help on using the changeset viewer.