Ignore:
Timestamp:
2016-07-06T23:33:59+02:00 (8 years ago)
Author:
donvip
Message:

checkstyle

Location:
applications/editors/josm/plugins/junctionchecking
Files:
1 added
44 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/junctionchecking/.project

    r32286 r32596  
    1616                        </arguments>
    1717                </buildCommand>
     18                <buildCommand>
     19                        <name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
     20                        <arguments>
     21                        </arguments>
     22                </buildCommand>
    1823        </buildSpec>
    1924        <natures>
    2025                <nature>org.eclipse.jdt.core.javanature</nature>
     26                <nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
    2127        </natures>
    2228</projectDescription>
  • applications/editors/josm/plugins/junctionchecking/.settings/org.eclipse.jdt.ui.prefs

    r30725 r32596  
    3636sp_cleanup.remove_private_constructors=true
    3737sp_cleanup.remove_redundant_type_arguments=true
    38 sp_cleanup.remove_trailing_whitespaces=false
     38sp_cleanup.remove_trailing_whitespaces=true
    3939sp_cleanup.remove_trailing_whitespaces_all=true
    4040sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
    4141sp_cleanup.remove_unnecessary_casts=true
    4242sp_cleanup.remove_unnecessary_nls_tags=false
    43 sp_cleanup.remove_unused_imports=false
     43sp_cleanup.remove_unused_imports=true
    4444sp_cleanup.remove_unused_local_variables=false
    4545sp_cleanup.remove_unused_private_fields=true
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/ChannelDiGraphLayer.java

    r32423 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker;
    23
     
    4041
    4142    private ChannelDiGraph digraph;
    42     private static final int POINTSIZE = 5;//original 3
     43    private static final int POINTSIZE = 5; //original 3
    4344    private static final float LINEWIDTH = 4; //original 2
    4445    private final ColorSchemeXMLReader cXMLReader;
     
    4748    static {
    4849        Polygon head = new Polygon();
    49         head.addPoint(  0, 0);
     50        head.addPoint(0, 0);
    5051        head.addPoint(-15, +4);
    5152        head.addPoint(-15, -4);
     
    6263    private Color partOfJunctionColor;
    6364
    64     public ChannelDiGraphLayer(ColorSchemeXMLReader cXMLReader){
     65    public ChannelDiGraphLayer(ColorSchemeXMLReader cXMLReader) {
    6566        super("ChannelDiGraphLayer");
    6667        Main.getLayerManager().addLayerChangeListener(this);
     
    9798    @Override
    9899    public String getToolTipText() {
    99         return tr ("Channel-Digraph created from the active OSM-Layer");
     100        return tr("Channel-Digraph created from the active OSM-Layer");
    100101    }
    101102
     
    128129        if (channel.isPartOfJunction()) {
    129130            c = partOfJunctionColor;
    130         }
    131         else if (channel.isSelected() == true) {
     131        } else if (channel.isSelected() == true) {
    132132            c = selectedChannelColor;
    133         }
    134         else if (channel.isStrongConnected() == false) {
    135             c= nsccChannelColor;
    136         }
    137         else if (channel.getBackChannelID() != -100) {
     133        } else if (channel.isStrongConnected() == false) {
     134            c = nsccChannelColor;
     135        } else if (channel.getBackChannelID() != -100) {
    138136            c = twoWayChannelColor;
    139         }
    140         else {
     137        } else {
    141138            c = oneWayChannelColor;
    142139        }
     
    149146        head = AffineTransform.getTranslateInstance(toPoint.x, toPoint.y).createTransformedShape(head);
    150147        g.fill(head);
    151 
    152148    }
    153149
     
    168164        final float vecY = p2.y - p1.y;
    169165
    170         final float vecLength = (float)Math.sqrt(vecX*vecX + vecY*vecY);
     166        final float vecLength = (float) Math.sqrt(vecX*vecX + vecY*vecY);
    171167
    172168        final float dotProductVecAxis = vecX;
    173169
    174         float angle = (float)Math.acos(dotProductVecAxis / vecLength);
     170        float angle = (float) Math.acos(dotProductVecAxis / vecLength);
    175171
    176172        if (p2.y < p1.y) {
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/DigraphCreationTask.java

    r32423 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker;
    23
     
    4041
    4142    public DigraphCreationTask(JunctionCheckerPlugin plugin, boolean sealGraph, boolean calculateSCC) {
    42         super(tr ("Create Channel Digraph"), false);
     43        super(tr("Create Channel Digraph"), false);
    4344        this.plugin = plugin;
    4445        this.sealGraph = sealGraph;
     
    7980        getProgressMonitor().setTicksCount(tickscounter);
    8081        tickscounter = 1;
    81         getProgressMonitor().subTask(tr ("Converting OSM graph into Channel Digraph"));
     82        getProgressMonitor().subTask(tr("Converting OSM graph into Channel Digraph"));
    8283        getProgressMonitor().setTicks(tickscounter++);
    8384
    8485        OSMGraph graph = new OSMGraph();
    8586        //Der vom Benutzer in JOSM ausgewählte, zur Zeit aktive Layer wird der PLugin-OSM-Layer
    86         plugin.setOsmlayer((OsmDataLayer)Main.getLayerManager().getActiveLayer());
     87        plugin.setOsmlayer((OsmDataLayer) Main.getLayerManager().getActiveLayer());
    8788        Iterator<Node> it = Main.getLayerManager().getEditDataSet().getNodes().iterator();
    8889        while (it.hasNext()) {
     
    117118        ExecuteFilter ef = new ExecuteFilter(reader.getFilters(), graph);
    118119        ef.filter();
    119         getProgressMonitor().subTask(tr ("creating Channel-Digraph"));
     120        getProgressMonitor().subTask(tr("creating Channel-Digraph"));
    120121        getProgressMonitor().setTicks(tickscounter++);
    121122        // ChannelDiGraphen erzeugen
     
    125126        // DiGraph "versiegeln"
    126127        if (sealGraph) {
    127             getProgressMonitor().subTask(tr ("sealing Digraph"));
     128            getProgressMonitor().subTask(tr("sealing Digraph"));
    128129            getProgressMonitor().setTicks(tickscounter++);
    129130            DiGraphSealer sealer = new DiGraphSealer(cdgb.getDigraph(), cdgb
     
    133134        //Digraph starke Zusammenhangskomponenten berechnen
    134135        if (calculateSCC) {
    135             getProgressMonitor().subTask(tr ("calculating Strong Connectedness"));
     136            getProgressMonitor().subTask(tr("calculating Strong Connectedness"));
    136137            getProgressMonitor().setTicks(tickscounter++);
    137138            scc.calculateSCC();
    138139        }
    139         getProgressMonitor().subTask(tr ("creating DigraphLayer"));
     140        getProgressMonitor().subTask(tr("creating DigraphLayer"));
    140141        getProgressMonitor().setTicks(tickscounter++);
    141142        plugin.setChannelDigraph(cdgb.getDigraph());
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckDialog.java

    r30725 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker;
    23
     
    3132 * @author  joerg
    3233 */
    33 public class JunctionCheckDialog extends ToggleDialog implements SelectionChangedListener{
     34public class JunctionCheckDialog extends ToggleDialog implements SelectionChangedListener {
    3435
    3536    private final JunctionCheckerPlugin plugin;
     
    6768
    6869        //Elemente für Grad-Auswahl der Kreuzung
    69         JPanel spinnerpanel = new JPanel(new GridLayout(1,2));
     70        JPanel spinnerpanel = new JPanel(new GridLayout(1, 2));
    7071        smodel = new SpinnerNumberModel(3, 1, 20, 1);
    7172        nways = new JSpinner(smodel);
     
    137138    /**
    138139     * (de)aktiviert Buttons zum JunctionCheck oder Suche
    139      * @param activate
    140140     */
    141141    public void setActivateJunctionCheckOrSearch(boolean activate) {
     
    149149    /**
    150150     * (de)aktiviert Buttons zur Channel Digraph Erstellung
    151      * @param activate
    152151     */
    153152    public void setActivateCreateDigraph(final boolean activate) {
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckTask.java

    r32329 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker;
    23
     
    2122 * @author  joerg
    2223 */
    23 public class JunctionCheckTask extends PleaseWaitRunnable{
     24public class JunctionCheckTask extends PleaseWaitRunnable {
    2425
    2526    private final JunctionChecker jc;
     
    3637        this.subset = subset;
    3738        this.producerelation = produceRelation;
    38         jc = new JunctionChecker(plugin.getChannelDigraph() , n);
     39        jc = new JunctionChecker(plugin.getChannelDigraph(), n);
    3940    }
    4041
     
    5152        }
    5253        progressMonitor.finishTask();
    53         if (jc.isSmallerJunction() ) {
     54        if (jc.isSmallerJunction()) {
    5455            showjunction();
    55             JOptionPane.showMessageDialog(Main.parent, tr ("The marked channels contains a junctioncandidate (white). To test this candidat mark these channel and press the \"Check\" button again."));
    56         }
    57         else if (jc.getCheck()) {
     56            JOptionPane.showMessageDialog(Main.parent,
     57                    tr("The marked channels contains a junctioncandidate (white). To test this candidat mark these channel and press the \"Check\" button again."));
     58        } else if (jc.getCheck()) {
    5859            showjunction();
    59             JOptionPane.showMessageDialog(Main.parent, tr ("The marked channels are a {0}-ways junction", n));
     60            JOptionPane.showMessageDialog(Main.parent, tr("The marked channels are a {0}-ways junction", n));
    6061            plugin.getChannelDigraph().ereaseJunctioncandidate();
    6162            for (int i = 0; i < jc.getSubJunction().size(); i++) {
     
    6566                this.plugin.getRelationProducer().produceRelation(subset, n);
    6667            }
     68        } else if (!jc.getCheck()) {
     69            JOptionPane.showMessageDialog(Main.parent, tr("The marked channels are not a junction:") + jc.getJCheckResult());
    6770        }
    68         else if (!jc.getCheck()) {
    69             JOptionPane.showMessageDialog(Main.parent, tr ("The marked channels are not a junction:") + jc.getJCheckResult());
    70 
    71         }
    72 
    7371    }
    7472
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckerMapMode.java

    r32423 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker;
    23
     
    6667    }
    6768
    68 
    6969    @Override public void mouseDragged(MouseEvent e) {
    70         if ( (e.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) == InputEvent.BUTTON1_DOWN_MASK) {
     70        if ((e.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) == InputEvent.BUTTON1_DOWN_MASK) {
    7171            //if button1 is hold, draw the rectangle.
    7272            paintRect(pointPressed, e.getPoint());
     
    7979        }
    8080        requestFocusInMapView();
    81         digraph.ereaseJunctioncandidate();//um zu verhindern, dass gefundene Kreuzungen/Kandidaten weiterhin weiß gezeichnet werden
     81        digraph.ereaseJunctioncandidate(); //um zu verhindern, dass gefundene Kreuzungen/Kandidaten weiterhin weiß gezeichnet werden
    8282        Point pointReleased = e.getPoint();
    8383
     
    104104     */
    105105    public Rectangle createRect(Point p1, Point p2) {
    106         int x,y,w,h;
     106        int x, y, w, h;
    107107        if (p1.x == p2.x && p1.y == p2.y) {
    108108            //if p1 and p2 same points draw a small rectangle around them
     
    112112            h = 3;
    113113        } else {
    114             if (p1.x < p2.x){
     114            if (p1.x < p2.x) {
    115115                x = p1.x;
    116116                w = p2.x-p1.x;
     
    127127            }
    128128        }
    129         return new Rectangle(x,y,w,h);
     129        return new Rectangle(x, y, w, h);
    130130    }
    131131
     
    136136        if (frame != null) {
    137137            Graphics g = frame.getGraphics();
    138    
     138
    139139            Rectangle r = oldRect;
    140140            if (r != null) {
     
    142142                g.setXORMode(Color.BLACK);
    143143                g.setColor(Color.WHITE);
    144                 g.drawRect(r.x,r.y,r.width,r.height);
     144                g.drawRect(r.x, r.y, r.width, r.height);
    145145            }
    146    
     146
    147147            g.setXORMode(Color.BLACK);
    148148            g.setColor(Color.WHITE);
    149             r = createRect(p1,p2);
    150             g.drawRect(r.x,r.y,r.width,r.height);
     149            r = createRect(p1, p2);
     150            g.drawRect(r.x, r.y, r.width, r.height);
    151151            oldRect = r;
    152152        }
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckerPlugin.java

    r32423 r32596  
    1 /**
    2  * License: GPL. Copyright 2011. Jörg Possin (joerg.possin@uni-muenster.de)
    3  */
     1// License: GPL. For details, see LICENSE file.
    42package org.openstreetmap.josm.plugins.JunctionChecker;
    53
     
    2422
    2523/**
    26  * 
    27  * This plugins helps to create a channel digraph und check channels in this network if it is a 
     24 *
     25 * This plugins helps to create a channel digraph und check channels in this network if it is a
    2826 * junction or searches in a subgraph after junctions.
    29  *
     27 * @author Jörg Possin (joerg.possin@uni-muenster.de)
    3028 */
    3129public class JunctionCheckerPlugin extends Plugin implements LayerChangeListener {
     
    8987            this.getJunctionCheckDialog().setActivateJunctionCheckOrSearch(false);
    9088            return;
    91         }
    92         else {
     89        } else {
    9390            this.getJunctionCheckDialog().setActivateCreateDigraph(false);
    9491        }
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionSearchTask.java

    r30737 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker;
    23
     
    2021 * @author  joerg
    2122 */
    22 public class JunctionSearchTask extends PleaseWaitRunnable{
     23public class JunctionSearchTask extends PleaseWaitRunnable {
    2324
    2425    private final JunctionChecker jc;
     
    3233            HashSet<Channel> subset,
    3334            boolean produceRelation) {
    34         super("JunctionSearch",false);
     35        super("JunctionSearch", false);
    3536        this.plugin = plugin;
    3637        this.n = n;
     
    5657        if (produceRelation) {
    5758            for (int i = 0; i < junctions.size(); i++) {
    58                 plugin.getRelationProducer().produceRelation(junctions.get(i) , n);
     59                plugin.getRelationProducer().produceRelation(junctions.get(i), n);
    5960            }
    6061        }
     
    6667        jc.junctionSearch(new ArrayList<>(subset), getProgressMonitor());
    6768    }
    68 
    6969}
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/PrepareJunctionCheckorSearch.java

    r30737 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker;
    23
     
    2728    }
    2829
    29 
    3030    protected void prepareJunctionCheck() {
    3131        if (prepareSubset()) {
     
    4242    }
    4343
    44     private boolean prepareSubset(){
     44    private boolean prepareSubset() {
    4545        if (plugin.getChannelDigraph().getSelectedChannels().size() < 6) {
    4646            JOptionPane.showMessageDialog(Main.parent, "Less then 6 channels are selected");
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/commandlineinterface/CLI.java

    r30737 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.commandlineinterface;
    23
     
    1617import org.openstreetmap.josm.plugins.JunctionChecker.writing.OSMXMLWriter;
    1718
    18 public class CLI {
     19public final class CLI {
    1920
    2021    /**
    2122     * Die Klasse ist zum Erstellen statistischer Tests, oder zur Erzeugung einer Channel-Digraph-XML-Datei
    22      * @param args
    2323     */
    2424    public static void main(String[] args) {
     
    136136            measuredIterateThroughTime = 0;
    137137            measuredGenerateSubColumnTime = 0;
    138             measuredTime =0;
     138            measuredTime = 0;
    139139            jcf = 0;
    140140            //System.out.println("maxchannel: " + i);
     
    148148                                    .size()) * Math.random()));
    149149                }
    150                 while(!seed.isStrongConnected());
     150                while (!seed.isStrongConnected());
    151151                subset.add(seed);
    152152                //System.out.println("Seed: " + seed.getNewid());
     
    161161                            seed = tempChannel;
    162162                            isIn = true;
    163                         }
    164                         else {
     163                        } else {
    165164                            vorChannel = tempChannel;
    166165                            isIn = false;
    167166                        }
    168                     }while (isIn == false);
     167                    } while (isIn == false);
    169168                }
    170169                start = System.currentTimeMillis();
     
    176175                jcf = jcf + jc.getJunctions().size();
    177176            }
    178             System.out.println("Channels: " + (i) + " Time(Iterate): " + (measuredIterateThroughTime/runs) + " Time(Generate): " + (measuredGenerateSubColumnTime/runs) +" Time(overall): "+ (measuredTime/runs) + " junctionsfound: " + jcf);
     177            System.out.println("Channels: " + (i) +
     178                    " Time(Iterate): " + (measuredIterateThroughTime/runs) +
     179                    " Time(Generate): " + (measuredGenerateSubColumnTime/runs) +
     180                    " Time(overall): "+ (measuredTime/runs) + " junctionsfound: " + jcf);
    179181        }
    180182    }
     
    182184    private static Channel getNeighbourChannel(Channel seedChannel) {
    183185        if (Math.random() < 0.5) {
    184             if (seedChannel.getPredChannels().size() >=1 ) {
     186            if (seedChannel.getPredChannels().size() >= 1) {
    185187                return seedChannel.getPredChannels().get((int) (seedChannel.getPredChannels().size() * Math.random()));
    186             }
    187             else return seedChannel;
    188         }
    189         else {
    190             if (seedChannel.getLeadsTo().size() >=1 ) {
     188            } else return seedChannel;
     189        } else {
     190            if (seedChannel.getLeadsTo().size() >= 1) {
    191191                return seedChannel.getLeadsTo().get((int) (seedChannel.getLeadsTo().size() * Math.random())).getToChannel();
    192             }
    193             else return seedChannel;
     192            } else return seedChannel;
    194193        }
    195194    }
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/connectedness/BacktrackingColors.java

    r30725 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.connectedness;
    23
     
    45 * @author joerg
    56 */
    6 public class BacktrackingColors {
    7    
     7public final class BacktrackingColors {
     8
    89    public static final int WHITE = -1;
    910    public static final int GREY = 0;
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/connectedness/DiGraphSealer.java

    r30737 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.connectedness;
    23
     
    67import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.ChannelDiGraph;
    78import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.LeadsTo;
    8 
    99
    1010/**
     
    105105        this.deleteDuplicateChannels();
    106106    }
    107    
     107
    108108    /*
    109109    private void showLeadsTo() {
     
    135135    }
    136136
    137     /*
     137    /**
    138138     * setzt Wert für IDs für neu angelegte Ways
    139      */
    140     /**
    141      * @param newID
    142139     */
    143140    public void setNewID(int newID) {
     
    146143
    147144    /**
    148      * @return
    149145     * @uml.property  name="newID"
    150146     */
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/connectedness/StrongConnectednessCalculator.java

    r30737 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.connectedness;
    23
    34import java.util.ArrayList;
     5
    46import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.Channel;
    57import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.ChannelDiGraph;
     
    9698     * gibt eine Arraylist mit all den Channels zurück, welche nicht
    9799     * im größten zusammenhägendem Teil des Channel-Digraphen sind
    98      * @return
    99100     */
    100101    public ArrayList<Channel> getNotConnectedChannels() {
     
    116117                tarjan(n);
    117118                v.setLowlink(Math.min(v.getLowlink(), n.getLowlink()));
    118             }
    119             else if (stack.contains(n)) {
     119            } else if (stack.contains(n)) {
    120120                //log.trace("setze lowlink von n auf: " + v.getLowlink());
    121121                v.setLowlink(Math.min(v.getLowlink(), n.getLowlink()));
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/converting/ChannelDigraphBuilder.java

    r30725 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.converting;
    23
     
    4950     * @param toNode toNode  des zu erstellnenden Channels
    5051     * @param way ein zu dem Channel gehörender Way
    51      * @return
    5252     */
    5353    private Channel createChannel(OSMNode fromNode, OSMNode toNode, OSMWay way) {
     
    9595                }
    9696                lastUsedNode = nodes[i];
    97             }
    9897            // wenn der betrachtete Knoten keine Nachfolger hat, ist ein
    9998            // Straßenende erreicht. Auch in diesem Fall muß ein Channel erzeugt werden
    100             else if (nodes[i].getSuccNodeList().size() == 0) {
     99            } else if (nodes[i].getSuccNodeList().size() == 0) {
    101100                tempChannel = createChannel(lastUsedNode, nodes[i], way);
    102101                // Rückrichtung wird nur erzeugt, wenn der OSM-Way keine Einbahnstraße ist
     
    104103                    createBackChannel(nodes[i], lastUsedNode, way, tempChannel);
    105104                }
    106             }
    107105            // eine Straße besteht aus 2 Ways, obwohl eigentlich eine reicht
    108106            // tritt z.b. bei einer brücke auf, brücke wird neuer channel
     
    110108            //      Idee: speichern eines flags, um diese erzeugten Channels zu markieren. aus diesen informationen
    111109            //            später den CHannel löschen!!!
    112             else if (i == nodes.length - 1
     110            } else if (i == nodes.length - 1
    113111                    && nodes[i].getSuccNodeList().size() == 1) {
    114112                // damit ist ein Channel gefunden, und wird mit Werten gefüllt
     
    120118                }
    121119                lastUsedNode = nodes[i];
    122 
    123120            }
    124 
    125121        }
    126122    }
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/converting/NodesConnectionProducer.java

    r30725 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.converting;
    23
     
    1112 */
    1213public class NodesConnectionProducer {
    13    
     14
    1415    private OSMGraph osmgraph;
    1516    private OSMWay[] osmways;
     
    1920        osmways = this.osmgraph.getWays();
    2021    }
    21    
     22
    2223    public void produceNodesConnections() {
    2324        OSMNode[] waynodes;
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/converting/PseudoChannelRemover.java

    r30725 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.converting;
    23
    34import java.util.ArrayList;
     5
    46import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.Channel;
    57import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.ChannelDiGraph;
     
    4850
    4951        //TODO: quick'n'dirty
    50         ArrayList< LeadsTo> tls = succChannel.getLeadsTo();
     52        ArrayList<LeadsTo> tls = succChannel.getLeadsTo();
    5153        for (int i = 0; i < tls.size(); i++) {
    5254            digraph.removeLeadsTo(tls.get(i));
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/converting/TurnRestrictionChecker.java

    r30737 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.converting;
    23
    34import java.util.ArrayList;
     5
    46import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.Channel;
    57import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.ChannelDiGraph;
     
    1315 * Channels des aus dem OSMGraphen erzeugten ChannelDigraphen dementsprechend
    1416 * an. wird vom ChannelDigraphBuilder aufgerufen
    15  * 
     17 *
    1618 * @author Jörg Possin
    1719 */
     
    6264                channelDigraph.addLeadsTo(tempLeadsTo);
    6365                toChannel.addPredChannel(fromChannel);
    64             }
    6566            /*
    6667             * der no_* Fall: wie oben, nur das hier nichts geschieht
    6768             */
    68             else if (turnrestrictionsrelations.get(relationpointer).getValue(
     69            } else if (turnrestrictionsrelations.get(relationpointer).getValue(
    6970            "restriction").startsWith("no")) {
    7071                for (int i = 0; i < fromChannel.getToNode()
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/datastructure/BasicChannel.java

    r30737 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.datastructure;
    23
     
    3233    /**
    3334     * setzt den ToNode
    34      * @param toNode
    3535     */
    3636    public void setToNode(OSMNode toNode) {
     
    6161    /**
    6262     * fügt eine LeadsTo-Beziehung hinzu
    63      * @param leadsTo
    6463     */
    6564    public void addLeadsTo(LeadsTo leadsTo) {
     
    8382    /**
    8483     * gibt alle leadsTo zurück
    85      * @return
    8684     */
    8785    public ArrayList<LeadsTo> getLeadsTo() {
     
    9290     * fügt einen Way hinzu, aus dem der Channel enstanden ist
    9391     * es gibt immer mind. einen Way, es können aber auch mehr sein
    94      * @param way
    9592     */
    9693    public void addWay(OSMWay way) {
     
    10097    /**
    10198     * gibt alle Ways zurück
    102      * @return
    10399     */
    104100    public ArrayList<OSMWay> getWays() {
     
    111107     * mit Werten zu füllen dabei gehen Informationen verloren, da ein Channel
    112108     * aus mehr als einem Way bestehen kann
    113      *
    114      * @return
    115109     */
    116110    public OSMWay getWay() {
     
    119113
    120114    /**
    121      * setzt die ID des Channels. es kann nicht die ID des Ways übernommen werden, da aus einem Way oftmals mehrere Channels entstehen (z.B. bei jeder Nichteinbahnstraße mind. 2)
     115     * setzt die ID des Channels.
     116     * es kann nicht die ID des Ways übernommen werden, da aus einem Way oftmals mehrere Channels entstehen (z.B. bei jeder Nichteinbahnstraße mind. 2)
    122117     */
    123118    public void setNewid(int newid) {
     
    134129    /**
    135130     * gibt alle VorgängerChannels zurück
    136      * @return
    137131     */
    138132    public ArrayList<Channel> getPredChannels() {
     
    145139    @Override
    146140    public String toString() {
    147         String lt ="";
     141        String lt = "";
    148142        for (int i = 0; i < leadsTo.size(); i++) {
    149143            lt += leadsTo.get(i).getToChannel().getNewid() + ", ";
     
    153147            predch += predChannels.get(i).getNewid() + ", ";
    154148        }
    155         return "[ChannelID: "+ newid + ":AnzahlPredCH: " + predChannels.size() + ":PredCh: " + predch +  ":AnzahlSuccCH: " + leadsTo.size() +":LeadsTo: " + lt+ ":backCHID: " + backChannelID + "]";
     149        return "[ChannelID: "+ newid + ":AnzahlPredCH: " + predChannels.size() + ":PredCh: " + predch +
     150                ":AnzahlSuccCH: " + leadsTo.size() +":LeadsTo: " + lt+ ":backCHID: " + backChannelID + "]";
    156151    }
    157152
     
    173168        way.addNode(this.fromNode);
    174169        way.addNode(this.toNode);
    175         way.setId((long)this.newid);
     170        way.setId((long) this.newid);
    176171        if (this.getWay() != null) {
    177172            way.setHashmap(this.getWay().getHashmap());
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/datastructure/Channel.java

    r30737 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.datastructure;
    23
     
    1011 * @author  joerg
    1112 */
    12 public class Channel extends BasicChannel{
     13public class Channel extends BasicChannel {
    1314
    1415    //für den Junctioncheck
     
    2223    private boolean isSelected = false; //wird für den eigenen Layer benötigt, um markierte Channels zu erhalten
    2324    private boolean isPartOfJunction = false; //wird für den eigenen Layer benötigt, um Teile einer Kreuzung farbig repräsentieren zu können
    24    
    25     private final HashMap<Channel , ArrayList<Channel>> paths2 = new HashMap<>();
    26 
     25
     26    private final HashMap<Channel, ArrayList<Channel>> paths2 = new HashMap<>();
    2727
    2828    public Channel(OSMNode fromNode, OSMNode toNode) {
     
    3535    }
    3636
    37     public Channel(){
     37    public Channel() {
    3838        super();
    3939        //this.insidenodes = new ArrayList<OSMNode>();
     
    4545    /**
    4646     * gibt die Anzahl der auf diesen Channel verweisenden leadsTo zurück
    47      * @return
    4847     */
    4948    public int getIndegree() {
     
    5352    /**
    5453     * gibt die Anzahl der aus diesem Channel gehenden leadsTo zurück
    55      * @return
    5654     */
    5755    public int getOutdegree() {
     
    6361    }
    6462
    65     public void setOutdegree(int i){
     63    public void setOutdegree(int i) {
    6664        this.outdegree = i;
    6765    }
     
    9189    /**
    9290     * gibt die von diesem Channel zu erreichenden anderen CHannels zurück
    93      * @return
    9491     */
    9592    public ArrayList<Channel> getReachableNodes() {
     
    9996    /**
    10097     * setzt die zu erreichenden Channels alle anderen werden gelöscht
    101      * @param  reachableNodes
    10298     */
    10399    public int getEnnr() {
     
    107103    /**
    108104     * setzt die Anzahl der EingangsChannel
    109      * @param  ennr
    110105     */
    111106    public void setEnnr(int ennr) {
     
    129124    /**
    130125     * fügt einen erreichbaren Channel hinzu
    131      * @param node
    132126     */
    133127    public void addReachableNode(Channel node) {
     
    140134    /**
    141135     * gibt den an der Position i gespeicherten erreichbaren Channel zurück
    142      * @param i
    143      * @return
    144136     */
    145137    public Channel getReachableNodeAt(int i) {
     
    168160    }
    169161
    170 
    171162    /**
    172163     * fügt einen Pfad den Pfaden zu
    173      * @param path
    174164     */
    175165    public void appendPath(Channel node, ArrayList<Channel> path) {
     
    188178        if (!paths2.get(node).contains(channel)) {
    189179            paths2.get(node).add(channel);
    190 
    191180        }
    192181    }
     
    194183    /**
    195184     * gibt alle Pfade zurück
    196      * @return
    197185     */
    198186    public ArrayList<ArrayList<Channel>> getPaths() {
     
    205193        if (paths2.containsKey(node)) {
    206194            return paths2.get(node);
    207         }
    208         else {
     195        } else {
    209196            //log.error("das darf nicht bei Channel: " + this.getNewid() + ", kein Node " + node.getNewid());
    210197            return null;
    211198        }
    212 
    213199    }
    214200
     
    236222        this.isPartOfJunction = isPartOfJunction;
    237223    }
    238 
    239    
    240224}
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/datastructure/ChannelDiGraph.java

    r30737 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.datastructure;
    23
     
    4243    /**
    4344     * löscht den übergebenden Channel im Digraphen
    44      *
    45      * @param channel
    4645     */
    4746    public void removeChannel(Channel channel) {
     
    5150    /**
    5251     * fügt einen Channel des ChannelDigraphen hinzu
    53      * 
     52     *
    5453     * @param channel
    5554     *            hinzuzufügender Channel
     
    6160    /**
    6261     * Anzahl der innerhalb des DiGraphen gespeicherten Channels
    63      * 
     62     *
    6463     * @return Anzahl der Channels
    6564     */
     
    7069    /**
    7170     * gibt Channel i an der Position i in der ArrayList zurück
    72      * 
     71     *
    7372     * @param i
    7473     *            Position innerhalb der ArrayList
     
    9695     * gibt alle From und To OSMNodes eines Graphen zurück (nicht die
    9796     * ZWischenknoten)
    98      * 
     97     *
    9998     * @return alle From und To Nodes aller Channels des Digraphen
    10099     */
     
    136135    /**
    137136     * fügt eine leadsto-relation dem digraphen und dem entsprechendem Channel hinzu
    138      * @param leadsTo
    139137     */
    140138    public void addLeadsTo(LeadsTo leadsTo) {
     
    161159     * gibt den Channel zurück, der paßt. Sind Channel doppelt vorhanden, wird
    162160     * nur der erste passende zurückgegeben!
    163      *
    164      * @param fromChannel
    165      * @param toChannel
    166      * @return
    167161     */
    168162    public LeadsTo getLeadsTo(Channel fromChannel, Channel toChannel) {
     
    181175    /**
    182176     * gibt alle Channels zurück, die von diesen OSM-Knoten abgehen/hingehen
    183      * @param nodes
    184      * @return
    185      */
    186     public ArrayList<Channel> getChannelsTouchingOSMNodes (ArrayList<OSMNode> nodes) {
     177     */
     178    public ArrayList<Channel> getChannelsTouchingOSMNodes(ArrayList<OSMNode> nodes) {
    187179        ArrayList<Channel> touchingChannel = new ArrayList<>();
    188180        for (int i = 0; i < nodes.size(); i++) {
     
    192184                        touchingChannel.add(channels.get(j));
    193185                    }
    194                 }
    195                 else if (channels.get(j).getToNode().getId() == nodes.get(i).getId()) {
     186                } else if (channels.get(j).getToNode().getId() == nodes.get(i).getId()) {
    196187                    if (!touchingChannel.contains(channels.get(j))) {
    197188                        touchingChannel.add(channels.get(j));
     
    218209    /**
    219210     * gibt den oder die Channels twischen diesen OSM-Punkten zurück
    220      * @param idfrom
    221      * @param idto
    222      * @return
    223211     */
    224212    public ArrayList<Channel> getChannelsBetween(int idfrom, int idto) {
     
    229217                    channelsresult.add(channels.get(i));
    230218                }
    231             }
    232             else if (channels.get(i).getFromNode().getId() == idto) {
     219            } else if (channels.get(i).getFromNode().getId() == idto) {
    233220                if (channels.get(i).getToNode().getId() == idfrom) {
    234221                    channelsresult.add(channels.get(i));
     
    252239        for (int i = 0; i < channels.size(); i++) {
    253240            //log.trace(channels.get(i).getFromNode().toString());
    254             if ( (channels.get(i).getFromNode().getLatitude() <= top) && (channels.get(i).getFromNode().getLatitude() >= bottom)
    255                     && (channels.get(i).getFromNode().getLongitude() >= left) && (channels.get(i).getFromNode().getLongitude() <=right)) {
     241            if ((channels.get(i).getFromNode().getLatitude() <= top) && (channels.get(i).getFromNode().getLatitude() >= bottom)
     242                    && (channels.get(i).getFromNode().getLongitude() >= left) && (channels.get(i).getFromNode().getLongitude() <= right)) {
    256243                channels.get(i).setSelected(true);
    257244                selectedChannels.add(channels.get(i));
    258245            }
    259             if ( (channels.get(i).getToNode().getLatitude() <= top) && (channels.get(i).getToNode().getLatitude() >= bottom)
    260                     && (channels.get(i).getToNode().getLongitude() >= left) && (channels.get(i).getToNode().getLongitude() <=right)) {
     246            if ((channels.get(i).getToNode().getLatitude() <= top) && (channels.get(i).getToNode().getLatitude() >= bottom)
     247                    && (channels.get(i).getToNode().getLongitude() >= left) && (channels.get(i).getToNode().getLongitude() <= right)) {
    261248                channels.get(i).setSelected(true);
    262249                selectedChannels.add(channels.get(i));
     
    298285     * setzt die Channels eines Kreuzungskandidaten
    299286     * falls in im Hashset vorher Channels gespeichert waren, werden diese vorher gelöscht!
    300      * @param junctionCandidate
    301287     */
    302288    public void setJunctioncandidate(HashSet<Channel> junctionCandidate) {
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/datastructure/Graph.java

    r30725 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.datastructure;
    23
     
    56 */
    67public class Graph {
    7    
     8
    89    //Boundingbox
    910    private double bbleft;
     
    1112    private double bbbottom;
    1213    private double bbtop;
    13    
    14    
     14
    1515    public double getBbleft() {
    1616        return bbleft;
    1717    }
     18
    1819    public void setBbleft(double bbleft) {
    1920        this.bbleft = bbleft;
    2021    }
     22
    2123    public double getBbright() {
    2224        return bbright;
    2325    }
     26
    2427    public void setBbright(double bbright) {
    2528        this.bbright = bbright;
    2629    }
     30
    2731    public double getBbbottom() {
    2832        return bbbottom;
    2933    }
     34
    3035    public void setBbbottom(double bbbottom) {
    3136        this.bbbottom = bbbottom;
    3237    }
     38
    3339    public double getBbtop() {
    3440        return bbtop;
    3541    }
     42
    3643    public void setBbtop(double bbtop) {
    3744        this.bbtop = bbtop;
    3845    }
     46
    3947    public boolean isInBBox(OSMNode node) {
    40         if ( (node.getLatitude() <= bbtop) && (node.getLatitude() >= bbbottom)
    41                 && (node.getLongitude() >= bbleft) && (node.getLongitude() <=bbright)) {
     48        if ((node.getLatitude() <= bbtop) && (node.getLatitude() >= bbbottom)
     49                && (node.getLongitude() >= bbleft) && (node.getLongitude() <= bbright)) {
    4250            return true;
    43         }
    44         else {
     51        } else {
    4552            return false;
    4653        }
    4754    }
    48    
    49    
    5055}
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/datastructure/LeadsTo.java

    r30725 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.datastructure;
    23
     
    4647    @Override
    4748    public String toString() {
    48         return "fromChannel:::" + fromChannel.getNewid()  + ", toChannel:::" + toChannel.getNewid() + " über Node " + toChannel.getFromNode().getId();
     49        return "fromChannel:::" + fromChannel.getNewid() + ", toChannel:::" + toChannel.getNewid() + " über Node " + toChannel.getFromNode().getId();
    4950    }
    50 
    51 
    5251}
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/datastructure/OSMEntity.java

    r30737 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.datastructure;
    23
     
    89 */
    910public class OSMEntity {
    10    
     11
    1112    //TODO Idee: alle Wertestandardmäßig auf -1 setzen, so muß
    1213    //man bei der Umwandlung nicht auf null-Werte prüfen
     
    4344     */
    4445    private int version;
    45    
     46
    4647    public void setversion(int version) {
    4748        this.version = version;
    4849    }
    49    
     50
    5051    /**
    51      * @return
    5252     * @uml.property  name="version"
    5353     */
     
    5555        return version;
    5656    }
    57    
     57
    5858    /**
    59      * @return
    6059     * @uml.property  name="id"
    6160     */
     
    6362        return id;
    6463    }
     64
    6565    public void setId(Long id) {
    6666        this.id = id;
    6767    }
     68
    6869    /**
    69      * @return
    7070     * @uml.property  name="visible"
    7171     */
     
    7373        return visible;
    7474    }
     75
    7576    /**
    76      * @param visible
    7777     * @uml.property  name="visible"
    7878     */
     
    8080        this.visible = visible;
    8181    }
     82
    8283    /**
    83      * @return
    8484     * @uml.property  name="timestamp"
    8585     */
     
    8787        return timestamp;
    8888    }
     89
    8990    /**
    90      * @param timestamp
    9191     * @uml.property  name="timestamp"
    9292     */
     
    9494        this.timestamp = timestamp;
    9595    }
     96
    9697    /**
    97      * @return
    9898     * @uml.property  name="user"
    9999     */
     
    101101        return user;
    102102    }
     103
    103104    /**
    104      * @param user
    105105     * @uml.property  name="user"
    106106     */
     
    108108        this.user = user;
    109109    }
     110
    110111    /**
    111      * @return
    112112     * @uml.property  name="uid"
    113113     */
     
    115115        return uid;
    116116    }
     117
    117118    /**
    118      * @param uid
    119119     * @uml.property  name="uid"
    120120     */
     
    122122        this.uid = uid;
    123123    }
     124
    124125    /**
    125      * @return
    126126     * @uml.property  name="changeset"
    127127     */
     
    129129        return changeset;
    130130    }
     131
    131132    /**
    132      * @param changeset
    133133     * @uml.property  name="changeset"
    134134     */
     
    136136        this.changeset = changeset;
    137137    }
     138
    138139    /**
    139      * @return
    140140     * @uml.property  name="hashmap"
    141141     */
     
    143143        return hashmap;
    144144    }
     145
    145146    /**
    146      * @param hashmap
    147147     * @uml.property  name="hashmap"
    148148     */
     
    150150        this.hashmap = hashmap;
    151151    }
    152    
    153     public void setKeyValue(String key, String value){
     152
     153    public void setKeyValue(String key, String value) {
    154154        hashmap.put(key, value);
    155155    }
    156    
    157     public String getValue(String key){
     156
     157    public String getValue(String key) {
    158158        return hashmap.get(key);
    159159    }
    160160
    161     public boolean hasKey(String key){
     161    public boolean hasKey(String key) {
    162162        return hashmap.containsKey(key);
    163163    }
    164    
     164
    165165    /**
    166166     * prüft, ob der übergebene String als Wert existiert
    167      * @param value
    168      * @return
    169167     */
    170     public boolean hasValue(String value){
     168    public boolean hasValue(String value) {
    171169        return hashmap.containsValue(value);
    172170    }
    173    
     171
    174172    protected String valuestoString() {
    175173        return ("ID: " + (id) + "\n" + "User: " + user + "\n");
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/datastructure/OSMGraph.java

    r30737 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.datastructure;
    23
     
    56import java.util.HashMap;
    67import java.util.Iterator;
     8
    79import org.openstreetmap.josm.data.osm.Node;
    810import org.openstreetmap.josm.data.osm.Relation;
     
    1012import org.openstreetmap.josm.data.osm.Way;
    1113
    12 
    1314/**
    1415 * @author  joerg
    1516 */
    16 public class OSMGraph extends Graph{
     17public class OSMGraph extends Graph {
    1718
    1819    private final HashMap<Long, OSMWay> ways = new HashMap<>();
     
    2728     * gibt den Knoten mit der gesuchten OSM-ID zurück
    2829     * @param id OSM-iD des Knotens!
    29      * @return
    3030     */
    3131    public OSMNode getNode(long id) {
     
    3737    }
    3838
    39     public OSMNode[] getNodes(){
    40         OSMNode[] nodearray= new OSMNode[nodes.size()];
     39    public OSMNode[] getNodes() {
     40        OSMNode[] nodearray = new OSMNode[nodes.size()];
    4141        return nodes.values().toArray(nodearray);
    4242    }
     
    5454    }
    5555
    56     public  HashMap<Long, OSMRelation> getRelationsAshashmap() {
     56    public HashMap<Long, OSMRelation> getRelationsAshashmap() {
    5757        return relations;
    5858    }
    5959
    60     public void setRelations( HashMap<Long, OSMRelation> relations) {
     60    public void setRelations(HashMap<Long, OSMRelation> relations) {
    6161        this.relations = relations;
    6262    }
    6363
    6464    public OSMWay[] getWays() {
    65         OSMWay[] wayarray= new OSMWay[ways.size()];
     65        OSMWay[] wayarray = new OSMWay[ways.size()];
    6666        return ways.values().toArray(wayarray);
    6767    }
     
    7171    }
    7272
    73     public OSMRelation[] getRelations(){
     73    public OSMRelation[] getRelations() {
    7474        OSMRelation[] relationarray = new OSMRelation[relations.size()];
    7575        return relations.values().toArray(relationarray);
     
    8686    public ArrayList<Long> getIDsfromWay(int id) {
    8787        OSMWay w = ways.get(id);
    88         ArrayList<Long> ids  = new ArrayList<>();
     88        ArrayList<Long> ids = new ArrayList<>();
    8989        ids.add(w.getToNode().getId());
    9090        ids.add(w.getFromNode().getId());
     
    121121            if (rmember.getMember() instanceof Node) {
    122122                osmrelation.addMember(getNode(rmember.getMember().getId()), rmember.getRole());
    123             }
    124             else if (rmember.getMember() instanceof Way) {
     123            } else if (rmember.getMember() instanceof Way) {
    125124                osmrelation.addMember(getWay(rmember.getMember().getId()), rmember.getRole());
    126125            }
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/datastructure/OSMNode.java

    r30737 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.datastructure;
    23
    34import java.util.ArrayList;
    4 
    55
    66/**
     
    88 */
    99public class OSMNode extends OSMEntity {
    10    
     10
    1111    private double latitude;
    1212    private double longitude;
     
    1414    private ArrayList<OSMNode> succNodeList = new ArrayList<>();
    1515    private ArrayList<OSMNode> predNodeList = new ArrayList<>();
    16    
     16
    1717    public void addOutgoingChannel(Channel channel) {
    1818        outgoingChannels.add(channel);
    1919    }
    20    
     20
    2121    public ArrayList<Channel> getOutgoingChannels() {
    2222        return outgoingChannels;
    2323    }
    24    
     24
    2525    public double getLatitude() {
    2626        return latitude;
    2727    }
     28
    2829    public void setLatitude(double latitude) {
    2930        this.latitude = latitude;
    3031    }
     32
    3133    public double getLongitude() {
    3234        return longitude;
    3335    }
     36
    3437    public void setLongitude(double longitude) {
    3538        this.longitude = longitude;
    3639    }
    37    
    38     public String toString(){
     40
     41    @Override
     42    public String toString() {
    3943        return valuestoString() + "Lat: " + latitude + "\n" + "Lon: " + longitude;
    4044    }
     
    4751        return predNodeList;
    4852    }
    49    
     53
    5054    public void addSuccNode(OSMNode node) {
    5155        succNodeList.add(node);
    5256    }
    53    
     57
    5458    public void addPredNode(OSMNode node) {
    5559        predNodeList.add(node);
    5660    }
    57    
    58    
    59    
    6061}
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/datastructure/OSMRelation.java

    r30737 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.datastructure;
    23
    34import java.util.ArrayList;
    4 
    55
    66/**
     
    1818        return members;
    1919    }
    20    
     20
    2121    /**
    2222     * gibt den Member mit der Rolle zurück, wenn vorhanden. Sonst null
    23      * @param role
    24      * @return
    2523     */
    2624    public OSMEntity getMember(String role) {
     
    3230        return null;
    3331    }
    34    
     32
    3533    public void addMember(OSMEntity member, String role) {
    3634        members.add(new Member(member, role));
    3735    }
    38    
     36
    3937    public String getRelationType(String key) {
    4038        return this.getValue(key);
    4139    }
    42    
     40
     41    @Override
    4342    public String toString() {
    4443        String s = ("Relation-ID: " + this.getId() + " Relation-Type: " + this.getRelationType("type") +"\n");
    4544        for (int i = 0; i < members.size(); i++) {
    46             s += ("Member: " + members.get(i).getRole() + ", ref:" + members.get(i).getId() + ", type:" + members.get(i).getType().getClass().getName() );
     45            s += ("Member: " + members.get(i).getRole() + ", ref:" + members.get(i).getId() + ", type:" + members.get(i).getType().getClass().getName());
    4746        }
    4847        return s;
    4948    }
    50    
     49
    5150
    5251    /**
     
    5958        private String role;
    6059
    61         public Member(OSMEntity member, String role) {
     60        Member(OSMEntity member, String role) {
    6261            this.member = member;
    6362            this.setRole(role);
    6463        }
    65        
     64
    6665        public Class<? extends OSMEntity> getType() {
    6766            return member.getClass();
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/datastructure/OSMWay.java

    r30737 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.datastructure;
    23
     
    1213    public OSMNode[] getNodes() {
    1314        OSMNode[] nodearray = new OSMNode[nodes.size()];
    14         return (OSMNode[]) nodes.toArray(nodearray);
     15        return nodes.toArray(nodearray);
    1516    }
    1617
     
    3637    /**
    3738     * ist der OSMWay eine Einbahnstraße?
    38      * 
     39     *
    3940     * @return true wenn ja, sonst nein
    4041     */
     
    5253            if (t.equals("motorway") || t.equals("motorway_link")) {
    5354                return true;
    54             }
    55 
    56             else {
     55            } else {
    5756                return false;
    5857            }
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/filter/ExecuteFilter.java

    r30725 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.filter;
    23
     
    910 */
    1011public class ExecuteFilter {
    11    
     12
    1213    private Filter[] filter;
    1314    private XMLFilterReader xmlfilterreader;
    1415    private OSMGraph incominggraph;
    1516    private OSMGraph outgoinggraph;
    16    
    17     public ExecuteFilter(Filter[] filter, OSMGraph incoming){
     17
     18    public ExecuteFilter(Filter[] filter, OSMGraph incoming) {
    1819        this.filter = filter;
    1920        this.incominggraph = incoming;
     
    2526        outgoinggraph.setRelations(incoming.getRelationsAshashmap());
    2627    }
    27    
     28
    2829    public ExecuteFilter() {
    2930    }
    30    
    31     public void filter(){
     31
     32    public void filter() {
    3233        OSMWay[] tempWays = incominggraph.getWays();
    3334        String key;
     
    4950                                outgoinggraph.addNode(tempWays[j].getNodes()[j2]);
    5051                            }
    51                            
     52
    5253                        }
    5354                    }
     
    5657        }
    5758    }
    58    
     59
    5960    public Filter[] getFilter() {
    6061        return filter;
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/filter/Filter.java

    r30737 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.filter;
    23
     
    89 */
    910public class Filter {
    10    
     11
    1112    private HashSet<String> tagValues = new HashSet<>();
    1213    private String keyValue;
    13    
     14
    1415    public Filter(String keyname, ArrayList<String> values) {
    1516        this.keyValue = keyname;
    1617        tagValues.addAll(values);
    1718    }
    18    
     19
    1920    public boolean hasTagValue(String value) {
    2021        return tagValues.contains(value);
    2122    }
    22    
    23     public Filter() {   
     23
     24    public Filter() {
    2425    }
    25    
     26
    2627    public String[] getTagValues() {
    2728        return tagValues.toArray(new String[tagValues.size()]);
     
    3132        this.tagValues = tagValues;
    3233    }
    33    
     34
    3435    public void setTagValue(String value) {
    3536        tagValues.add(value);
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/junctionchecking/BackPropagation.java

    r30725 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.junctionchecking;
    23
    34import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.Channel;
    45import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.ChannelDiGraph;
    5 
    66
    77/**
     
    1818
    1919    /**
    20      * 
     20     *
    2121     * @param y fromNode
    2222     * @param z toNode
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/junctionchecking/Combination.java

    r30725 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.junctionchecking;
    23
    34public class Combination {
    4    
     5
    56    private long n = 0;
    67    private long k = 0;
    78    long[] data = null;
    8    
    9     public Combination(long n, long k){
     9
     10    public Combination(long n, long k) {
    1011        if (n < 0 || k < 0)
    1112            try {
     
    1415                // TODO Auto-generated catch block
    1516                e.printStackTrace();
    16             } 
     17            }
    1718        this.n = n;
    1819        this.k = k;
    19         this.data = new long[(int)k];
    20         for (long i = 0; i < k; ++i)
    21           this.data[(int)i] = i;
     20        this.data = new long[(int) k];
     21        for (long i = 0; i < k; ++i) {
     22          this.data[(int) i] = i;
     23        }
    2224      }
    23    
    24     public static long Choose(long n, long k)
    25     {
     25
     26    public static long Choose(long n, long k) {
    2627      if (n < 0 || k < 0)
    2728        try {
     
    3031            // TODO Auto-generated catch block
    3132            e.printStackTrace();
    32         } 
     33        }
    3334      if (n < k) return 0;
    3435      if (n == k) return 1;
     
    3637      long delta, iMax;
    3738
    38       if (k < n-k) // ex: Choose(100,3)
    39       {
     39      if (k < n-k) { // ex: Choose(100,3)
    4040        delta = n-k;
    4141        iMax = k;
    42       }
    43       else         // ex: Choose(100,97)
    44       {
     42      } else {       // ex: Choose(100,97)
    4543        delta = k;
    4644        iMax = n-k;
     
    4947      long ans = delta + 1;
    5048
    51       for (long i = 2; i <= iMax; ++i)
    52       {
    53         ans = (ans * (delta + i)) / i;
     49      for (long i = 2; i <= iMax; ++i) {
     50        ans = (ans * (delta + i)) / i;
    5451      }
    5552
    5653      return ans;
    5754    }
    58     public long Choose()
    59     {
    60      
     55
     56    public long Choose() {
     57
    6158      if (n < k) return 0;
    6259      if (n == k) return 1;
     
    6461      long delta, iMax;
    6562
    66       if (k < n-k) // ex: Choose(100,3)
    67       {
     63      if (k < n-k) { // ex: Choose(100,3)
    6864        delta = n-k;
    6965        iMax = k;
    70       }
    71       else         // ex: Choose(100,97)
    72       {
     66      } else {       // ex: Choose(100,97)
    7367        delta = k;
    7468        iMax = n-k;
     
    7771      long ans = delta + 1;
    7872
    79       for (long i = 2; i <= iMax; ++i)
    80       {
    81         ans = (ans * (delta + i)) / i;
     73      for (long i = 2; i <= iMax; ++i) {
     74        ans = (ans * (delta + i)) / i;
    8275      }
    8376
     
    8578    }
    8679
    87    
    88     public Combination Successor()
    89     {
     80    public Combination Successor() {
    9081      if (this.data.length == 0 ||
    9182          this.data[0] == this.n - this.k)
     
    9586
    9687      long i;
    97       for (i = 0; i < this.k; ++i){
    98         ans.data[(int)i] = this.data[(int)i];
     88      for (i = 0; i < this.k; ++i) {
     89        ans.data[(int) i] = this.data[(int) i];
    9990      }
    100       for (i = this.k - 1; i > 0 && ans.data[(int)i] == this.n - this.k + i; --i) {};
    101      
    102       ++ans.data[(int)i];
     91      for (i = this.k - 1; i > 0 && ans.data[(int) i] == this.n - this.k + i; --i) {
     92          // Count
     93      }
    10394
    104       for (long j = i; j < this.k - 1; ++j){
    105         ans.data[(int)j+1] = ans.data[(int)j] + 1;
    106       } 
     95      ++ans.data[(int) i];
     96
     97      for (long j = i; j < this.k - 1; ++j) {
     98        ans.data[(int) j+1] = ans.data[(int) j] + 1;
     99      }
    107100      return ans;
    108101    }
    109    
    110     public String ToString()
    111       {
     102
     103    public String ToString() {
    112104        StringBuilder sb = new StringBuilder();
    113105        sb.append("{");
    114         for (long i = 0; i < this.k; ++i){
    115           sb.append(this.data[(int)i]);
    116           if (i<this.k-1) sb.append(", ");
     106        for (long i = 0; i < this.k; ++i) {
     107          sb.append(this.data[(int) i]);
     108          if (i < this.k-1) sb.append(", ");
    117109        }
    118110        sb.append("}");
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/junctionchecking/JCheck.java

    r30725 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.junctionchecking;
    23
    34import java.util.ArrayList;
     5
    46import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.Channel;
    57
     
    1820        }
    1921        if (!(entries.size() == exits.size() && exits.size() == n)) {
    20             result="Rule 1 broken: " + entries.size() + " entries but "
     22            result = "Rule 1 broken: " + entries.size() + " entries but "
    2123                    + exits.size() + " exits and n=" + n;
    2224            return false;
     
    2426        for (int i = 0; i < entries.size(); i++) {
    2527            if (!(entries.get(i).getIndegree() + entries.get(i).getOutdegree() >= 2)) {
    26                 result="rule 4 broken: indegree from entrynode with ID: "
     28                result = "rule 4 broken: indegree from entrynode with ID: "
    2729                        + entries.get(i).getNewid() + ": "
    2830                        + entries.get(i).getIndegree() + " OutDegree: "
     
    3335            for (int j = 0; j < exits.size(); j++) {
    3436                if (!(exits.get(j).getIndegree() + exits.get(j).getOutdegree() >= 2)) {
    35                     result="Rule 4 broken, indegree from exitnode with ID: "
     37                    result = "Rule 4 broken, indegree from exitnode with ID: "
    3638                            + exits.get(j).getNewid() + ": "
    3739                            + exits.get(j).getIndegree() + " and outdegree: "
     
    4547                }
    4648                if (exits.get(j).equals(entries.get(i))) {
    47                     result="Rule 2 broken: node with ID: "
     49                    result = "Rule 2 broken: node with ID: "
    4850                            + "entries.get(i).getNode().getId()"
    4951                            + "is both entry and exit node";
     
    5456        }
    5557        if (!(exnr >= n - 1)) {
    56             result="Rule 1 broken";
     58            result = "Rule 1 broken";
    5759            return false;
    5860        }
    5961        for (int i = 0; i < exits.size(); i++) {
    6062            if (!(exits.get(i).getEnnr() >= (n - 1))) {
    61                 result="Rule 1 broken, exit node with ID "
     63                result = "Rule 1 broken, exit node with ID "
    6264                        + exits.get(i).getNewid() + "can only reached from "
    6365                        + exits.get(i).getEnnr() + " entries.";
     
    6870        return true;
    6971    }
    70    
     72
    7173    /**
    7274     * gibt das Ergebnis des JChecks in Form als Satz mit Informationen zurück
    73      * @return
    7475     */
    7576    public String getResult() {
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/junctionchecking/JMinimality.java

    r32423 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.junctionchecking;
    23
     
    2223    private boolean CheckMinimal = true;
    2324    private final ArrayList<Channel> E;
    24     private final int Grid[][];
     25    private final int[][] Grid;
    2526    private final ArrayList<Channel> OrEn;
    2627    private final ArrayList<Channel> OrEx;
    2728    private final int n;
    2829    private final List<List<Object>> L = new ArrayList<>(); //The list of columns to be sorted
    29     private final HashSet<Channel> subgraph = new HashSet<>();//The candidate subgraph to be tested
     30    private final HashSet<Channel> subgraph = new HashSet<>(); //The candidate subgraph to be tested
    3031    private ProgressMonitor pm;
    3132    private final boolean pmenabled;
     
    7475    }
    7576
    76     public void GenerateSubcolumns () {/*Generates all combinations of subcolumns in the grid*/
     77    public void GenerateSubcolumns() { //Generates all combinations of subcolumns in the grid
    7778        if (pmenabled) {
    78             pm.setCustomText(tr ("generate all combinations from entrie/exit candidates"));
     79            pm.setCustomText(tr("generate all combinations from entrie/exit candidates"));
    7980        }
    8081
     
    8485        int[][] v; // this is a column variable containing n y-index entries plus true false values (0/1)
    8586        List<Object> C; //The column is packed together with 2 indices into this variable
    86         for (int i = 0; i < Grid.length;i++) {
     87        for (int i = 0; i < Grid.length; i++) {
    8788            int h = 0;    //this is the index denoting the "n out of Grid.length"- combination, indicating a subcolumn of length n
    8889            do {
     
    9091                C = new ArrayList<>(3);
    9192                v = new int[n][2];
    92                 C.add(i);//the first position of column variable C is the column index
    93                 C.add(h);//the second is the entry-subset index
    94                 for(int t = 0; t < c.data.length; t++){
    95                     if (Grid[(int)c.data[t]][i] == 0){
     93                C.add(i); //the first position of column variable C is the column index
     94                C.add(h); //the second is the entry-subset index
     95                for (int t = 0; t < c.data.length; t++) {
     96                    if (Grid[(int) c.data[t]][i] == 0) {
    9697                        missing++;
    97                         v[t][1]= 0; //false
    98                     }
    99                     else{
    100                         v[t][1]= 1;
     98                        v[t][1] = 0; //false
     99                    } else {
     100                        v[t][1] = 1;
    101101                    } //true
    102                     v[t][0]=(int)c.data[t];    //Write a y index of the combination into column
    103                 }
    104                 if (missing <=1){//If column has at most one missing entry
    105                     C.add(v);//insert column as the third position of column variable C
     102                    v[t][0] = (int) c.data[t];    //Write a y index of the combination into column
     103                }
     104                if (missing <= 1) { //If column has at most one missing entry
     105                    C.add(v); //insert column as the third position of column variable C
    106106                    L.add(C); //Insert C in list to be ordered
    107107                }
    108108                h++; //Iterate through all subcolumns
    109                 if (h < ans){c = c.Successor();}//generate the next combination
    110             }while(h < ans);
     109                if (h < ans) {
     110                    c = c.Successor(); //generate the next combination
     111                }
     112            } while (h < ans);
    111113            c = new Combination(Grid.length, n); //For each original column in the grid, generate new subcolumns
    112114        }
    113115        Collections.sort(L, new Comparator<List<Object>>() {
    114116            @Override
    115                         public int compare(List<Object> o1, List<Object> o2) {
    116                 return (Integer)o1.get(1) - (Integer)o2.get(1); //sort according to h index in each column
    117             }});
    118     }
    119 
    120     public boolean IterateThroughKn() {//Iterates through all K_{n-1} subgrids of the Grid and tests them
    121         if (L.size()==0) {
     117            public int compare(List<Object> o1, List<Object> o2) {
     118                return (Integer) o1.get(1) - (Integer) o2.get(1); //sort according to h index in each column
     119            } });
     120    }
     121
     122    public boolean IterateThroughKn() { //Iterates through all K_{n-1} subgrids of the Grid and tests them
     123        if (L.size() == 0) {
    122124            return true;
    123125        }
     
    130132        List<Object> C;
    131133        ArrayList<int[]> CandidateK = new ArrayList<>(n*n); //saves the candidate K_{n-1} in entry-exit pairs
    132         long lindex= 0;
     134        long lindex = 0;
    133135        int h = 0;
    134136        int m = 0;
     
    140142        boolean hchanged = false;
    141143        C = l.next();
    142         do{ //Loop over list of columns L
    143             if (mchanged){
     144        do { //Loop over list of columns L
     145            if (mchanged) {
    144146                C = l.next(); //Iterator in L
    145147                lindex++; //Index in L
    146148                if (hchanged) {
    147                     m=1;
     149                    m = 1;
    148150                    hchanged = false;
    149151                }
    150152            }
    151             if ((Integer)C.get(1)==h && l.hasNext()){ //m counts the set of columns with index h
     153            if ((Integer) C.get(1) == h && l.hasNext()) { //m counts the set of columns with index h
    152154                m++;
    153155                mchanged = true;
    154             }
    155             else{
    156                 if (l.hasNext()==false){
    157                     m++;lindex++;
     156            } else {
     157                if (l.hasNext() == false) {
     158                    m++;
     159                    lindex++;
    158160                } //At the end of L, counter are set one up
    159161                c = new Combination(m, n);
     
    161163                int missing = 0;
    162164                boolean smallerjunction = false;
    163                 for (int k =0; k<ans;k++){ //Makes sure that subset of m columns contains an n*n subgrid, because ans = m over n would be 0 otherwise
    164                     for (int y = 0; y < n; y++){//Iterates over all rows of subgrid k
    165                         missing =0;    //test = "";
    166                         for (int x = 0; x <c.data.length;x++) { //Iterates over all columns of subgrid k
    167                             x_i=((Integer)L.get((int)(lindex-m+c.data[x])).get(0));//columnindex in grid
    168                             v=((int[][])(L.get((int)(lindex-m+c.data[x])).get(2))); //subcolumn of grid
    169                             y_j= v[y][0]; //rowindex in grid
    170                             if (v[y][1]==0){
     165                for (int k = 0; k < ans; k++) { //Makes sure that subset of m columns contains an n*n subgrid, because ans = m over n would be 0 otherwise
     166                    for (int y = 0; y < n; y++) { //Iterates over all rows of subgrid k
     167                        missing = 0;    //test = "";
     168                        for (int x = 0; x < c.data.length; x++) { //Iterates over all columns of subgrid k
     169                            x_i = ((Integer) L.get((int) (lindex-m+c.data[x])).get(0)); //columnindex in grid
     170                            v = ((int[][]) (L.get((int) (lindex-m+c.data[x])).get(2))); //subcolumn of grid
     171                            y_j = v[y][0]; //rowindex in grid
     172                            if (v[y][1] == 0) {
    171173                                missing++;
    172                             }else{
    173                                 CandidateK.add(new int[]{y_j,x_i});
    174                             }//save entry/exit tuple
    175                             if (smallerjunction == false && ((!OrEn.contains(E.get(v[y][0]))) &&(!OrEx.contains(E.get(x_i))))){ // Tests, whether y or x is not an original entry/exit
     174                            } else {
     175                                CandidateK.add(new int[]{y_j, x_i});
     176                            } //save entry/exit tuple
     177                            if (!smallerjunction && ((!OrEn.contains(E.get(v[y][0])))
     178                                    && (!OrEx.contains(E.get(x_i))))) { // Tests, whether y or x is not an original entry/exit
    176179                                smallerjunction = true; //Then k identifies a different junction than the original one
    177180                            }
    178181                            //test = test+" ("+y_j+", "+x_i+", "+v[y][1]+")";
    179182                        }
    180                         if (missing > 1){
     183                        if (missing > 1) {
    181184                            break;
    182                         }//If a row has more than one missing value, break
     185                        } //If a row has more than one missing value, break
    183186                    }
    184                     if (missing <=1 && smallerjunction == true){//The k-subgrid is a different junction candidate satisfying total reachability
    185                         CheckMinimal = CheckSmallJunction(CandidateK)==false;// If the candidate is a smaller junction, then minimality is false
     187                    if (missing <= 1 && smallerjunction) { //The k-subgrid is a different junction candidate satisfying total reachability
     188                        CheckMinimal = !CheckSmallJunction(CandidateK); // If the candidate is a smaller junction, then minimality is false
    186189                        //log.info("durchlauf: " + durchlauf + " Wert von CheckMinimal: " + CheckMinimal);
    187190                        if (!CheckMinimal) {
     
    190193                    }
    191194                    CandidateK.clear();
    192                     if (k+1 < ans){c = c.Successor();} //Produces the m over n combinations
    193                 }
    194                 m=1; //Sets m to the first column with next index h+1
     195                    if (k+1 < ans) {
     196                        c = c.Successor();
     197                    } //Produces the m over n combinations
     198                }
     199                m = 1; //Sets m to the first column with next index h+1
    195200                h++;
    196201                mchanged = false;
     
    202207            }
    203208        }
    204         while(l.hasNext() && CheckMinimal);
     209        while (l.hasNext() && CheckMinimal);
    205210        return CheckMinimal;
    206211    }
     
    208213    /**
    209214     * gibt true zurück, wenn Kandidat eine Kreuzung ist, aber nicht, wenn junctionsearch auf true gesetzt ist
    210      * @param CandidateK
    211      * @return
    212215     */
    213     public boolean CheckSmallJunction(ArrayList<int[]> CandidateK){
     216    public boolean CheckSmallJunction(ArrayList<int[]> CandidateK) {
    214217        Check = false;
    215         subgraph.clear();//Zu konstruierender Subgraph
     218        subgraph.clear(); //Zu konstruierender Subgraph
    216219        it = CandidateK.iterator();
    217220        //Reconstruct small Junction from paths
    218         while (it.hasNext()){
     221        while (it.hasNext()) {
    219222            int[]point = it.next();
    220223            for (int j = 0; j < E.get(point[0]).getReachableNodes().size(); j++) {
    221                 if(E.get(point[0]).getReachableNodeAt(j).equals(E.get(point[1]))){
     224                if (E.get(point[0]).getReachableNodeAt(j).equals(E.get(point[1]))) {
    222225                    subgraph.addAll(E.get(point[0]).getPathsAt(E.get(point[0]).getReachableNodeAt(j)));
    223226                    subgraph.add(E.get(point[0]));
     
    260263    /**
    261264     * enthält alle Channels des zuletzt durchlaufenden Kreuzungskandidaten (muß keine gültige Kreuzung sein)
    262      * @return
    263265     */
    264     public ArrayList<Channel> getSubJunctionCandidate(){
     266    public ArrayList<Channel> getSubJunctionCandidate() {
    265267        return new ArrayList<>(subgraph);
    266268    }
     
    268270    /**
    269271     * gibt alle gefundenen Kreuzungskandidaten zurück (ist leer, wenn junctionsearch auf true gesetzt wurde)
    270      * @return
    271272     */
    272273    public ArrayList<HashSet<Channel>> getJunctionCandidates() {
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/junctionchecking/JPrepare.java

    r32423 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.junctionchecking;
    23
     
    2122    }
    2223
    23     public void jPrepare (ArrayList<Channel> vertices) {
     24    public void jPrepare(ArrayList<Channel> vertices) {
    2425        this.vertices = vertices;
    2526        entries.clear();
     
    3637        for (int i = 0; i < vertices.size(); i++) {
    3738            for (int j = 0; j < vertices.get(i).getPredChannels().size(); j++) {
    38                 if (vertices.get(i).getPredChannels().get(j).isSubgraph() == false ) {
     39                if (vertices.get(i).getPredChannels().get(j).isSubgraph() == false) {
    3940                    if (!entries.contains(vertices.get(i))) {
    4041                        entries.add(vertices.get(i));
    4142                    }
    42                 }
    43                 else {
     43                } else {
    4444                    vertices.get(i).countupIndegree();
    4545                    //log.trace(vertices.get(i).toString());
     
    5151                        exits.add(vertices.get(i));
    5252                    }
    53                 }
    54                 else {
     53                } else {
    5554                    vertices.get(i).countupOutdegree();
    5655                }
     
    5958    }
    6059
    61     public void resetSubgraph(){
     60    public void resetSubgraph() {
    6261        for (int i = 0; i < vertices.size(); i++) {
    6362            vertices.get(i).setSubgraph(false);
     
    6968    /**
    7069     * gibt die Anzahl der gefundenen Eingänge zurück
    71      * @return
    7270     */
    7371    public ArrayList<Channel> getEntries() {
     
    7775    /**
    7876     * gibt die Anzahl der gefundenen Ausgänge zurück
    79      * @return
    8077     */
    8178    public ArrayList<Channel> getExits() {
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/junctionchecking/JProcess.java

    r30725 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.junctionchecking;
    23
    34import java.util.ArrayList;
     5
    46import org.openstreetmap.josm.plugins.JunctionChecker.connectedness.BacktrackingColors;
    57import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.Channel;
    68import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.ChannelDiGraph;
    79import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.LeadsTo;
    8 
    910
    1011/**
     
    3031     * ruft den TR-DFS und danach den Backpropagation-Algorithmus auf jPrepare
    3132     * muß vorher durchgelaufen sein (die Eingänge müssen bekannt sein)
    32      *
    33      * @param entries
    3433     */
    3534    public void jProcess(ArrayList<Channel> entries) {
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/junctionchecking/JunctionChecker.java

    r30737 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.junctionchecking;
    23
     
    2829    private final JCheck jCheck;
    2930    private ArrayList<Channel> E;
    30     private int Grid[][];
     31    private int[][] Grid;
    3132    private boolean Check;
    3233    private boolean smallerJunction;
     
    5051    /**
    5152     * startet das Überprüfen einer Teilmenge auf die Kreuzungskriterien
    52      * @param subgraph
    53      * @param pm
    5453     */
    5554    public void checkjunctions(ArrayList<Channel> subgraph, ProgressMonitor pm) {
     
    8180     * gesucht werden soll
    8281     *
    83      * @param subgraph
    8482     * @param firstjunction soll nur die erste mögliche Kreuzung ausgegeben werden oder alle
    8583     */
     
    121119     * darf keine weiteren Kreuzungen enthalten)
    122120     */
    123     private ArrayList<HashSet<Channel>> checkJunctionCandidates(ArrayList<HashSet<Channel>> junctioncandidates){
     121    private ArrayList<HashSet<Channel>> checkJunctionCandidates(ArrayList<HashSet<Channel>> junctioncandidates) {
    124122        @SuppressWarnings("unchecked")
    125123        ArrayList<HashSet<Channel>> junctions = (ArrayList<HashSet<Channel>>) junctioncandidates.clone();
     
    129127                    junctions.removeAll(junctioncandidates.get(i));
    130128                }
    131                 else {
    132                 }
    133129            }
    134130        }
    135131        return junctions;
    136132    }
    137 
    138133
    139134    private void collectECandidates(ArrayList<Channel> subgraph) {
     
    216211    /**
    217212     * gibt die kleinere, gefundene Kreuzung zurück (wenn es sie gibt)
    218      *
    219      * @return
    220213     */
    221214    public ArrayList<Channel> getSubJunction() {
     
    247240    /**
    248241     * das Ergebnis des JCheck als String
    249      *
    250      * @return
    251242     */
    252243    public String getJCheckResult() {
     
    257248     * gitb die bei der Kruezungssuche gefundenen Kreuzungen zurück, sonst
    258249     * nichts
    259      *
    260      * @return
    261250     */
    262251    public ArrayList<HashSet<Channel>> getJunctions() {
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/junctionchecking/TRDFS.java

    r32423 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.junctionchecking;
    23
     
    1617    private final ChannelDiGraph digraph;
    1718
    18     /**
    19      *
    20      *
    21      * @param adnodes
    22      */
    2319    public TRDFS(ArrayList<Channel> adnodes, ChannelDiGraph digraph) {
    2420        this.digraph = digraph;
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/reader/ColorSchemeXMLReader.java

    r30737 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.reader;
    23
    34import java.awt.Color;
    45import java.util.HashMap;
     6
    57import javax.xml.stream.XMLStreamConstants;
    68import javax.xml.stream.XMLStreamException;
    79
    8 public class ColorSchemeXMLReader extends XMLReader{
     10public class ColorSchemeXMLReader extends XMLReader {
    911
    1012    private HashMap<String, Color> colorScheme;
     
    2325        if (colorScheme.containsKey(s)) {
    2426            return colorScheme.get(s);
    25         }
    26         else {
     27        } else {
    2728            return Color.GRAY;
    2829        }
     
    4344                        String[] erg = tempValue.split(",");
    4445                        Color c = new Color(Integer.parseInt(erg[0]), Integer.parseInt(erg[1]), Integer.parseInt(erg[2]));
    45                         colorScheme.put(parser.getLocalName(),c);
     46                        colorScheme.put(parser.getLocalName(), c);
    4647                    }
    4748                    break;
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/reader/OSMXMLReader.java

    r30737 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.reader;
    23
    34import java.io.File;
    45import java.util.HashMap;
     6
    57import javax.xml.stream.XMLStreamConstants;
    68import javax.xml.stream.XMLStreamException;
     9
    710import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.OSMEntity;
    811import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.OSMGraph;
     
    6366                    .getAttributeValue(null, "ref"))), parser
    6467                    .getAttributeValue(null, "role"));
    65         }
    66         else if (parser.getAttributeValue(null, "type").equals("way")) {
     68        } else if (parser.getAttributeValue(null, "type").equals("way")) {
    6769            relation.addMember(osmgraph.getWay(Long.parseLong(parser
    6870                    .getAttributeValue(null, "ref"))), parser
    6971                    .getAttributeValue(null, "role"));
    70         }
    71         else if (parser.getAttributeValue(null, "type").equals("relation")) {
     72        } else if (parser.getAttributeValue(null, "type").equals("relation")) {
    7273            relation.addMember(osmgraph.getRelation(Integer.parseInt(parser
    7374                    .getAttributeValue(null, "ref"))), parser
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/reader/XMLFilterReader.java

    r30737 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.reader;
    23
    34import java.util.Vector;
     5
    46import javax.xml.stream.XMLStreamConstants;
    57import javax.xml.stream.XMLStreamException;
     8
    69import org.openstreetmap.josm.plugins.JunctionChecker.filter.Filter;
    710
     
    912 * @author  joerg
    1013 */
    11 public class XMLFilterReader extends XMLReader{
     14public class XMLFilterReader extends XMLReader {
    1215
    1316    Vector<Filter> filters;
     
    2124    @Override
    2225    public void parseXML() {
    23         String tempValue ="";
    24         String tempKeyValue ="";
     26        String tempValue = "";
     27        String tempKeyValue = "";
    2528        try {
    2629            while (parser.hasNext()) {
     
    5457
    5558    public Filter[] getFilters() {
    56         Filter[] filterarray= new Filter[filters.size()];
     59        Filter[] filterarray = new Filter[filters.size()];
    5760        return filters.toArray(filterarray);
    5861    }
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/reader/XMLReader.java

    r30725 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.reader;
    23
     
    45import java.io.FileInputStream;
    56import java.io.FileNotFoundException;
     7
    68import javax.xml.stream.XMLInputFactory;
    79import javax.xml.stream.XMLStreamException;
    810import javax.xml.stream.XMLStreamReader;
    911
    10 public  abstract class XMLReader {
    11    
     12public abstract class XMLReader {
     13
    1214    protected String filename;
    1315    protected XMLInputFactory factory = XMLInputFactory.newInstance();
    1416    protected XMLStreamReader parser;
    15      
     17
    1618    public XMLReader(String filename) {
    1719        try {
     
    2224        }
    2325    }
    24    
     26
    2527    public XMLReader(File file) {
    2628        try {
     
    3335        }
    3436    }
    35    
     37
    3638    public abstract void parseXML();
    3739}
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/util/RelationProducer.java

    r32329 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.util;
    23
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/writing/OSMXMLWriter.java

    r30725 r32596  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.JunctionChecker.writing;
    23
     
    3435        XMLOutputFactory factory = XMLOutputFactory.newInstance();
    3536        writer = factory.createXMLStreamWriter(
    36                                            new FileOutputStream(  filename ) );
     37                                           new FileOutputStream(filename));
    3738        // Der XML-Header wird erzeugt
    3839        writer.writeStartDocument("utf-8", "1.0");
    3940        // Zuerst wird das Wurzelelement mit Attribut geschrieben
    40           writer.writeStartElement( "osm" );
    41             writer.writeAttribute( "version", "0.6" );
     41          writer.writeStartElement("osm");
     42            writer.writeAttribute("version", "0.6");
    4243            writer.writeAttribute("generator", "channelGenerator");
    4344
     
    8586                  if (ways.get(i).isStrongConnected()) {
    8687                      writer.writeAttribute("v", "true");
    87                   }
    88                   else {
     88                  } else {
    8989                      writer.writeAttribute("v", "false");
    9090                  }
     
    9797    }
    9898
    99     private void writeAttributes(OSMEntity ent) throws FileNotFoundException, XMLStreamException{
     99    private void writeAttributes(OSMEntity ent) throws FileNotFoundException, XMLStreamException {
    100100        if (ent instanceof OSMNode) {
    101             writer.writeAttribute("id", Long.toString(ent.getId()) );
     101            writer.writeAttribute("id", Long.toString(ent.getId()));
    102102            writer.writeAttribute("lat", Double.toString(((OSMNode) ent).getLatitude()));
    103103            writer.writeAttribute("lon", Double.toString(((OSMNode) ent).getLongitude()));
    104104        }
    105105
    106         if (ent.getTimestamp()!=null) {
     106        if (ent.getTimestamp() != null) {
    107107            writer.writeAttribute("timestamp", ent.getTimestamp());
    108108        }
Note: See TracChangeset for help on using the changeset viewer.