Ignore:
Timestamp:
2016-07-10T20:44:13+02:00 (8 years ago)
Author:
donvip
Message:

checkstyle

Location:
applications/editors/josm/plugins/graphview
Files:
2 added
85 edited

Legend:

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

    r32286 r32620  
    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/graphview/build.xml

    r32344 r32620  
    22<project name="graphview" default="dist" basedir=".">
    33    <property name="commit.message" value="option to change graph colors; closes ticket 5523 in JOSM Trac"/>
    4     <property name="plugin.main.version" value="10279"/>
     4    <property name="plugin.main.version" value="10420"/>
    55
    66    <!-- Configure these properties (replace "..." accordingly).
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/access/AccessEvaluator.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.access;
    23
     
    2728     *                           != null
    2829     */
    29     public boolean wayUsable(W way, boolean forward,
     30    boolean wayUsable(W way, boolean forward,
    3031            Map<RoadPropertyType<?>, Object> roadPropertyValues);
    3132
     
    3839     *                           property type; != null
    3940     */
    40     public boolean nodeUsable(N node, Map<RoadPropertyType<?>, Object> roadPropertyValues);
    41 
     41    boolean nodeUsable(N node, Map<RoadPropertyType<?>, Object> roadPropertyValues);
    4242}
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/access/AccessParameters.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.access;
    23
     
    1112public interface AccessParameters {
    1213
    13     public String getAccessClass();
     14    String getAccessClass();
    1415
    1516    /**
     
    1718     * @param accessType  access type to check usablitly for; != null
    1819     */
    19     public boolean getAccessTypeUsable(AccessType accessType);
     20    boolean getAccessTypeUsable(AccessType accessType);
    2021
    2122    /**
     
    2425     * @return  collection of property types; != null
    2526     */
    26     public Collection<VehiclePropertyType<?>> getAvailableVehicleProperties();
     27    Collection<VehiclePropertyType<?>> getAvailableVehicleProperties();
    2728
    2829    /**
     
    3536     *                         {@link VehiclePropertyType#isValidValue(Object)} method.
    3637     */
    37     public <V> V getVehiclePropertyValue(VehiclePropertyType<V> vehicleProperty);
    38 
     38    <V> V getVehiclePropertyValue(VehiclePropertyType<V> vehicleProperty);
    3939}
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/access/AccessRuleset.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.access;
    23
     
    2122     *         empty if the parameter was no known mode of transport; != null
    2223     */
    23     public List<String> getAccessHierarchyAncestors(String transportMode);
     24    List<String> getAccessHierarchyAncestors(String transportMode);
    2425
    2526    /**
     
    2829     * (commonly things like highway=* or barrier=*)
    2930     */
    30     public Collection<Tag> getBaseTags();
     31    Collection<Tag> getBaseTags();
    3132
    3233    /**
     
    3435     * @return  list of implications in the order they are expected to be applied; != null
    3536     */
    36     public List<Implication> getImplications();
    37 
     37    List<Implication> getImplications();
    3838}
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/access/AccessRulesetReader.java

    r30737 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.access;
    23
     
    2021 * utility class that can read access rulesets from xml files
    2122 */
    22 public class AccessRulesetReader {
     23public final class AccessRulesetReader {
    2324
    2425    public static class AccessRulesetSyntaxException extends IOException {
     
    2627        public AccessRulesetSyntaxException(String message) {
    2728            super(message);
    28         };
     29        }
     30
    2931        public AccessRulesetSyntaxException(Throwable t) {
    3032            super(t.toString());
     
    5860            final String name;
    5961            final AccessClass parent;
    60             public AccessClass(String name, AccessClass parent) {
     62
     63            AccessClass(String name, AccessClass parent) {
    6164                this.name = name;
    6265                this.parent = parent;
    6366            }
     67
    6468            List<String> getAncestorHierarchy() {
    6569                List<String> names;
     
    7781        private final Collection<Tag> baseTags = new LinkedList<>();
    7882
    79         private static enum Section {NONE, CLASSES, BASETAGS, IMPLICATIONS};
     83        private enum Section { NONE, CLASSES, BASETAGS, IMPLICATIONS }
     84
    8085        private Section currentSection = Section.NONE;
    8186
     
    9095            return new AccessRuleset() {
    9196
     97                @Override
    9298                public List<String> getAccessHierarchyAncestors(String transportMode) {
    9399                    for (AccessClass accessClass : accessClasses) {
     
    99105                }
    100106
     107                @Override
    101108                public Collection<Tag> getBaseTags() {
    102109                    return baseTags;
    103110                }
    104111
     112                @Override
    105113                public List<Implication> getImplications() {
    106114                    return implications;
     
    234242        }
    235243
    236     };
     244    }
    237245}
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/access/AccessType.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.access;
    23
     
    1516
    1617    private String[] valueStrings;
    17     private AccessType(String... valueStrings) {
     18    AccessType(String... valueStrings) {
    1819        this.valueStrings = valueStrings;
    1920    }
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/access/Implication.java

    r30737 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.access;
    23
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/access/ImplicationXMLReader.java

    r30737 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.access;
    23
     
    2122    private final List<Implication> implications = new LinkedList<>();
    2223
    23     private static enum State {BEFORE_IMPLICATION, BEFORE_CONDITION, CONDITION, BEFORE_IMPLIES, IMPLIES, AFTER_IMPLIES};
     24    private enum State { BEFORE_IMPLICATION, BEFORE_CONDITION, CONDITION, BEFORE_IMPLIES, IMPLIES, AFTER_IMPLIES }
     25
    2426    private State state = State.BEFORE_IMPLICATION;
    2527
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/access/RulesetAccessEvaluator.java

    r30737 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.access;
    23
     
    3738    }
    3839
     40    @Override
    3941    public boolean wayUsable(W way, boolean forward,
    4042            Map<RoadPropertyType<?>, Object> segmentPropertyValues) {
     
    6365        /* evaluate one-way tagging */
    6466
    65         String onewayValue =  wayTagsWithImplications.getValue("oneway");
     67        String onewayValue = wayTagsWithImplications.getValue("oneway");
    6668
    6769        if (forward && "-1".equals(onewayValue)
     
    8183    }
    8284
    83     public boolean nodeUsable(N node, Map<RoadPropertyType<?>,Object> roadPropertyValues) {
     85    @Override
     86    public boolean nodeUsable(N node, Map<RoadPropertyType<?>, Object> roadPropertyValues) {
    8487
    8588        TagGroup nodeTags = dataSource.getTagsN(node);
    8689
    8790        return objectUsable(roadPropertyValues, nodeTags);
    88     };
     91    }
    8992
    9093    private boolean objectUsable(Map<RoadPropertyType<?>, Object> roadPropertyValues,
     
    110113            for (String accessClass : ruleset.getAccessHierarchyAncestors(parameters.getAccessClass())) {
    111114                accessType = accessTypePerClass.get(accessClass);
    112                 if (accessType != UNDEFINED) { break; }
     115                if (accessType != UNDEFINED) {
     116                    break;
     117                }
    113118            }
    114119
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/data/DataSource.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.data;
    23
     
    1112
    1213    /** returns all nodes */
    13     public Iterable<N> getNodes();
     14    Iterable<N> getNodes();
    1415
    1516    /** returns all ways */
    16     public Iterable<W> getWays();
     17    Iterable<W> getWays();
    1718
    1819    /** returns all relations */
    19     public Iterable<R> getRelations();
     20    Iterable<R> getRelations();
    2021
    2122    /** returns a node's latitude */
    22     public double getLat(N node);
     23    double getLat(N node);
    2324
    2425    /** returns a node's longitude */
    25     public double getLon(N node);
     26    double getLon(N node);
    2627
    2728    /** returns a way's nodes */
    28     public Iterable<N> getNodes(W way);
     29    Iterable<N> getNodes(W way);
    2930
    3031    /** returns a relation's members */
    31     public Iterable<M> getMembers(R relation);
     32    Iterable<M> getMembers(R relation);
    3233
    3334    /** returns a node's tags */
    34     public TagGroup getTagsN(N node);
     35    TagGroup getTagsN(N node);
    3536
    3637    /** returns a way's tags */
    37     public TagGroup getTagsW(W way);
     38    TagGroup getTagsW(W way);
    3839
    3940    /** returns a relation's tags */
    40     public TagGroup getTagsR(R relation);
     41    TagGroup getTagsR(R relation);
    4142
    4243    /** returns a relation member's role */
    43     public String getRole(M member);
     44    String getRole(M member);
    4445
    4546    /** returns a relation member's member object */
    46     public Object getMember(M member);
     47    Object getMember(M member);
    4748
    4849    /** returns whether a relation member is a node */
    49     public boolean isNMember(M member);
     50    boolean isNMember(M member);
    5051
    5152    /** returns whether a relation member is a way */
    52     public boolean isWMember(M member);
     53    boolean isWMember(M member);
    5354
    5455    /** returns whether a relation member is a relation */
    55     public boolean isRMember(M member);
     56    boolean isRMember(M member);
    5657
    5758    /**
     
    6162     * @param observer  observer object, != null
    6263     */
    63     public void addObserver(DataSourceObserver observer);
     64    void addObserver(DataSourceObserver observer);
    6465
    6566    /**
     
    6970     * @param observer  observer object, != null
    7071     */
    71     public void deleteObserver(DataSourceObserver observer);
    72 
     72    void deleteObserver(DataSourceObserver observer);
    7373}
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/data/DataSourceObserver.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.data;
    23
     
    1213     * @param dataSource  observed data source that has changed; != null
    1314     */
    14     public void update(DataSource<?, ?, ?, ?> dataSource);
    15 
     15    void update(DataSource<?, ?, ?, ?> dataSource);
    1616}
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/data/MapBasedTagGroup.java

    r30737 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.data;
    23
     
    5859    }
    5960
     61    @Override
    6062    public String getValue(String key) {
    6163        assert key != null;
     
    6365    }
    6466
     67    @Override
    6568    public boolean containsKey(String key) {
    6669        assert key != null;
     
    6871    }
    6972
     73    @Override
    7074    public boolean containsValue(String value) {
    7175        assert value != null;
     
    7377    }
    7478
     79    @Override
    7580    public boolean contains(Tag tag) {
    7681        assert tag != null;
     
    7883    }
    7984
     85    @Override
    8086    public int size() {
    8187        return tagMap.size();
     
    8692     * The Iterator does not support the {@link Iterator#remove()} method.
    8793     */
     94    @Override
    8895    public Iterator<Tag> iterator() {
    8996
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/data/Tag.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.data;
    23
     
    2324            return false;
    2425        } else {
    25             Tag otherTag = (Tag)obj;
     26            Tag otherTag = (Tag) obj;
    2627            return key.equals(otherTag.key) && value.equals(otherTag.value);
    2728        }
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/data/TagGroup.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.data;
    23
     
    1213     * @param key  key whose value will be returned; != null
    1314     */
    14     public String getValue(String key);
     15    String getValue(String key);
    1516
    1617    /**
     
    1819     * @param key  key to check for; != null
    1920     */
    20     public boolean containsKey(String key);
     21    boolean containsKey(String key);
    2122
    2223    /**
     
    2425     * @param value  value to check for; != null
    2526     */
    26     public boolean containsValue(String value);
     27    boolean containsValue(String value);
    2728
    2829    /**
     
    3031     * @param tag  tag to check for; != null
    3132     */
    32     public boolean contains(Tag tag);
     33    boolean contains(Tag tag);
    3334
    3435    /**
    3536     * returns the number of tags in this group
    3637     */
    37     public int size();
    38 
     38    int size();
    3939}
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/graph/ConnectorEvaluationGroup.java

    r30737 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.graph;
    23
     
    6263        assert targetNode != null && borderNodes.contains(targetNode);
    6364
    64         if (!evaluated) { throw new IllegalStateException(tr("Group not yet evaluated")); }
     65        if (!evaluated) {
     66            throw new IllegalStateException(tr("Group not yet evaluated"));
     67        }
    6568
    6669        int inboundIndex = borderNodes.indexOf(startNode);
     
    7881        List<Segment>[][] sequenceArray = new List[borderNodes.size()][borderNodes.size()];
    7982
    80         for (int startIndex = 0; startIndex < borderNodes.size(); startIndex ++) {
    81             for (int targetIndex = 0; targetIndex < borderNodes.size(); targetIndex ++) {
     83        for (int startIndex = 0; startIndex < borderNodes.size(); startIndex++) {
     84            for (int targetIndex = 0; targetIndex < borderNodes.size(); targetIndex++) {
    8285
    8386                List<Segment> sequence =
     
    108111        return "ConnectorEG " + segments;
    109112    }
    110 
    111113}
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/graph/EvaluationGroup.java

    r30737 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.graph;
    23
     
    263264    public final void evaluate(Collection<Restriction> restrictions) {
    264265
    265         if (evaluated) { return; }
     266        if (evaluated) {
     267            return;
     268        }
    266269
    267270        evaluateImpl(restrictions);
     
    278281     *                      will not be modified; != null
    279282     */
    280     abstract protected void evaluateImpl(Collection<Restriction> restrictions);
     283    protected abstract void evaluateImpl(Collection<Restriction> restrictions);
    281284
    282285    /**
     
    284287     * @param node  node to check; != null
    285288     */
    286     abstract protected boolean isUsableNode(SegmentNode node);
     289    protected abstract boolean isUsableNode(SegmentNode node);
    287290
    288291    /**
     
    290293     * @param segment  segment to check; != null
    291294     */
    292     abstract protected boolean isUsableSegment(Segment segment);
    293 
     295    protected abstract boolean isUsableSegment(Segment segment);
    294296}
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/graph/GraphEdge.java

    r29854 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.graph;
    23
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/graph/GraphNode.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.graph;
    23
     
    1617     * returns all edges that lead to this GraphNode; != null
    1718     */
    18     public Collection<GraphEdge> getInboundEdges();
     19    Collection<GraphEdge> getInboundEdges();
    1920
    2021    /**
    2122     * returns all edges that start at this GraphNode; != null
    2223     */
    23     public Collection<GraphEdge> getOutboundEdges();
     24    Collection<GraphEdge> getOutboundEdges();
    2425
    2526    /**
     
    2930     *          by {@link #getSegment()}; != null
    3031     */
    31     public SegmentNode getSegmentNode();
     32    SegmentNode getSegmentNode();
    3233
    3334    /**
     
    3637     * @return  Segment; != null
    3738     */
    38     public Segment getSegment();
    39 
     39    Segment getSegment();
    4040}
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/graph/JunctionEvaluationGroup.java

    r30737 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.graph;
    23
     
    3839     */
    3940    public Collection<Segment> getInboundSegments() {
    40         if (!evaluated) { throw new IllegalStateException(tr("Group not yet evaluated")); }
     41        if (!evaluated) {
     42            throw new IllegalStateException(tr("Group not yet evaluated"));
     43        }
    4144        return inboundSegments;
    4245    }
     
    4952     */
    5053    public Collection<Segment> getOutboundSegments() {
    51         if (!evaluated) { throw new IllegalStateException(tr("Group not yet evaluated")); }
     54        if (!evaluated) {
     55            throw new IllegalStateException(tr("Group not yet evaluated"));
     56        }
    5257        return outboundSegments;
    5358    }
     
    6873        assert outboundSegment != null && outboundSegments.contains(outboundSegment);
    6974
    70         if (!evaluated) { throw new IllegalStateException(tr("Group not yet evaluated")); }
     75        if (!evaluated) {
     76            throw new IllegalStateException(tr("Group not yet evaluated"));
     77        }
    7178
    7279        int inboundIndex = inboundSegments.indexOf(inboundSegment);
     
    105112        List<Segment>[][] sequenceArray = new List[inboundSegments.size()][outboundSegments.size()];
    106113
    107         for (int inboundIndex = 0; inboundIndex < inboundSegments.size(); inboundIndex ++) {
    108             for (int outboundIndex = 0; outboundIndex < outboundSegments.size(); outboundIndex ++) {
     114        for (int inboundIndex = 0; inboundIndex < inboundSegments.size(); inboundIndex++) {
     115            for (int outboundIndex = 0; outboundIndex < outboundSegments.size(); outboundIndex++) {
    109116
    110117                List<Segment> sequence =
     
    118125
    119126        segmentSequences = sequenceArray;
    120 
    121127    }
    122128
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/graph/TSBasedWayGraph.java

    r30737 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.graph;
    23
     
    3233        private final List<GraphEdge> incomingEdges = new ArrayList<>();
    3334        private final List<GraphEdge> outgoingEdges = new ArrayList<>();
    34         public GraphNodeImpl(SegmentNode node, Segment segment) {
     35
     36        GraphNodeImpl(SegmentNode node, Segment segment) {
    3537            assert node != null && segment != null;
    3638            assert segment.getNode1() == node || segment.getNode2() == node;
     
    3840            this.segment = segment;
    3941        }
     42
     43        @Override
    4044        public SegmentNode getSegmentNode() {
    4145            return node;
    4246        }
     47
     48        @Override
    4349        public Segment getSegment() {
    4450            return segment;
    4551        }
     52
    4653        public void addIncomingEdge(GraphEdge edge) {
    4754            assert edge != null;
    4855            incomingEdges.add(edge);
    4956        }
     57
     58        @Override
    5059        public Collection<GraphEdge> getInboundEdges() {
    5160            return incomingEdges;
    5261        }
     62
    5363        public void addOutgoingEdge(GraphEdge edge) {
    5464            assert edge != null;
    5565            outgoingEdges.add(edge);
    5666        }
     67
     68        @Override
    5769        public Collection<GraphEdge> getOutboundEdges() {
    5870            return outgoingEdges;
    5971        }
     72
    6073        @Override
    6174        public String toString() {
     
    7083        private final Map<GraphEdgePropertyType<?>, Object> properties;
    7184
    72         public GraphEdgeImpl(GraphNode startNode, GraphNode targetNode,
     85        GraphEdgeImpl(GraphNode startNode, GraphNode targetNode,
    7386                Map<GraphEdgePropertyType<?>, Object> properties) {
    7487            assert startNode != null && targetNode != null && properties != null;
     
    7891        }
    7992
     93        @Override
    8094        public GraphNode getStartNode() {
    8195            return startNode;
    8296        }
     97
     98        @Override
    8399        public GraphNode getTargetNode() {
    84100            return targetNode;
    85101        }
    86102
     103        @Override
    87104        public Collection<GraphEdgePropertyType<?>> getAvailableProperties() {
    88105            return properties.keySet();
    89106        }
     107
     108        @Override
    90109        public <V> V getPropertyValue(GraphEdgePropertyType<V> property) {
    91110            @SuppressWarnings("unchecked")
     
    99118        }
    100119
    101     };
     120    }
    102121
    103122    private final Set<WayGraphObserver> observers = new HashSet<>();
     
    121140    }
    122141
     142    @Override
    123143    public Collection<GraphEdge> getEdges() {
    124144        return edges;
    125145    }
    126146
     147    @Override
    127148    public Collection<GraphNode> getNodes() {
    128149        return nodes;
     
    478499    }
    479500
     501    @Override
    480502    public void update(TransitionStructure transitionStructure) {
    481503        createNodesAndEdges();
     
    483505    }
    484506
     507    @Override
    485508    public void addObserver(WayGraphObserver observer) {
    486509        observers.add(observer);
    487510    }
    488511
     512    @Override
    489513    public void deleteObserver(WayGraphObserver observer) {
    490514        observers.remove(observer);
     
    496520        }
    497521    }
    498 
    499522}
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/graph/WayGraph.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.graph;
    23
     
    910
    1011    Collection<GraphNode> getNodes();
     12
    1113    Collection<GraphEdge> getEdges();
    1214
     
    1719     * @param observer  observer object, != null
    1820     */
    19     public void addObserver(WayGraphObserver observer);
     21    void addObserver(WayGraphObserver observer);
    2022
    2123    /**
     
    2527     * @param observer  observer object, != null
    2628     */
    27     public void deleteObserver(WayGraphObserver observer);
     29    void deleteObserver(WayGraphObserver observer);
    2830
    2931}
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/graph/WayGraphObserver.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.graph;
    23
     
    1112     * @param wayGraph  observed graph that has changed; != null
    1213     */
    13     public void update(WayGraph wayGraph);
    14 
     14    void update(WayGraph wayGraph);
    1515}
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/property/GraphEdgePropertyType.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.property;
    23
     
    2122     * determines the property value for segments created from junction groups
    2223     */
    23     public V evaluate(JunctionEvaluationGroup junctionGroup,
     24    V evaluate(JunctionEvaluationGroup junctionGroup,
    2425            List<Segment> segmentSequence,
    2526            TransitionStructure transitionStructure);
     
    2829     * determines the property value for segments created from connector groups
    2930     */
    30     public V evaluate(ConnectorEvaluationGroup connectorGroup,
     31    V evaluate(ConnectorEvaluationGroup connectorGroup,
    3132            List<Segment> segmentSequence,
    3233            TransitionStructure transitionStructure);
    33 
    3434}
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/property/GraphEdgeSegments.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.property;
    23
     
    2526    private GraphEdgeSegments() { }
    2627
     28    @Override
    2729    public List<Segment> evaluate(JunctionEvaluationGroup junctionGroup,
    2830            List<Segment> segmentSequence, TransitionStructure transitionStructure) {
     
    3032    }
    3133
     34    @Override
    3235    public List<Segment> evaluate(ConnectorEvaluationGroup connectorGroup,
    3336            List<Segment> segmentSequence, TransitionStructure transitionStructure) {
    3437        return segmentSequence;
    3538    }
    36 
    3739}
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/property/RoadIncline.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.property;
    23
     
    89public class RoadIncline implements RoadPropertyType<Float> {
    910
     11    @Override
    1012    public <N, W, R, M> Float evaluateN(N node, AccessParameters accessParameters,
    11             DataSource<N,W,R,M> dataSource) {
     13            DataSource<N, W, R, M> dataSource) {
    1214        return null;
    13     };
     15    }
    1416
     17    @Override
    1518    public <N, W, R, M> Float evaluateW(W way, boolean forward, AccessParameters accessParameters,
    16             DataSource<N,W,R,M> dataSource) {
     19            DataSource<N, W, R, M> dataSource) {
    1720        assert way != null && accessParameters != null && dataSource != null;
    1821
     
    3134
    3235        return null;
    33     };
     36    }
    3437
     38    @Override
    3539    public boolean isUsable(Object propertyValue, AccessParameters accessParameters) {
    3640        assert propertyValue instanceof Float;
    3741
    38         float incline = (Float)propertyValue;
     42        float incline = (Float) propertyValue;
    3943
    4044        Float maxInclineUp =
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/property/RoadMaxaxleload.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.property;
    23
     
    910        super("maxaxleload", AXLELOAD, LimitType.MAXIMUM);
    1011    }
     12
    1113    @Override
    1214    protected Float parse(String valueString) {
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/property/RoadMaxheight.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.property;
    23
     
    910        super("maxheight", HEIGHT, LimitType.MAXIMUM);
    1011    }
     12
    1113    @Override
    1214    protected Float parse(String valueString) {
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/property/RoadMaxlength.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.property;
    23
     
    910        super("maxlength", LENGTH, LimitType.MAXIMUM);
    1011    }
     12
    1113    @Override
    1214    protected Float parse(String valueString) {
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/property/RoadMaxspeed.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.property;
    23
     
    3031    }
    3132
     33    @Override
    3234    public <N, W, R, M> Float evaluateN(N node, AccessParameters accessParameters,
    3335            DataSource<N, W, R, M> dataSource) {
     
    3941    }
    4042
     43    @Override
    4144    public <N, W, R, M> Float evaluateW(W way, boolean forward, AccessParameters accessParameters,
    4245            DataSource<N, W, R, M> dataSource) {
     
    6366    }
    6467
     68    @Override
    6569    public boolean isUsable(Object propertyValue, AccessParameters accessParameters) {
    6670        assert propertyValue instanceof Float;
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/property/RoadMaxweight.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.property;
    23
     
    910        super("maxweight", WEIGHT, LimitType.MAXIMUM);
    1011    }
     12
    1113    @Override
    1214    protected Float parse(String valueString) {
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/property/RoadMaxwidth.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.property;
    23
     
    910        super("maxwidth", WIDTH, LimitType.MAXIMUM);
    1011    }
     12
    1113    @Override
    1214    protected Float parse(String valueString) {
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/property/RoadMinspeed.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.property;
    23
     
    910        super("minspeed", SPEED, LimitType.MINIMUM);
    1011    }
     12
    1113    @Override
    1214    protected Float parse(String valueString) {
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/property/RoadPropertyType.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.property;
    23
     
    2627     *                          null if property cannot be determined / does not apply
    2728     */
    28     public <N, W, R, M> V evaluateW(W way, boolean forward,
     29    <N, W, R, M> V evaluateW(W way, boolean forward,
    2930            AccessParameters accessParameters, DataSource<N, W, R, M> dataSource);
    3031
     
    3940     *                          null if property cannot be determined / does not apply
    4041     */
    41     public <N, W, R, M> V evaluateN(N node,
     42    <N, W, R, M> V evaluateN(N node,
    4243            AccessParameters accessParameters, DataSource<N, W, R, M> dataSource);
    4344
     
    4950     *                MUST be of type V; != null
    5051     */
    51     public boolean isUsable(Object object, AccessParameters accessParameters);
    52 
     52    boolean isUsable(Object object, AccessParameters accessParameters);
    5353}
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/property/RoadSurface.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.property;
    23
     
    910public class RoadSurface implements RoadPropertyType<String> {
    1011
     12    @Override
    1113    public <N, W, R, M> String evaluateN(N node, AccessParameters accessParameters,
    12             DataSource<N,W,R,M> dataSource) {
     14            DataSource<N, W, R, M> dataSource) {
    1315        return null;
    14     };
     16    }
    1517
     18    @Override
    1619    public <N, W, R, M> String evaluateW(W way, boolean forward, AccessParameters accessParameters,
    17             DataSource<N,W,R,M> dataSource) {
     20            DataSource<N, W, R, M> dataSource) {
    1821        assert way != null && accessParameters != null && dataSource != null;
    1922
     
    2124        return tags.getValue("surface");
    2225
    23     };
     26    }
    2427
     28    @Override
    2529    public boolean isUsable(Object propertyValue, AccessParameters accessParameters) {
    2630        assert propertyValue instanceof String;
    2731
    28         String surface = (String)propertyValue;
     32        String surface = (String) propertyValue;
    2933
    3034        Collection<String> surfaceBlacklist =
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/property/RoadTracktype.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.property;
    23
     
    78public class RoadTracktype implements RoadPropertyType<Integer> {
    89
     10    @Override
    911    public <N, W, R, M> Integer evaluateN(N node, AccessParameters accessParameters,
    10             DataSource<N,W,R,M> dataSource) {
     12            DataSource<N, W, R, M> dataSource) {
    1113        return null;
    12     };
     14    }
    1315
     16    @Override
    1417    public <N, W, R, M> Integer evaluateW(W way, boolean forward, AccessParameters accessParameters,
    15             DataSource<N,W,R,M> dataSource) {
     18            DataSource<N, W, R, M> dataSource) {
    1619        assert way != null && accessParameters != null && dataSource != null;
    1720
     
    3437
    3538        return null;
    36     };
     39    }
    3740
     41    @Override
    3842    public boolean isUsable(Object propertyValue, AccessParameters accessParameters) {
    3943        assert propertyValue instanceof Integer;
    4044
    41         int tracktype = (Integer)propertyValue;
     45        int tracktype = (Integer) propertyValue;
    4246
    4347        Integer maxTracktype =
     
    5054        }
    5155    }
    52 
    5356}
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/property/RoadValueLimit.java

    r26174 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.property;
    23
     
    910 * abstract superclass for road property types that define a limit for a vehicle property
    1011 */
    11 abstract public class RoadValueLimit implements RoadPropertyType<Float> {
     12public abstract class RoadValueLimit implements RoadPropertyType<Float> {
    1213
    13     protected static enum LimitType {MINIMUM, MAXIMUM};
     14    protected enum LimitType { MINIMUM, MAXIMUM }
    1415
    1516    private final String keyName;
     
    3637    protected abstract Float parse(String valueString);
    3738
     39    @Override
    3840    public <N, W, R, M> Float evaluateW(W way, boolean forward,
    3941            AccessParameters accessParameters, DataSource<N, W, R, M> dataSource) {
     
    4244    }
    4345
     46    @Override
    4447    public <N, W, R, M> Float evaluateN(N node,
    4548            AccessParameters accessParameters, DataSource<N, W, R, M> dataSource) {
     
    4851    }
    4952
    50     private final Float evaluateTags(TagGroup tags) {
     53    private Float evaluateTags(TagGroup tags) {
    5154        String valueString = tags.getValue(keyName);
    5255        if (valueString != null) {
     
    5861    }
    5962
     63    @Override
    6064    public boolean isUsable(Object propertyValue, AccessParameters accessParameters) {
    6165        assert propertyValue instanceof Float;
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/property/RoadWidth.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.property;
    23
     
    910        super("width", WIDTH, LimitType.MAXIMUM);
    1011    }
     12
    1113    @Override
    1214    protected Float parse(String valueString) {
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/property/VehiclePropertyType.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.property;
    23
     
    1516     * null is never a valid value and must not be used as parameter.
    1617     */
    17     public boolean isValidValue(Object value);
    18 
     18    boolean isValidValue(Object value);
    1919}
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/property/VehiclePropertyTypes.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.property;
    23
     
    1314
    1415    private static final class NonnegativeFloatProperty implements VehiclePropertyType<Float> {
     16        @Override
    1517        public boolean isValidValue(Object value) {
    16             return value instanceof Float && (Float)value >= 0;
     18            return value instanceof Float && (Float) value >= 0;
    1719        }
    1820    }
     
    4446    /** surface types ("surface" key values) the vehicle cannot use */
    4547    public static final VehiclePropertyType<Collection<String>> SURFACE_BLACKLIST = new VehiclePropertyType<Collection<String>>() {
     48        @Override
    4649        public boolean isValidValue(Object value) {
    4750
     
    5053            }
    5154
    52             for (Object contentObject : (Collection<?>)value) {
     55            for (Object contentObject : (Collection<?>) value) {
    5356                if (!(contentObject instanceof String)) {
    5457                    return false;
     
    6669     */
    6770    public static final VehiclePropertyType<Integer> MAX_TRACKTYPE = new VehiclePropertyType<Integer>() {
     71        @Override
    6872        public boolean isValidValue(Object value) {
    69             return value instanceof Integer && (Integer)value >= 0 && (Integer)value <= 5;
     73            return value instanceof Integer && (Integer) value >= 0 && (Integer) value <= 5;
    7074        }
    7175    };
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/transition/GenericTransitionStructure.java

    r30737 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.transition;
    23
     
    4142        private final List<Segment> outboundSegments = new LinkedList<>();
    4243        private final Map<RoadPropertyType<?>, Object> properties;
    43         public SegmentNodeImpl(double lat, double lon, Map<RoadPropertyType<?>, Object> properties) {
     44
     45        SegmentNodeImpl(double lat, double lon, Map<RoadPropertyType<?>, Object> properties) {
    4446            assert properties != null;
    4547            this.lat = lat;
     
    4749            this.properties = properties;
    4850        }
     51
     52        @Override
    4953        public double getLat() {
    5054            return lat;
    5155        }
     56
     57        @Override
    5258        public double getLon() {
    5359            return lon;
    5460        }
     61
    5562        public void addInboundSegment(Segment segment) {
    5663            inboundSegments.add(segment);
    5764        }
     65
    5866        public void addOutboundSegment(Segment segment) {
    5967            outboundSegments.add(segment);
    6068        }
     69
     70        @Override
    6171        public Collection<Segment> getOutboundSegments() {
    6272            return outboundSegments;
    6373        }
     74
     75        @Override
    6476        public Collection<Segment> getInboundSegments() {
    6577            return inboundSegments;
     
    6981            properties.put(property, value);
    7082        }*/
     83        @Override
    7184        public Collection<RoadPropertyType<?>> getAvailableProperties() {
    7285            return properties.keySet();
    7386        }
     87
     88        @Override
    7489        public <P> P getPropertyValue(RoadPropertyType<P> property) {
    7590            @SuppressWarnings("unchecked") //cast is safe due to type parameter of setProperty
     
    7792            return result;
    7893        }
     94
    7995        public Map<RoadPropertyType<?>, Object> getProperties() {
    8096            return properties;
     
    91107        private final SegmentNode node2;
    92108        private final Map<RoadPropertyType<?>, Object> properties;
    93         public SegmentImpl(SegmentNode node1, SegmentNode node2, Map<RoadPropertyType<?>, Object> properties) {
     109
     110        SegmentImpl(SegmentNode node1, SegmentNode node2, Map<RoadPropertyType<?>, Object> properties) {
    94111            this.node1 = node1;
    95112            this.node2 = node2;
    96113            this.properties = properties;
    97114        }
     115
     116        @Override
    98117        public SegmentNode getNode1() {
    99118            return node1;
    100119        }
     120
     121        @Override
    101122        public SegmentNode getNode2() {
    102123            return node2;
    103124        }
     125
    104126        /*public <P> void setProperty(RoadPropertyType<P> property, P value) {
    105127            properties.put(property, value);
    106128        }*/
     129
     130        @Override
    107131        public Collection<RoadPropertyType<?>> getAvailableProperties() {
    108132            return properties.keySet();
    109133        }
     134
     135        @Override
    110136        public <P> P getPropertyValue(RoadPropertyType<P> property) {
    111137            @SuppressWarnings("unchecked") //cast is safe due to type parameter of setProperty
     
    126152
    127153        /** constructor, will directly use collection references, collections must not be changed after usage as constructor param */
    128         public RestrictionImpl(Segment from, Collection<Segment> vias, Collection<Segment> tos) {
     154        RestrictionImpl(Segment from, Collection<Segment> vias, Collection<Segment> tos) {
    129155            this.from = from;
    130156            this.vias = Collections.unmodifiableCollection(vias);
     
    132158        }
    133159
     160        @Override
    134161        public Segment getFrom() {
    135162            return from;
    136163        }
     164
     165        @Override
    137166        public Collection<Segment> getVias() {
    138167            return vias;
    139168        }
     169
     170        @Override
    140171        public Collection<Segment> getTos() {
    141172            return tos;
     
    213244    }
    214245
     246    @Override
    215247    public Collection<SegmentNode> getNodes() {
    216248        return nodes;
    217249    }
    218250
     251    @Override
    219252    public Collection<Segment> getSegments() {
    220253        return segments;
    221254    }
    222255
     256    @Override
    223257    public Collection<Restriction> getRestrictions() {
    224258        return restrictions;
     
    278312            Map<N, SegmentNodeImpl> nodeCreationMap, Map<W, List<Segment>> waySegmentMap) {
    279313
    280         assert way != null && wayAccessEvaluator != null && nodes != null && segments != null && nodeCreationMap != null && waySegmentMap != null;
     314        assert way != null && wayAccessEvaluator != null && nodes != null
     315                && segments != null && nodeCreationMap != null && waySegmentMap != null;
    281316
    282317        /* calculate property values */
     
    379414
    380415            if ("restriction".equals(tags.getValue("type"))
    381                     && tags.getValue("restriction") != null ) {
     416                    && tags.getValue("restriction") != null) {
    382417
    383418                //evaluate relation
     
    415450                    return EMPTY_RESTRICTION_COLLECTION;
    416451                } else {
    417                     fromWay = (W)dataSource.getMember(member);
     452                    fromWay = (W) dataSource.getMember(member);
    418453                }
    419454            } else if ("to".equals(dataSource.getRole(member))) {
     
    422457                    return EMPTY_RESTRICTION_COLLECTION;
    423458                } else {
    424                     toWays.add((W)dataSource.getMember(member));
     459                    toWays.add((W) dataSource.getMember(member));
    425460                }
    426461            } else if ("via".equals(dataSource.getRole(member))) {
    427462                if (dataSource.isWMember(member)) {
    428                     viaWays.add((W)dataSource.getMember(member));
     463                    viaWays.add((W) dataSource.getMember(member));
    429464                } else if (dataSource.isNMember(member)) {
    430                     viaNodes.add((N)dataSource.getMember(member));
     465                    viaNodes.add((N) dataSource.getMember(member));
    431466                }
    432467            }
     
    671706    }
    672707
     708    @Override
    673709    public void update(DataSource<?, ?, ?, ?> dataSource) {
    674710        assert this.dataSource == dataSource;
     
    676712    }
    677713
     714    @Override
    678715    public void addObserver(TransitionStructureObserver observer) {
    679716        observers.add(observer);
    680717    }
    681718
     719    @Override
    682720    public void deleteObserver(TransitionStructureObserver observer) {
    683721        observers.remove(observer);
     
    689727        }
    690728    }
    691 
    692729}
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/transition/Restriction.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.transition;
    23
     
    1415     * != null
    1516     */
    16     public Segment getFrom();
     17    Segment getFrom();
    1718
    1819    /**
     
    2223     * @return  unmodifiable collection of segments; != null
    2324     */
    24     public Collection<Segment> getVias();
     25    Collection<Segment> getVias();
    2526
    2627    /**
     
    3031     * @return  unmodifiable collection of segments; != null
    3132     */
    32     public Collection<Segment> getTos();
    33 
     33    Collection<Segment> getTos();
    3434}
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/transition/Segment.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.transition;
    23
     
    910     * returns the node this segment starts at; != null
    1011     */
    11     public SegmentNode getNode1();
     12    SegmentNode getNode1();
    1213
    1314    /**
    1415     * returns the node this segment leads to; != null
    1516     */
    16     public SegmentNode getNode2();
    17 
     17    SegmentNode getNode2();
    1818}
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/transition/SegmentNode.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.transition;
    23
     
    910
    1011    /** returns the node's latitude */
    11     public double getLat();
     12    double getLat();
    1213
    1314    /** returns the node's longitude */
    14     public double getLon();
     15    double getLon();
    1516
    1617    /** returns all segments that end at this node */
     
    1920    /** returns all segments that start at this node */
    2021    Collection<Segment> getOutboundSegments();
    21 
    2222}
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/transition/TransitionStructure.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.transition;
    23
     
    910public interface TransitionStructure {
    1011
    11     public Collection<SegmentNode> getNodes();
    12     public Collection<Segment> getSegments();
    13     public Collection<Restriction> getRestrictions();
     12    Collection<SegmentNode> getNodes();
     13
     14    Collection<Segment> getSegments();
     15
     16    Collection<Restriction> getRestrictions();
    1417
    1518    /**
     
    1922     * @param observer  observer object, != null
    2023     */
    21     public void addObserver(TransitionStructureObserver observer);
     24    void addObserver(TransitionStructureObserver observer);
    2225
    2326    /**
     
    2730     * @param observer  observer object, != null
    2831     */
    29     public void deleteObserver(TransitionStructureObserver observer);
     32    void deleteObserver(TransitionStructureObserver observer);
    3033
    3134}
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/transition/TransitionStructureElement.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.transition;
    23
     
    1516     * @return  property type collection; != null
    1617     */
    17     public Collection<RoadPropertyType<?>> getAvailableProperties();
     18    Collection<RoadPropertyType<?>> getAvailableProperties();
    1819
    1920    /**
     
    2324     * @return property      value of the property for this segment; null if not available
    2425     */
    25     public <P> P getPropertyValue(RoadPropertyType<P> propertyType);
    26 
     26    <P> P getPropertyValue(RoadPropertyType<P> propertyType);
    2727}
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/transition/TransitionStructureObserver.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.transition;
    23
     
    1112     * @param transitionStructure  observed transition structure that has changed; != null
    1213     */
    13     public void update(TransitionStructure transitionStructure);
    14 
     14    void update(TransitionStructure transitionStructure);
    1515}
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/util/GraphUtil.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.util;
    23
     
    1819     * (a node whose {@link SegmentNode} is connected to at most one other {@link SegmentNode})
    1920     */
    20     public static final boolean isEndNode(GraphNode node) {
     21    public static boolean isEndNode(GraphNode node) {
    2122
    2223        SegmentNode ownSegmentNode = node.getSegmentNode();
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/util/TagCondition.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.util;
    23
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/util/TagConditionLogic.java

    r26174 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.util;
    23
     
    2425        assert tag != null;
    2526        return new TagCondition() {
     27            @Override
    2628            public boolean matches(TagGroup tags) {
    2729                return tags.contains(tag);
    2830            }
     31
    2932            @Override
    3033            public String toString() {
     
    4245        assert key != null;
    4346        return new TagCondition() {
     47            @Override
    4448            public boolean matches(TagGroup tags) {
    4549                return tags.containsKey(key);
    4650            }
     51
    4752            @Override
    4853            public String toString() {
     
    6065    public static TagCondition and(final TagCondition condition, final TagCondition... conditions) {
    6166        return new TagCondition() {
     67            @Override
    6268            public boolean matches(TagGroup tags) {
    6369                for (TagCondition c : conditions) {
     
    6874                return condition.matches(tags);
    6975            }
     76
    7077            @Override
    7178            public String toString() {
     
    93100        }
    94101        return new TagCondition() {
     102            @Override
    95103            public boolean matches(TagGroup tags) {
    96104                for (TagCondition c : conditions) {
     
    101109                return true;
    102110            }
     111
    103112            @Override
    104113            public String toString() {
     
    127136    public static TagCondition or(final TagCondition condition, final TagCondition... conditions) {
    128137        return new TagCondition() {
     138            @Override
    129139            public boolean matches(TagGroup tags) {
    130140                for (TagCondition c : conditions) {
     
    135145                return condition.matches(tags);
    136146            }
     147
    137148            @Override
    138149            public String toString() {
     
    160171        }
    161172        return new TagCondition() {
     173            @Override
    162174            public boolean matches(TagGroup tags) {
    163175                for (TagCondition c : conditions) {
     
    168180                return false;
    169181            }
     182
    170183            @Override
    171184            public String toString() {
     
    193206    public static TagCondition not(final TagCondition condition) {
    194207        return new TagCondition() {
     208            @Override
    195209            public boolean matches(TagGroup tags) {
    196210                return !condition.matches(tags);
    197211            }
     212
    198213            @Override
    199214            public String toString() {
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/util/ValueStringParser.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.util;
    23
     
    45import java.util.regex.Pattern;
    56
     7import org.openstreetmap.josm.Main;
     8
    69public final class ValueStringParser {
    710
     
    1215    private static final Pattern DEC_POINT_PATTERN = Pattern.compile("^(\\-?\\d+)\\.(\\d+)$");
    1316
    14     public static final Float parseOsmDecimal(String value, boolean allowNegative) {
     17    public static Float parseOsmDecimal(String value, boolean allowNegative) {
    1518
    1619        /* positive integer */
     
    2023            int weight = Integer.parseInt(value);
    2124            if (weight >= 0 || allowNegative) {
    22                 return (float)weight;
    23             }
    24 
    25         } catch (NumberFormatException nfe) {}
     25                return (float) weight;
     26            }
     27
     28        } catch (NumberFormatException nfe) {
     29            Main.trace(nfe);
     30        }
    2631
    2732        /* positive number with decimal point */
     
    4651
    4752                    if (result >= 0 || allowNegative) {
    48                         return (float)result;
     53                        return (float) result;
    4954                    }
    5055
    51                 } catch (NumberFormatException nfe) {}
    52 
     56                } catch (NumberFormatException nfe) {
     57                    Main.trace(nfe);
     58                }
    5359            }
    5460        }
     
    6773     * @return  speed in km/h; null if value had syntax errors
    6874     */
    69     public static final Float parseSpeed(String value) {
     75    public static Float parseSpeed(String value) {
    7076
    7177        /* try numeric speed (implied km/h) */
     
    8288            String kmhString = kmhMatcher.group(1);
    8389            try {
    84                 return (float)Integer.parseInt(kmhString);
    85             } catch (NumberFormatException nfe) {}
     90                return (float) Integer.parseInt(kmhString);
     91            } catch (NumberFormatException nfe) {
     92                Main.trace(nfe);
     93            }
    8694        }
    8795
     
    94102                int mph = Integer.parseInt(mphString);
    95103                return KM_PER_MILE * mph;
    96             } catch (NumberFormatException nfe) {}
     104            } catch (NumberFormatException nfe) {
     105                Main.trace(nfe);
     106            }
    97107        }
    98108
     
    115125     * @return  measure in m; null if value had syntax errors
    116126     */
    117     public static final Float parseMeasure(String value) {
     127    public static Float parseMeasure(String value) {
    118128
    119129        /* try numeric measure (implied m) */
     
    147157            String miString = miMatcher.group(1);
    148158            float mi = parseOsmDecimal(miString, false);
    149             return (float)(M_PER_MI * mi);
     159            return (float) (M_PER_MI * mi);
    150160        }
    151161
     
    160170                int inches = Integer.parseInt(inchesString);
    161171                if (feet >= 0 && inches >= 0 && inches < 12) {
    162                     return (float)(M_PER_INCH * (12 * feet + inches));
     172                    return (float) (M_PER_INCH * (12 * feet + inches));
    163173                }
    164             } catch (NumberFormatException nfe) {}
     174            } catch (NumberFormatException nfe) {
     175                Main.trace(nfe);
     176            }
    165177        }
    166178
     
    207219     * @return  incline in percents; null if value had syntax errors
    208220     */
    209     public static final Float parseIncline(String value) {
     221    public static Float parseIncline(String value) {
    210222
    211223        Matcher inclineMatcher = INCLINE_PATTERN.matcher(value);
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/visualisation/ColorScheme.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.visualisation;
    23
     
    1516     * @param edge  GraphNode to determine the color for; != null
    1617     */
    17     public Color getNodeColor(GraphNode node);
     18    Color getNodeColor(GraphNode node);
    1819
    1920    /**
     
    2122     * @param segment  segment to determine the color for; != null
    2223     */
    23     public Color getSegmentColor(Segment segment);
    24 
     24    Color getSegmentColor(Segment segment);
    2525}
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/visualisation/DefaultNodePositioner.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.visualisation;
    23
     
    1112public class DefaultNodePositioner implements NodePositioner {
    1213
     14    @Override
    1315    public LatLonCoords getPosition(GraphNode node) {
    1416
     
    1618
    1719        if (2 >= segmentNode.getInboundSegments().size()
    18                 + segmentNode.getOutboundSegments().size() ) {
     20                + segmentNode.getOutboundSegments().size()) {
    1921
    2022            return new LatLonCoords(
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/visualisation/EndNodeColorScheme.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.visualisation;
    23
     
    2223    }
    2324
     25    @Override
    2426    public Color getNodeColor(GraphNode node) {
    2527        return GraphUtil.isEndNode(node) ? endNodeColor : nodeColor;
    2628    }
    2729
     30    @Override
    2831    public Color getSegmentColor(Segment segment) {
    2932        return segmentColor;
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/visualisation/FloatPropertyColorScheme.java

    r30737 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.visualisation;
    23
     
    4243    }
    4344
     45    @Override
    4446    public Color getSegmentColor(Segment segment) {
    4547        assert segment != null;
     
    5052            if (propertyClass.isInstance(property)) {
    5153                @SuppressWarnings("unchecked") //has been checked using isInstance
    52                 RoadPropertyType<Float> floatProperty = (RoadPropertyType<Float>)property;
     54                RoadPropertyType<Float> floatProperty = (RoadPropertyType<Float>) property;
    5355                propertyValue = segment.getPropertyValue(floatProperty);
    5456                break;
     
    6365    }
    6466
     67    @Override
    6568    public Color getNodeColor(GraphNode node) {
    6669
    6770        List<Color> segmentColors = new ArrayList<>();
    68 
    69 
    7071
    7172        for (GraphEdge edge : node.getInboundEdges()) {
     
    158159        float weightPerColor = 1.0f / colors.size();
    159160
    160         Color average = new Color(0,0,0);
     161        Color average = new Color(0, 0, 0);
    161162
    162163        for (Color color : colors) {
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/visualisation/InclineColorScheme.java

    r30737 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.visualisation;
    23
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/visualisation/LatLonCoords.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.visualisation;
    23
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/visualisation/MaxheightColorScheme.java

    r30737 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.visualisation;
    23
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/visualisation/MaxspeedColorScheme.java

    r30737 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.visualisation;
    23
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/visualisation/MaxweightColorScheme.java

    r30737 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.visualisation;
    23
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/visualisation/NodePositioner.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.visualisation;
    23
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/visualisation/NonMovingNodePositioner.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.visualisation;
    23
     
    56public class NonMovingNodePositioner implements NodePositioner {
    67
     8    @Override
    79    public LatLonCoords getPosition(GraphNode node) {
    810        return new LatLonCoords(
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/core/visualisation/SingleColorScheme.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.visualisation;
    23
     
    2021    }
    2122
     23    @Override
    2224    public Color getNodeColor(GraphNode node) {
    2325        return nodeColor;
    2426    }
    2527
     28    @Override
    2629    public Color getSegmentColor(Segment segment) {
    2730        return segmentColor;
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/GraphViewPlugin.java

    r32344 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.plugin;
    23
     
    175176     * @return ruleset read from a source as specified by preferences, null if the preferences
    176177     *         don't specify a ruleset source
    177      * @throws AccessRulesetSyntaxException
    178      * @throws IOException
    179      * @throws FileNotFoundException
    180178     */
    181179    private AccessRuleset getAccessRuleset()
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/data/JOSMDataSource.java

    r32344 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.plugin.data;
    23
     
    2627public class JOSMDataSource implements DataSource<Node, Way, Relation, RelationMember> {
    2728
     29    @Override
    2830    public double getLat(Node node) {
    2931        return node.getCoor().lat();
    3032    }
    3133
     34    @Override
    3235    public double getLon(Node node) {
    3336        return node.getCoor().lon();
    3437    }
    3538
     39    @Override
    3640    public Iterable<RelationMember> getMembers(Relation relation) {
    3741        return relation.getMembers();
    3842    }
    3943
     44    @Override
    4045    public Iterable<Node> getNodes(Way way) {
    4146        return new FilteredOsmPrimitiveIterable<>(way.getNodes());
    4247    }
    4348
     49    @Override
    4450    public Iterable<Node> getNodes() {
    4551        return new FilteredOsmPrimitiveIterable<>(Main.getLayerManager().getEditDataSet().getNodes());
    4652    }
    4753
     54    @Override
    4855    public Iterable<Relation> getRelations() {
    4956        return new FilteredRelationIterable(Main.getLayerManager().getEditDataSet().getRelations());
    5057    }
    5158
     59    @Override
    5260    public Iterable<Way> getWays() {
    5361        return new FilteredOsmPrimitiveIterable<>(Main.getLayerManager().getEditDataSet().getWays());
    5462    }
    5563
     64    @Override
    5665    public TagGroup getTagsN(Node node) {
    5766        return getTags(node);
    5867    }
    5968
     69    @Override
    6070    public TagGroup getTagsW(Way way) {
    6171        return getTags(way);
    6272    }
    6373
     74    @Override
    6475    public TagGroup getTagsR(Relation relation) {
    6576        return getTags(relation);
     
    7485    }
    7586
     87    @Override
    7688    public Object getMember(RelationMember member) {
    7789        return member.getMember();
    7890    }
    7991
     92    @Override
    8093    public String getRole(RelationMember member) {
    8194        return member.getRole();
    8295    }
    8396
     97    @Override
    8498    public boolean isNMember(RelationMember member) {
    8599        return member.getMember() instanceof Node;
    86100    }
    87101
     102    @Override
    88103    public boolean isWMember(RelationMember member) {
    89104        return member.getMember() instanceof Way;
    90105    }
    91106
     107    @Override
    92108    public boolean isRMember(RelationMember member) {
    93109        return member.getMember() instanceof Relation;
     
    116132
    117133        /** returns an iterator. The iterator does not support {@link Iterator#remove()}. */
     134        @Override
    118135        public Iterator<P> iterator() {
    119136            return new FilteredIterator(originalIterable.iterator());
     
    126143            private P next;
    127144
    128             public FilteredIterator(Iterator<P> originalIterator) {
     145            FilteredIterator(Iterator<P> originalIterator) {
    129146                this.originalIterator = originalIterator;
    130147                updateNext();
    131148            }
    132149
     150            @Override
    133151            public boolean hasNext() {
    134152                return next != null;
    135153            }
    136154
     155            @Override
    137156            public P next() {
    138157                if (next != null) {
     
    145164            }
    146165
     166            @Override
    147167            public void remove() {
    148168                throw new UnsupportedOperationException();
     
    192212        private final String role;
    193213        private final Object member;
    194         public RelationMemberImpl(org.openstreetmap.josm.data.osm.RelationMember originalMember) {
     214
     215        RelationMemberImpl(org.openstreetmap.josm.data.osm.RelationMember originalMember) {
    195216            this.role = originalMember.getRole();
    196217            this.member = originalMember.getMember();
    197218        }
     219
    198220        public String getRole() {
    199221            return role;
    200222        }
     223
    201224        public Object getMember() {
    202225            return member;
     
    206229    private final Set<DataSourceObserver> observers = new HashSet<>();
    207230
     231    @Override
    208232    public void addObserver(DataSourceObserver observer) {
    209233        observers.add(observer);
    210234    }
    211235
     236    @Override
    212237    public void deleteObserver(DataSourceObserver observer) {
    213238        observers.remove(observer);
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/data/JOSMTransitionStructure.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.plugin.data;
    23
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/dialogs/AccessParameterDialog.java

    r30737 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.plugin.dialogs;
    23
     
    3940public class AccessParameterDialog extends JDialog {
    4041
    41     public static interface BookmarkAction {
    42         public void execute(String name, PreferenceAccessParameters parameters);
     42    public interface BookmarkAction {
     43        void execute(String name, PreferenceAccessParameters parameters);
    4344    }
    4445
     
    6667        private final JTextField bookmarkNameTextField;
    6768
    68         public BookmarkNamePanel(String initialName) {
     69        BookmarkNamePanel(String initialName) {
    6970            super();
    7071            this.setBorder(BorderFactory.createTitledBorder(tr("Bookmark name")));
     
    101102        private final JTextField accessClassTextField;
    102103
    103         public AccessClassPanel(PreferenceAccessParameters initialParameters) {
     104        AccessClassPanel(PreferenceAccessParameters initialParameters) {
    104105            super();
    105106            this.setBorder(BorderFactory.createTitledBorder(tr("Access class")));
     
    134135            new EnumMap<>(AccessType.class);
    135136
    136         public AccessTypesPanel(PreferenceAccessParameters initialParameters) {
     137        AccessTypesPanel(PreferenceAccessParameters initialParameters) {
    137138            super();
    138139            this.setBorder(BorderFactory.createTitledBorder(tr("Access types")));
     
    171172            new HashMap<>();
    172173
    173         public VehiclePropertiesPanel(PreferenceAccessParameters initialParameters) {
     174        VehiclePropertiesPanel(PreferenceAccessParameters initialParameters) {
    174175            super();
    175176            this.setBorder(BorderFactory.createTitledBorder(tr("Vehicle properties")));
     
    220221        private JTextField tracktypeTextField;
    221222
    222         public RoadQualityPanel(PreferenceAccessParameters initialParameters) {
    223             super();
     223        RoadQualityPanel(PreferenceAccessParameters initialParameters) {
    224224            this.setBorder(BorderFactory.createTitledBorder(tr("Road requirements")));
    225 
    226225
    227226            this.setLayout(new GridLayout(4, 2));
     
    338337    private class OkCancelPanel extends JPanel {
    339338
    340         public OkCancelPanel() {
     339        OkCancelPanel() {
    341340
    342341            new BoxLayout(this, BoxLayout.X_AXIS);
    343342
    344             JButton okButton = new JButton(existingBookmark?tr("Change bookmark"):tr("Create bookmark"));
     343            JButton okButton = new JButton(existingBookmark ? tr("Change bookmark") : tr("Create bookmark"));
    345344            okButton.addActionListener(new ActionListener() {
     345                @Override
    346346                public void actionPerformed(ActionEvent e) {
    347347                    String bookmarkName = bookmarkNamePanel.getBookmarkName();
     
    359359            JButton cancelButton = new JButton(tr("Cancel"));
    360360            cancelButton.addActionListener(new ActionListener() {
     361                @Override
    361362                public void actionPerformed(ActionEvent e) {
    362363                    AccessParameterDialog.this.dispose();
     
    364365            });
    365366            this.add(cancelButton);
    366 
    367         }
    368 
     367        }
    369368    }
    370369
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/dialogs/GraphViewDialog.java

    r30737 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.plugin.dialogs;
    23
     
    2728import javax.swing.JPanel;
    2829
     30import org.openstreetmap.josm.Main;
    2931import org.openstreetmap.josm.gui.SideButton;
    3032import org.openstreetmap.josm.gui.dialogs.ToggleDialog;
     
    6870
    6971        super(tr("Graph View Dialog"), "graphview",
    70                 tr("Open the dialog for graph view configuration."), (Shortcut)null, HEIGHT);
     72                tr("Open the dialog for graph view configuration."), (Shortcut) null, HEIGHT);
    7173
    7274        this.preferences = GraphViewPreferences.getInstance();
     
    154156        createLayout(selectionPanel, true, Arrays.asList(new SideButton[] {
    155157            new SideButton(new AbstractAction(tr("Create/update graph")) {
     158                @Override
    156159                public void actionPerformed(ActionEvent e) {
    157160                    plugin.createGraphViewLayer();
     
    165168
    166169    private final ActionListener rulesetActionListener = new ActionListener() {
     170        @Override
    167171        public void actionPerformed(ActionEvent e) {
    168172            if (rulesetComboBox.getSelectedItem() != null) {
     
    186190
    187191    private final ActionListener bookmarkActionListener = new ActionListener() {
     192        @Override
    188193        public void actionPerformed(ActionEvent e) {
    189             String selectedBookmarkName = (String)bookmarkComboBox.getSelectedItem();
     194            String selectedBookmarkName = (String) bookmarkComboBox.getSelectedItem();
    190195            if (selectedBookmarkName != null) {
    191196                preferences.setCurrentParameterBookmarkName(selectedBookmarkName);
     
    197202
    198203    private final ActionListener colorSchemeActionListener = new ActionListener() {
     204        @Override
    199205        public void actionPerformed(ActionEvent e) {
    200206            assert availableColorSchemes.containsKey(colorSchemeComboBox.getSelectedItem());
    201             String colorSchemeLabel = (String)colorSchemeComboBox.getSelectedItem();
     207            String colorSchemeLabel = (String) colorSchemeComboBox.getSelectedItem();
    202208            preferences.setCurrentColorScheme(availableColorSchemes.get(colorSchemeLabel));
    203209            preferences.distributeChanges();
     
    206212    };
    207213
     214    @Override
    208215    public void update(Observable observable, Object param) {
    209216        if (observable == preferences) {
     
    223230
    224231            rulesetComboBox.removeAllItems();
    225             for (int i=0; i < InternalRuleset.values().length; i++) {
     232            for (int i = 0; i < InternalRuleset.values().length; i++) {
    226233                InternalRuleset ruleset = InternalRuleset.values()[i];
    227234                rulesetComboBox.addItem(ruleset.toString());
     
    249256                    } catch (IOException ioe) {
    250257                        //don't add to rulesetFiles
     258                        Main.debug(ioe);
    251259                    }
    252260                }
     
    256264
    257265            rulesetComboBox.removeAllItems();
    258             for (int i=0; i < rulesetFiles.size(); i++) {
     266            for (int i = 0; i < rulesetFiles.size(); i++) {
    259267                File rulesetFile = rulesetFiles.get(i);
    260268                rulesetComboBox.addItem(rulesetFile.getName());
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/dialogs/GraphViewPreferenceEditor.java

    r30737 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.plugin.dialogs;
    23
     
    7677    }
    7778
     79    @Override
    7880    public void addGui(PreferenceTabbedPane gui) {
    7981
     
    203205    private JPanel createVisualizationPanel() {
    204206
    205         JPanel visualizationPanel = new JPanel();
    206         visualizationPanel.setBorder(BorderFactory.createTitledBorder(tr("Visualization")));
    207         visualizationPanel.setLayout(new BoxLayout(visualizationPanel, BoxLayout.Y_AXIS));
    208 
    209         separateDirectionsCheckBox = new JCheckBox(tr("Draw directions separately"));
    210         separateDirectionsCheckBox.setSelected(GraphViewPreferences.getInstance().getSeparateDirections());
    211         visualizationPanel.add(separateDirectionsCheckBox);
    212 
    213         { // create color chooser panel
    214 
    215                 JPanel colorPanel = new JPanel();
    216                 colorPanel.setLayout(new GridLayout(3, 2));
    217 
    218                 Color nodeColor = GraphViewPreferences.getInstance().getNodeColor();
    219 
    220                 nodeColorButton = new JButton(tr("Node color"));
    221                 nodeColorButton.addActionListener(chooseNodeColorActionListener);
    222                 colorPanel.add(nodeColorButton);
    223                 nodeColorField = new JPanel();
    224                 nodeColorField.setBackground(nodeColor);
    225                 colorPanel.add(nodeColorField);
    226 
    227                 Color segmentColor = GraphViewPreferences.getInstance().getSegmentColor();
    228 
    229                 segmentColorButton = new JButton(tr("Arrow color"));
    230                 segmentColorButton.addActionListener(chooseSegmentColorActionListener);
    231                 colorPanel.add(segmentColorButton);
    232                 segmentColorField = new JPanel();
    233                 segmentColorField.setBackground(segmentColor);
    234                 colorPanel.add(segmentColorField);
    235 
    236                 Color arrowheadFillColor = GraphViewPreferences.getInstance().getArrowheadFillColor();
    237 
    238                 arrowheadFillColorButton = new JButton(tr("Arrowhead fill color"));
    239                 arrowheadFillColorButton.addActionListener(chooseArrowheadFillColorActionListener);
    240                 colorPanel.add(arrowheadFillColorButton);
    241                 arrowheadFillColorField = new JPanel();
    242                 arrowheadFillColorField.setBackground(arrowheadFillColor);
    243                 colorPanel.add(arrowheadFillColorField);
    244 
    245                 visualizationPanel.add(colorPanel);
    246 
    247         }
    248 
    249         arrowheadPlacementSlider = new JSlider(0, 100);
    250         arrowheadPlacementSlider.setToolTipText(tr("Arrowhead placement"));
    251         arrowheadPlacementSlider.setMajorTickSpacing(10);
    252         arrowheadPlacementSlider.setPaintTicks(true);
    253         arrowheadPlacementSlider.setName("name");
    254         arrowheadPlacementSlider.setLabelTable(null);
    255         arrowheadPlacementSlider.setValue((int)Math.round(
    256                         100 * GraphViewPreferences.getInstance().getArrowheadPlacement()));
    257         arrowheadPlacementSlider.addChangeListener(arrowheadPlacementChangeListener);
    258         visualizationPanel.add(arrowheadPlacementSlider);
    259 
    260         arrowPreviewPanel = new ArrowPreviewPanel();
    261         visualizationPanel.add(arrowPreviewPanel);
    262 
    263         return visualizationPanel;
    264     }
    265 
     207        JPanel visualizationPanel = new JPanel();
     208        visualizationPanel.setBorder(BorderFactory.createTitledBorder(tr("Visualization")));
     209        visualizationPanel.setLayout(new BoxLayout(visualizationPanel, BoxLayout.Y_AXIS));
     210
     211        separateDirectionsCheckBox = new JCheckBox(tr("Draw directions separately"));
     212        separateDirectionsCheckBox.setSelected(GraphViewPreferences.getInstance().getSeparateDirections());
     213        visualizationPanel.add(separateDirectionsCheckBox);
     214
     215        { // create color chooser panel
     216
     217            JPanel colorPanel = new JPanel();
     218            colorPanel.setLayout(new GridLayout(3, 2));
     219
     220            Color nodeColor = GraphViewPreferences.getInstance().getNodeColor();
     221
     222            nodeColorButton = new JButton(tr("Node color"));
     223            nodeColorButton.addActionListener(chooseNodeColorActionListener);
     224            colorPanel.add(nodeColorButton);
     225            nodeColorField = new JPanel();
     226            nodeColorField.setBackground(nodeColor);
     227            colorPanel.add(nodeColorField);
     228
     229            Color segmentColor = GraphViewPreferences.getInstance().getSegmentColor();
     230
     231            segmentColorButton = new JButton(tr("Arrow color"));
     232            segmentColorButton.addActionListener(chooseSegmentColorActionListener);
     233            colorPanel.add(segmentColorButton);
     234            segmentColorField = new JPanel();
     235            segmentColorField.setBackground(segmentColor);
     236            colorPanel.add(segmentColorField);
     237
     238            Color arrowheadFillColor = GraphViewPreferences.getInstance().getArrowheadFillColor();
     239
     240            arrowheadFillColorButton = new JButton(tr("Arrowhead fill color"));
     241            arrowheadFillColorButton.addActionListener(chooseArrowheadFillColorActionListener);
     242            colorPanel.add(arrowheadFillColorButton);
     243            arrowheadFillColorField = new JPanel();
     244            arrowheadFillColorField.setBackground(arrowheadFillColor);
     245            colorPanel.add(arrowheadFillColorField);
     246
     247            visualizationPanel.add(colorPanel);
     248
     249        }
     250
     251        arrowheadPlacementSlider = new JSlider(0, 100);
     252        arrowheadPlacementSlider.setToolTipText(tr("Arrowhead placement"));
     253        arrowheadPlacementSlider.setMajorTickSpacing(10);
     254        arrowheadPlacementSlider.setPaintTicks(true);
     255        arrowheadPlacementSlider.setName("name");
     256        arrowheadPlacementSlider.setLabelTable(null);
     257        arrowheadPlacementSlider.setValue((int) Math.round(
     258                100 * GraphViewPreferences.getInstance().getArrowheadPlacement()));
     259        arrowheadPlacementSlider.addChangeListener(arrowheadPlacementChangeListener);
     260        visualizationPanel.add(arrowheadPlacementSlider);
     261
     262        arrowPreviewPanel = new ArrowPreviewPanel();
     263        visualizationPanel.add(arrowPreviewPanel);
     264
     265        return visualizationPanel;
     266    }
     267
     268    @Override
    266269    public boolean ok() {
    267270
     
    273276        preferences.setParameterBookmarks(parameterBookmarks);
    274277
    275         String selectedBookmarkName = (String)bookmarkComboBox.getSelectedItem();
     278        String selectedBookmarkName = (String) bookmarkComboBox.getSelectedItem();
    276279        preferences.setCurrentParameterBookmarkName(selectedBookmarkName);
    277280
     
    283286
    284287        preferences.setArrowheadPlacement(
    285                         arrowheadPlacementSlider.getValue() / 100f);
     288                arrowheadPlacementSlider.getValue() / 100f);
    286289
    287290        preferences.distributeChanges();
     
    291294
    292295    private final ActionListener internalRulesetActionListener = new ActionListener() {
     296        @Override
    293297        public void actionPerformed(ActionEvent e) {
    294298            updateRulesetPanel();
     
    297301
    298302    private final ActionListener selectRulesetFolderActionListener = new ActionListener() {
     303        @Override
    299304        public void actionPerformed(ActionEvent e) {
    300305
     
    319324
    320325    private final ActionListener createVehicleActionListener = new ActionListener() {
     326        @Override
    321327        public void actionPerformed(ActionEvent e) {
    322328
     
    331337                    defaultBookmarkParameters,
    332338                    new BookmarkAction() {
     339                        @Override
    333340                        public void execute(String name, PreferenceAccessParameters parameters) {
    334341                            parameterBookmarks.put(name, parameters);
     
    342349
    343350    private final ActionListener editVehicleActionListener = new ActionListener() {
     351        @Override
    344352        public void actionPerformed(ActionEvent e) {
    345353            if (bookmarkComboBox.getSelectedItem() != null) {
    346354
    347                 final String selectedBookmarkName = (String)bookmarkComboBox.getSelectedItem();
     355                final String selectedBookmarkName = (String) bookmarkComboBox.getSelectedItem();
    348356                PreferenceAccessParameters parameters =
    349357                    parameterBookmarks.get(selectedBookmarkName);
     
    363371                        parameters,
    364372                        new BookmarkAction() {
     373                            @Override
    365374                            public void execute(String name, PreferenceAccessParameters parameters) {
    366375                                parameterBookmarks.remove(selectedBookmarkName);
     
    372381                apd.setVisible(true);
    373382            }
    374 
    375383        }
    376384    };
    377385
    378386    private final ActionListener deleteVehicleActionListener = new ActionListener() {
     387        @Override
    379388        public void actionPerformed(ActionEvent e) {
    380389            if (bookmarkComboBox.getSelectedItem() != null) {
    381390
    382                 String selectedBookmarkName = (String)bookmarkComboBox.getSelectedItem();
     391                String selectedBookmarkName = (String) bookmarkComboBox.getSelectedItem();
    383392
    384393                int userChoice = JOptionPane.showConfirmDialog(
     
    392401                    updateVehiclePanel(null);
    393402                }
    394 
    395403            }
    396404        }
     
    398406
    399407    private final ActionListener restoreVehicleDefaultsActionListener = new ActionListener() {
     408        @Override
    400409        public void actionPerformed(ActionEvent e) {
    401410
     
    418427
    419428    private final ActionListener chooseNodeColorActionListener = new ActionListener() {
    420         public void actionPerformed(ActionEvent e) {
    421 
    422                 Color selectedColor = JColorChooser.showDialog(
    423                                 preferencePanel, tr("Choose node color"), nodeColorField.getBackground());
    424 
    425                 if (selectedColor != null) {
    426                         nodeColorField.setBackground(selectedColor);
    427                 }
    428 
    429                 arrowPreviewPanel.repaint();
     429        @Override
     430        public void actionPerformed(ActionEvent e) {
     431
     432            Color selectedColor = JColorChooser.showDialog(
     433                    preferencePanel, tr("Choose node color"), nodeColorField.getBackground());
     434
     435            if (selectedColor != null) {
     436                nodeColorField.setBackground(selectedColor);
     437            }
     438
     439            arrowPreviewPanel.repaint();
    430440
    431441        }
     
    433443
    434444    private final ActionListener chooseSegmentColorActionListener = new ActionListener() {
    435         public void actionPerformed(ActionEvent e) {
    436 
    437                 Color selectedColor = JColorChooser.showDialog(
    438                                 preferencePanel, tr("Choose arrow color"), segmentColorField.getBackground());
    439 
    440                 if (selectedColor != null) {
    441                         segmentColorField.setBackground(selectedColor);
    442                 }
    443 
    444                 arrowPreviewPanel.repaint();
     445        @Override
     446        public void actionPerformed(ActionEvent e) {
     447
     448            Color selectedColor = JColorChooser.showDialog(
     449                    preferencePanel, tr("Choose arrow color"), segmentColorField.getBackground());
     450
     451            if (selectedColor != null) {
     452                segmentColorField.setBackground(selectedColor);
     453            }
     454
     455            arrowPreviewPanel.repaint();
    445456
    446457        }
     
    448459
    449460    private final ActionListener chooseArrowheadFillColorActionListener = new ActionListener() {
    450         public void actionPerformed(ActionEvent e) {
    451 
    452                 Color selectedColor = JColorChooser.showDialog(
    453                                 preferencePanel, tr("Choose arrowhead fill color"), segmentColorField.getBackground());
    454 
    455                 if (selectedColor != null) {
    456                         arrowheadFillColorField.setBackground(selectedColor);
    457                 }
    458 
    459                 arrowPreviewPanel.repaint();
     461        @Override
     462        public void actionPerformed(ActionEvent e) {
     463
     464            Color selectedColor = JColorChooser.showDialog(
     465                    preferencePanel, tr("Choose arrowhead fill color"), segmentColorField.getBackground());
     466
     467            if (selectedColor != null) {
     468                arrowheadFillColorField.setBackground(selectedColor);
     469            }
     470
     471            arrowPreviewPanel.repaint();
    460472
    461473        }
     
    463475
    464476    private final ChangeListener arrowheadPlacementChangeListener = new ChangeListener() {
    465         public void stateChanged(ChangeEvent e) {
    466                 arrowPreviewPanel.repaint();
     477        @Override
     478        public void stateChanged(ChangeEvent e) {
     479            arrowPreviewPanel.repaint();
    467480        }
    468481    };
     
    493506        editBookmarkButton.setEnabled(parameterBookmarks.size() > 0);
    494507        deleteBookmarkButton.setEnabled(parameterBookmarks.size() > 0);
    495 
    496508    }
    497509
    498510    private class ArrowPreviewPanel extends JPanel {
    499511
    500         public ArrowPreviewPanel() {
    501                 setPreferredSize(new Dimension(100, 50));
    502                         setBackground(Color.DARK_GRAY);
    503                 }
    504 
    505         @Override
    506         public void paint(Graphics g) {
    507 
    508                 super.paint(g);
    509 
    510                 Graphics2D g2D = (Graphics2D)g;
    511 
    512                 Point p1 = new Point(15, this.getHeight() / 2);
    513                 Point p2 = new Point(this.getWidth()-15, this.getHeight() / 2);
    514 
    515                 g2D.setStroke(new BasicStroke(3, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
    516                 g2D.setColor(segmentColorField.getBackground());
    517                 g2D.draw(new Line2D.Float(p1.x, p1.y, p2.x, p2.y));
    518 
    519                 GraphViewLayer.paintNode(g, p1, nodeColorField.getBackground());
    520                 GraphViewLayer.paintNode(g, p2, nodeColorField.getBackground());
    521 
    522                 GraphViewLayer.paintArrowhead(g2D, p1, p2,
    523                                 arrowheadPlacementSlider.getValue() / 100.0,
    524                                 segmentColorField.getBackground(),
    525                                 arrowheadFillColorField.getBackground());
    526 
    527         }
    528 
    529     }
    530 
     512        ArrowPreviewPanel() {
     513            setPreferredSize(new Dimension(100, 50));
     514            setBackground(Color.DARK_GRAY);
     515        }
     516
     517        @Override
     518        public void paint(Graphics g) {
     519
     520            super.paint(g);
     521
     522            Graphics2D g2D = (Graphics2D) g;
     523
     524            Point p1 = new Point(15, this.getHeight() / 2);
     525            Point p2 = new Point(this.getWidth()-15, this.getHeight() / 2);
     526
     527            g2D.setStroke(new BasicStroke(3, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
     528            g2D.setColor(segmentColorField.getBackground());
     529            g2D.draw(new Line2D.Float(p1.x, p1.y, p2.x, p2.y));
     530
     531            GraphViewLayer.paintNode(g, p1, nodeColorField.getBackground());
     532            GraphViewLayer.paintNode(g, p2, nodeColorField.getBackground());
     533
     534            GraphViewLayer.paintArrowhead(g2D, p1, p2,
     535                    arrowheadPlacementSlider.getValue() / 100.0,
     536                    segmentColorField.getBackground(),
     537                    arrowheadFillColorField.getBackground());
     538        }
     539    }
    531540}
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/layer/GraphViewLayer.java

    r32488 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.plugin.layer;
    23
     
    118119    /** sets the arrowhead placement (relative offset from edge start) */
    119120    public void setArrowheadPlacement(double arrowheadPlacement) {
    120         assert arrowheadPlacement >= 0 && arrowheadPlacement <= 1;
     121        assert arrowheadPlacement >= 0 && arrowheadPlacement <= 1;
    121122        this.arrowheadPlacement = arrowheadPlacement;
    122123        invalidate();
     
    149150    }
    150151
    151         public static void paintNode(final Graphics g, Point p, Color color) {
    152                 g.setColor(color);
     152    public static void paintNode(final Graphics g, Point p, Color color) {
     153        g.setColor(color);
    153154        g.fillOval(p.x - NODE_RADIUS, p.y - NODE_RADIUS, 2 * NODE_RADIUS, 2 * NODE_RADIUS);
    154         }
     155    }
    155156
    156157    private void paintGraphEdge(final GraphEdge e, final Graphics2D g2D, final MapView mv,
    157                 boolean drawLine, boolean drawDirectionIndicator) {
     158            boolean drawLine, boolean drawDirectionIndicator) {
    158159
    159160        if (!CONNECT_ALL_NODE_PAIRS && GraphViewPreferences.getInstance().getSeparateDirections()) {
     
    200201
    201202                if (drawLine) {
    202                         g2D.draw(new Line2D.Float(p1.x, p1.y, p2.x, p2.y));
     203                    g2D.draw(new Line2D.Float(p1.x, p1.y, p2.x, p2.y));
    203204                }
    204205
     
    207208        } else {
    208209
    209                 Color color = GraphViewPreferences.getInstance().getSegmentColor();
     210            Color color = GraphViewPreferences.getInstance().getSegmentColor();
    210211            g2D.setColor(color);
    211212
     
    214215
    215216            if (drawLine) {
    216                 g2D.draw(new Line2D.Float(p1.x, p1.y, p2.x, p2.y));
     217                g2D.draw(new Line2D.Float(p1.x, p1.y, p2.x, p2.y));
    217218            }
    218219
     
    232233            if (drawDirectionIndicator) {
    233234
    234                     paintArrowhead(g2D, p1, p2, arrowheadPlacement, null,
    235                                 GraphViewPreferences.getInstance().getArrowheadFillColor());
    236 
    237             }
    238 
    239         }
    240     }
    241 
    242         public static void paintArrowhead(Graphics2D g2D,
    243                         Point p1, Point p2, Double arrowheadPlacement2,
    244                         Color casingColor, Color fillColor) {
    245 
    246                 Point pTip = new Point(
    247                                 (int)(p1.x + arrowheadPlacement2 * (p2.x - p1.x)),
    248                                 (int)(p1.y + arrowheadPlacement2 * (p2.y - p1.y)));
    249 
    250                 double angle = angleFromXAxis(p1, p2); // angle between x-axis and [p1,p2]
    251 
    252                 { //draw head shape
    253 
    254                         if (casingColor != null) {
    255                                 g2D.setColor(casingColor);
    256                         }
    257 
    258                     Shape head = ARROW_HEAD;
    259                     head = AffineTransform.getRotateInstance(angle).createTransformedShape(head);
    260                     head = AffineTransform.getTranslateInstance(pTip.x, pTip.y).createTransformedShape(head);
    261                     g2D.fill(head);
    262                 }
    263 
    264                 { //draw head core shape
    265 
    266                         if (fillColor != null) {
    267                                 g2D.setColor(fillColor);
    268                         }
    269 
    270                     Shape headCore = ARROW_HEAD_CORE;
    271                     headCore = AffineTransform.getRotateInstance(angle).createTransformedShape(headCore);
    272                     headCore = AffineTransform.getTranslateInstance(pTip.x, pTip.y).createTransformedShape(headCore);
    273                     g2D.fill(headCore);
    274                 }
    275 
    276         }
     235                paintArrowhead(g2D, p1, p2, arrowheadPlacement, null,
     236                        GraphViewPreferences.getInstance().getArrowheadFillColor());
     237
     238            }
     239
     240        }
     241    }
     242
     243    public static void paintArrowhead(Graphics2D g2D,
     244            Point p1, Point p2, Double arrowheadPlacement2,
     245            Color casingColor, Color fillColor) {
     246
     247        Point pTip = new Point(
     248                (int) (p1.x + arrowheadPlacement2 * (p2.x - p1.x)),
     249                (int) (p1.y + arrowheadPlacement2 * (p2.y - p1.y)));
     250
     251        double angle = angleFromXAxis(p1, p2); // angle between x-axis and [p1,p2]
     252
     253        { //draw head shape
     254
     255            if (casingColor != null) {
     256                g2D.setColor(casingColor);
     257            }
     258
     259            Shape head = ARROW_HEAD;
     260            head = AffineTransform.getRotateInstance(angle).createTransformedShape(head);
     261            head = AffineTransform.getTranslateInstance(pTip.x, pTip.y).createTransformedShape(head);
     262            g2D.fill(head);
     263        }
     264
     265        { //draw head core shape
     266
     267            if (fillColor != null) {
     268                g2D.setColor(fillColor);
     269            }
     270
     271            Shape headCore = ARROW_HEAD_CORE;
     272            headCore = AffineTransform.getRotateInstance(angle).createTransformedShape(headCore);
     273            headCore = AffineTransform.getTranslateInstance(pTip.x, pTip.y).createTransformedShape(headCore);
     274            g2D.fill(headCore);
     275        }
     276    }
    277277
    278278    private Point getNodePoint(GraphNode node, MapView mv) {
     
    311311        return nodePoint;
    312312    }
     313
    313314    private static Point getNodePoint(SegmentNode node, MapView mv) {
    314315        LatLonCoords coords = new LatLonCoords(node.getLat(), node.getLon());
    315316        return getNodePoint(coords, mv);
    316317    }
     318
    317319    private static Point getNodePoint(LatLonCoords coords, MapView mv) {
    318320        LatLon latLon = new LatLon(coords.getLat(), coords.getLon());
     
    333335        final float vecY = p2.y - p1.y;
    334336
    335         final float vecLength = (float)Math.sqrt(vecX*vecX + vecY*vecY);
     337        final float vecLength = (float) Math.sqrt(vecX*vecX + vecY*vecY);
    336338
    337339        final float dotProductVecAxis = vecX;
    338340
    339         float angle = (float)Math.acos(dotProductVecAxis / vecLength);
     341        float angle = (float) Math.acos(dotProductVecAxis / vecLength);
    340342
    341343        if (p2.y < p1.y) {
     
    361363
    362364            for (GraphEdge e : wayGraph.getEdges()) {
    363                 //draw arrowheads last to make sure they end up on top
     365                //draw arrowheads last to make sure they end up on top
    364366                paintGraphEdge(e, g, mv, false, true);
    365367            }
     
    404406    }
    405407
     408    @Override
    406409    public void update(WayGraph wayGraph) {
    407410        assert wayGraph == this.wayGraph;
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/layer/PreferencesColorScheme.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.plugin.layer;
    23
     
    1920    }
    2021
     22    @Override
    2123    public Color getNodeColor(GraphNode node) {
    2224        return preferences.getNodeColor();
    2325    }
    2426
     27    @Override
    2528    public Color getSegmentColor(Segment segment) {
    2629        return preferences.getSegmentColor();
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/preferences/GraphViewPreferenceDefaults.java

    r30737 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.plugin.preferences;
    23
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/preferences/GraphViewPreferences.java

    r30737 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.plugin.preferences;
    2 
    3 import static org.openstreetmap.josm.tools.I18n.marktr;
    43
    54import static org.openstreetmap.josm.plugins.graphview.core.property.VehiclePropertyTypes.AXLELOAD;
     
    1312import static org.openstreetmap.josm.plugins.graphview.core.property.VehiclePropertyTypes.WEIGHT;
    1413import static org.openstreetmap.josm.plugins.graphview.core.property.VehiclePropertyTypes.WIDTH;
     14import static org.openstreetmap.josm.tools.I18n.marktr;
    1515
    1616import java.awt.Color;
     
    4242 * because this class isn't registered as a preference listener.
    4343 */
    44 public class GraphViewPreferences extends Observable {
     44public final class GraphViewPreferences extends Observable {
    4545
    4646    private static GraphViewPreferences instance;
     
    4848    /**
    4949     * returns the single instance of GraphViewPreferences.
    50      * @param ignoreSyntaxErrors
    51      * @return
    5250     */
    5351    public static GraphViewPreferences getInstance() {
     
    7876        return useInternalRulesets;
    7977    }
     78
    8079    public synchronized void setUseInternalRulesets(boolean useInternalRulesets) {
    8180        this.useInternalRulesets = useInternalRulesets;
     
    8584        return rulesetFolder;
    8685    }
     86
    8787    public synchronized void setRulesetFolder(File rulesetFolder) {
    8888        this.rulesetFolder = rulesetFolder;
     
    9292        return currentRulesetFile;
    9393    }
     94
    9495    public synchronized void setCurrentRulesetFile(File currentRulesetFile) {
    9596        this.currentRulesetFile = currentRulesetFile;
     
    99100        return currentInternalRuleset;
    100101    }
     102
    101103    public synchronized void setCurrentInternalRuleset(InternalRuleset internalRuleset) {
    102104        this.currentInternalRuleset = internalRuleset;
     
    141143        return Collections.unmodifiableMap(parameterBookmarks);
    142144    }
     145
    143146    public synchronized void setParameterBookmarks(
    144147            Map<String, PreferenceAccessParameters> parameterBookmarks) {
     
    152155        return currentColorScheme;
    153156    }
     157
    154158    public synchronized void setCurrentColorScheme(ColorScheme currentColorScheme) {
    155159        this.currentColorScheme = currentColorScheme;
     
    159163        return nodeColor;
    160164    }
     165
    161166    public synchronized void setNodeColor(Color nodeColor) {
    162167        this.nodeColor = nodeColor;
     
    166171        return segmentColor;
    167172    }
     173
    168174    public synchronized void setSegmentColor(Color segmentColor) {
    169175        this.segmentColor = segmentColor;
     
    171177
    172178    public synchronized Color getArrowheadFillColor() {
    173                 return arrowheadFillColor;
    174         }
    175         public synchronized void setArrowheadFillColor(Color arrowheadFillColor) {
    176                 this.arrowheadFillColor = arrowheadFillColor;
    177         }
    178 
    179         public synchronized boolean getSeparateDirections() {
     179        return arrowheadFillColor;
     180    }
     181
     182    public synchronized void setArrowheadFillColor(Color arrowheadFillColor) {
     183        this.arrowheadFillColor = arrowheadFillColor;
     184    }
     185
     186    public synchronized boolean getSeparateDirections() {
    180187        return separateDirections;
    181188    }
     189
    182190    public synchronized void setSeparateDirections(boolean separateDirections) {
    183191        this.separateDirections = separateDirections;
     
    185193
    186194    public synchronized double getArrowheadPlacement() {
    187         return arrowheadPlacement;
    188     }
     195        return arrowheadPlacement;
     196    }
     197
    189198    public synchronized void setArrowheadPlacement(double arrowheadPlacement) {
    190199        this.arrowheadPlacement = arrowheadPlacement;
     
    315324        arrowheadPlacement = Main.pref.getDouble("graphview.arrowheadPlacement", 1.0);
    316325        if (arrowheadPlacement < 0.0 || arrowheadPlacement >= 1.0) {
    317                 arrowheadPlacement = 1.0;
     326            arrowheadPlacement = 1.0;
    318327        }
    319328
     
    326335    private static final Map<VehiclePropertyType<?>, String> VEHICLE_PROPERTY_TYPE_NAME_MAP =
    327336        new HashMap<>();
    328 
    329337
    330338    static {
     
    381389        }
    382390
    383         if(stringBuilder.charAt(stringBuilder.length()-1) == ',') {
     391        if (stringBuilder.charAt(stringBuilder.length()-1) == ',') {
    384392            stringBuilder.deleteCharAt(stringBuilder.length()-1);
    385393        }
     
    398406        }
    399407
    400         if(stringBuilder.charAt(stringBuilder.length()-1) == ',') {
     408        if (stringBuilder.charAt(stringBuilder.length()-1) == ',') {
    401409            stringBuilder.deleteCharAt(stringBuilder.length()-1);
    402410        }
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/preferences/InternalRuleset.java

    r30550 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.plugin.preferences;
    23
     
    78
    89    private String resourceName;
    9     private InternalRuleset(String resourceName) {
     10
     11    InternalRuleset(String resourceName) {
    1012        this.resourceName = resourceName;
    1113    }
     14
    1215    public String getResourceName() {
    1316        return resourceName;
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/preferences/PreferenceAccessParameters.java

    r30737 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.plugin.preferences;
    23
     
    2223    private final Map<VehiclePropertyType<?>, Object> vehiclePropertyValues;
    2324
     25    @Override
    2426    public String getAccessClass() {
    2527        return accessClass;
    2628    }
    2729
     30    @Override
    2831    public boolean getAccessTypeUsable(AccessType accessType) {
    2932        assert accessType != null;
     
    3134    }
    3235
     36    @Override
    3337    public Collection<VehiclePropertyType<?>> getAvailableVehicleProperties() {
    3438        return vehiclePropertyValues.keySet();
     
    4448     *                         {@link VehiclePropertyType#isValidValue(Object)} method.
    4549     */
     50    @Override
    4651    public <D> D getVehiclePropertyValue(VehiclePropertyType<D> vehicleProperty) {
    4752        assert vehicleProperty != null;
    4853
    4954        @SuppressWarnings("unchecked")
    50         D value = (D)vehiclePropertyValues.get(vehicleProperty);
     55        D value = (D) vehiclePropertyValues.get(vehicleProperty);
    5156        return value;
    5257    }
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/preferences/VehiclePropertyStringParser.java

    r30737 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.plugin.preferences;
    23
     
    910import java.util.List;
    1011
     12import org.openstreetmap.josm.Main;
    1113import org.openstreetmap.josm.plugins.graphview.core.property.VehiclePropertyType;
    1214import org.openstreetmap.josm.plugins.graphview.core.property.VehiclePropertyTypes;
     
    5355     * returns the value represented by the propertyValueString
    5456     *
    55      * @throws PropertyValueSyntaxException  if the string has syntax errors that prevent parsing
    56      * @throws InvalidParameterException     if an unknown property type was passed
    57      *
    5857     * @param propertyType         type of the property; != null
    5958     * @param propertyValueString  string to parse; != null
     
    6160     *                             Guaranteed to be valid according to propertyType's
    6261     *                             {@link VehiclePropertyType#isValidValue(Object)} method.
     62     *
     63     * @throws PropertyValueSyntaxException  if the string has syntax errors that prevent parsing
     64     * @throws InvalidParameterException     if an unknown property type was passed
    6365     */
    64     public static final <V> V parsePropertyValue(
     66    public static <V> V parsePropertyValue(
    6567            VehiclePropertyType<V> propertyType, String propertyValueString)
    6668    throws PropertyValueSyntaxException {
     
    7476            if (value != null && propertyType.isValidValue(value)) {
    7577                @SuppressWarnings("unchecked") //V must be float because of propertyType condition
    76                 V result = (V)value;
     78                V result = (V) value;
    7779                return result;
    7880            } else {
     
    8789            if (value != null && propertyType.isValidValue(value)) {
    8890                @SuppressWarnings("unchecked") //V must be float because of propertyType condition
    89                 V result = (V)value;
     91                V result = (V) value;
    9092                return result;
    9193            } else {
     
    98100            if (value != null && propertyType.isValidValue(value)) {
    99101                @SuppressWarnings("unchecked") //V must be float because of propertyType condition
    100                 V result = (V)value;
     102                V result = (V) value;
    101103                return result;
    102104            } else {
     
    110112            if (value != null && propertyType.isValidValue(value)) {
    111113                @SuppressWarnings("unchecked") //V must be float because of propertyType condition
    112                 V result = (V)value;
     114                V result = (V) value;
    113115                return result;
    114116            } else {
     
    122124                if (0 <= value && value <= 5) {
    123125                    @SuppressWarnings("unchecked") //V must be int because of propertyType condition
    124                     V result = (V)(Integer)value;
     126                    V result = (V) (Integer) value;
    125127                    return result;
    126128                }
    127             } catch (NumberFormatException e) {}
     129            } catch (NumberFormatException e) {
     130                Main.trace(e);
     131            }
    128132
    129133            throw new PropertyValueSyntaxException(ERROR_TRACKTYPE);
     
    143147
    144148            @SuppressWarnings("unchecked") //V must be Collection because of propertyType condition
    145             V result = (V)surfaceBlacklist;
     149            V result = (V) surfaceBlacklist;
    146150            return result;
    147151
  • applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/FullGraphCreationTest.java

    r30737 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core;
    23
     
    45
    56import java.util.Arrays;
     7import java.util.Collection;
    68import java.util.HashMap;
    79import java.util.Iterator;
    810import java.util.LinkedList;
     11import java.util.List;
    912import java.util.Map;
    1013
     
    4952
    5053    private static final AccessRuleset TEST_RULESET = new AccessRuleset() {
     54        @Override
    5155        public java.util.List<String> getAccessHierarchyAncestors(String transportMode) {
    5256            return Arrays.asList(transportMode);
    5357        }
    54         public java.util.Collection<Tag> getBaseTags() {
     58
     59        @Override
     60        public Collection<Tag> getBaseTags() {
    5561            return Arrays.asList(new Tag("highway", "test"));
    5662        }
    57         public java.util.List<Implication> getImplications() {
     63
     64        @Override
     65        public List<Implication> getImplications() {
    5866            return new LinkedList<>();
    5967        }
     
    174182        while (iterator.hasNext()) {
    175183            iterator.next();
    176             size ++;
     184            size++;
    177185        }
    178186        return size;
  • applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/TestDataSource.java

    r30737 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core;
    23
     
    1213import org.openstreetmap.josm.plugins.graphview.core.data.TagGroup;
    1314
    14 public class TestDataSource implements DataSource<TestDataSource.TestNode, TestDataSource.TestWay, TestDataSource.TestRelation, TestDataSource.TestRelationMember> {
     15public class TestDataSource
     16implements DataSource<TestDataSource.TestNode, TestDataSource.TestWay, TestDataSource.TestRelation, TestDataSource.TestRelationMember> {
    1517
    1618    public static class TestPrimitive {
    1719        public final Map<String, String> tags = new HashMap<>();
    18     };
     20    }
    1921
    2022    public static class TestNode extends TestPrimitive {
     
    2426            this(0, 0);
    2527        }
     28
    2629        public TestNode(double lat, double lon) {
    2730            this.lat = lat;
    2831            this.lon = lon;
    2932        }
     33
    3034        @Override
    3135        public String toString() {
     
    5761            this.member = member;
    5862        }
     63
    5964        public TestPrimitive getMember() {
    6065            return member;
    6166        }
     67
    6268        public String getRole() {
    6369            return role;
    6470        }
     71
    6572        @Override
    6673        public String toString() {
     
    7481    public final Collection<TestRelation> relations = new LinkedList<>();
    7582
    76 
     83    @Override
    7784    public double getLat(TestNode node) {
    7885        return node.lat;
    7986    }
     87
     88    @Override
    8089    public double getLon(TestNode node) {
    8190        return node.lon;
    8291    }
    8392
     93    @Override
    8494    public Iterable<TestRelationMember> getMembers(TestRelation relation) {
    8595        return relation.members;
    8696    }
    8797
     98    @Override
    8899    public Iterable<TestNode> getNodes() {
    89100        return nodes;
    90101    }
    91102
     103    @Override
    92104    public Iterable<TestNode> getNodes(TestWay way) {
    93105        return way.nodes;
    94106    }
    95107
     108    @Override
    96109    public Iterable<TestWay> getWays() {
    97110        return ways;
    98111    }
    99112
     113    @Override
    100114    public Iterable<TestRelation> getRelations() {
    101115        return relations;
    102116    }
    103117
     118    @Override
    104119    public TagGroup getTagsN(TestNode node) {
    105120        return new MapBasedTagGroup(node.tags);
    106121    }
    107122
     123    @Override
    108124    public TagGroup getTagsW(TestWay way) {
    109125        return new MapBasedTagGroup(way.tags);
    110126    }
    111127
     128    @Override
    112129    public TagGroup getTagsR(TestRelation relation) {
    113130        return new MapBasedTagGroup(relation.tags);
    114131    }
    115132
     133    @Override
    116134    public Object getMember(TestRelationMember member) {
    117135        return member.getMember();
    118136    }
    119137
     138    @Override
    120139    public String getRole(TestRelationMember member) {
    121140        return member.getRole();
    122141    }
    123142
     143    @Override
    124144    public boolean isNMember(TestRelationMember member) {
    125145        return member.getMember() instanceof TestNode;
    126146    }
    127147
     148    @Override
    128149    public boolean isWMember(TestRelationMember member) {
    129150        return member.getMember() instanceof TestWay;
    130151    }
    131152
     153    @Override
    132154    public boolean isRMember(TestRelationMember member) {
    133155        return member.getMember() instanceof TestRelation;
    134156    }
    135157
     158    @Override
    136159    public void addObserver(DataSourceObserver observer) {
    137160        // not needed for test
    138161    }
    139162
     163    @Override
    140164    public void deleteObserver(DataSourceObserver observer) {
    141165        // not needed for test
  • applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/access/AccessRulesetReaderTest.java

    r30737 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.access;
    23
  • applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/property/RoadInclineTest.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.property;
    23
  • applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/property/RoadMaxspeedTest.java

    r23189 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.property;
    23
     
    78
    89    private static void testMaxspeed(float expectedMaxspeed, String maxspeedString) {
    9         testEvaluateBoth(new RoadMaxspeed(),    expectedMaxspeed, new Tag("maxspeed", maxspeedString));
     10        testEvaluateBoth(new RoadMaxspeed(), expectedMaxspeed, new Tag("maxspeed", maxspeedString));
    1011    }
    1112
     
    2930        testMaxspeed(24.14016f, "15 mph");
    3031    }
    31 
    3232}
  • applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/property/RoadPropertyTest.java

    r30560 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.property;
    23
     
    89
    910@Ignore("no test")
    10 abstract public class RoadPropertyTest {
     11public abstract class RoadPropertyTest {
    1112
    1213    protected static <P> void testEvaluateW(RoadPropertyType<P> property, P expectedForward, P expectedBackward, Tag... wayTags) {
  • applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/util/TagConditionLogicTest.java

    r30737 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.util;
    23import static org.junit.Assert.assertFalse;
  • applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/util/ValueStringParserTest.java

    r30550 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.util;
    23
     
    8889    }
    8990
    90     private static final void assertClose(float expected, float actual) {
     91    private static void assertClose(float expected, float actual) {
    9192        if (Math.abs(expected - actual) > 0.001) {
    9293            throw new AssertionError("expected " + expected + ", was " + actual);
  • applications/editors/josm/plugins/graphview/test/unit/org/openstreetmap/josm/plugins/graphview/core/visualisation/FloatPropertyColorSchemeTest.java

    r30737 r32620  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.graphview.core.visualisation;
    23
Note: See TracChangeset for help on using the changeset viewer.