Changeset 36362 in osm


Ignore:
Timestamp:
2025-01-02T14:16:53+01:00 (8 days ago)
Author:
stoecker
Message:

see #23688, patch for local URL calling

Location:
applications/editors/josm/plugins/utilsplugin2/src
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/utilsplugin2/src/edu/princeton/cs/algs4/Bag.java

    r32725 r36362  
    22package edu.princeton.cs.algs4;
    33
    4 /*************************************************************************
     4/* ************************************************************************
    55 *  Compilation:  javac Bag.java
    66 *  Execution:    java Bag < input.txt
  • applications/editors/josm/plugins/utilsplugin2/src/edu/princeton/cs/algs4/EdgeWeightedDigraph.java

    r32725 r36362  
    103103     * Add the edge e to this digraph.
    104104     */
    105     public void addEdge(DirectedEdge e) {
    106         int v = e.from();
    107         adj[v].add(e);
     105    public void addEdge(DirectedEdge ed) {
     106        int v = ed.from();
     107        adj[v].add(ed);
    108108        E++;
    109109    }
    110110
    111111    /**
    112      * Return the edges leaving vertex v as an Iterable.
    113      * To iterate over the edges leaving vertex v, use foreach notation:
    114      * <tt>for (DirectedEdge e : graph.adj(v))</tt>.
     112     * Return the edges leaving vertex ve as an Iterable.
     113     * To iterate over the edges leaving vertex ve, use foreach notation:
     114     * <tt>for (DirectedEdge e : graph.adj(ve))</tt>.
    115115     */
    116     public Iterable<DirectedEdge> adj(int v) {
    117         return adj[v];
     116    public Iterable<DirectedEdge> adj(int ve) {
     117        return adj[ve];
    118118    }
    119119
     
    125125    public Iterable<DirectedEdge> edges() {
    126126        Bag<DirectedEdge> list = new Bag<>();
    127         for (int v = 0; v < V; v++) {
    128             for (DirectedEdge e : adj(v)) {
    129                 list.add(e);
     127        for (int ve = 0; ve < V; ve++) {
     128            for (DirectedEdge ed : adj(ve)) {
     129                list.add(ed);
    130130            }
    131131        }
     
    134134
    135135    /**
    136      * Return number of edges leaving v.
     136     * Return number of edges leaving ve.
    137137     */
    138     public int outdegree(int v) {
    139         return adj[v].size();
     138    public int outdegree(int ve) {
     139        return adj[ve].size();
    140140    }
    141141
  • applications/editors/josm/plugins/utilsplugin2/src/edu/princeton/cs/algs4/IndexMinPQ.java

    r32725 r36362  
    22package edu.princeton.cs.algs4;
    33
    4 /*************************************************************************
     4/* ************************************************************************
    55 *  Compilation:  javac IndexMinPQ.java
    66 *  Execution:    java IndexMinPQ
  • applications/editors/josm/plugins/utilsplugin2/src/edu/princeton/cs/algs4/Stack.java

    r32725 r36362  
    22package edu.princeton.cs.algs4;
    33
    4 /*************************************************************************
     4/* ************************************************************************
    55 *  Compilation:  javac Stack.java
    66 *  Execution:    java Stack < input.txt
     
    160160
    161161
    162     /**
    163      * A test client.
    164      */
     162    ///**
     163    // * A test client.
     164    // */
    165165    //    public static void main(String[] args) {
    166166    //        Stack<String> s = new Stack<String>();
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/OpenPageAction.java

    r35579 r36362  
    77import java.awt.event.ActionEvent;
    88import java.awt.event.KeyEvent;
     9import java.io.IOException;
    910import java.io.UnsupportedEncodingException;
    1011import java.net.URLEncoder;
     12import java.net.HttpURLConnection;
     13import java.net.URL;
    1114import java.util.Collection;
    1215import java.util.regex.Matcher;
     
    98101            addr = addr.replace(keys[j], vals[j]);
    99102        }
     103
     104        // Opened on the local system instead of the browser: local:http://127.0.0.1:<port>/script
     105        Pattern pat_direct = Pattern.compile("local:(http.*)$");
     106        Matcher m_direct = pat_direct.matcher(addr);
     107
    100108        try {
     109            if (m_direct.find()) {
     110                addr = m_direct.group(1);   // replace addr so possible error uses it
     111                Logging.info("Opening on the local system: " + addr);
     112                URL url = new URL(addr);
     113                HttpURLConnection urlConn = (HttpURLConnection) url.openConnection();
     114                urlConn.setRequestMethod("GET");
     115                if (urlConn.getResponseCode() != HttpURLConnection.HTTP_OK) {
     116                    throw new IOException(". GET response:" + urlConn.getResponseCode());
     117                }
     118
    101119            // See #12836 - do not load invalid history
    102             if (!addr.endsWith("/0/history")) {
     120            } else if (!addr.endsWith("/0/history")) {
    103121                OpenBrowser.displayUrl(addr);
    104122            }
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/UtilsPluginPreferences.java

    r34454 r36362  
    137137
    138138    private List<String> readItemsFromTable() {
    139         TableModel model = (table.getModel());
     139        TableModel model = table.getModel();
    140140        String v;
    141141        ArrayList<String> lst = new ArrayList<>();
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/latlon/LatLonDialog.java

    r35476 r36362  
    347347            } else if (m.group(7) != null) {
    348348                sb.append("x");     // cardinal direction
    349                 String c = m.group(7).toUpperCase();
     349                String c = m.group(7).toUpperCase(Locale.ROOT);
    350350                if ("N".equals(c) || "S".equals(c) || "E".equals(c) || "W".equals(c)) {
    351351                    list.add(c);
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/ConnectedMatch.java

    r35476 r36362  
    8080        if (this == obj)
    8181            return true;
    82         if (!super.equals(obj) || getClass() != obj.getClass())
     82        if (!super.equals(obj) || !(obj instanceof ConnectedMatch))
    8383            return false;
    8484        ConnectedMatch other = (ConnectedMatch) obj;
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/InsideMatch.java

    r35476 r36362  
    6262        if (this == obj)
    6363            return true;
    64         if (!super.equals(obj) || getClass() != obj.getClass())
     64        if (!super.equals(obj) || !(obj instanceof InsideMatch))
    6565            return false;
    6666        InsideMatch other = (InsideMatch) obj;
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/IntersectingMatch.java

    r35476 r36362  
    7070        if (this == obj)
    7171            return true;
    72         if (!super.equals(obj) || getClass() != obj.getClass())
     72        if (!super.equals(obj) || !(obj instanceof IntersectingMatch))
    7373            return false;
    7474        IntersectingMatch other = (IntersectingMatch) obj;
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/RangeMatch.java

    r35970 r36362  
    5353        if (this == obj)
    5454            return true;
    55         if (obj == null || getClass() != obj.getClass())
     55        if (!(obj instanceof RangeMatch))
    5656            return false;
    5757        RangeMatch other = (RangeMatch) obj;
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/NodeWayUtils.java

    r35613 r36362  
    433433
    434434    /**
     435     * Get Count of Ray intersections
    435436     * @param point - point to start an OX-parallel  ray
    436437     * @param polygonPoints - poits forming bundary, use null to split unconnected segmants
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectHighwayAction.java

    r35674 r36362  
    194194        public List<Way> getPath(Way to) {
    195195            if (to == null)
    196                 return Collections.singletonList(tree.get(0));
     196                return Collections.unmodifiableList(Collections.singletonList(tree.get(0)));
    197197            int pos = tree.indexOf(to);
    198198            if (pos < 0)
Note: See TracChangeset for help on using the changeset viewer.