Ticket #3347: mergenodesstatic-main.patch

File mergenodesstatic-main.patch, 2.8 KB (added by bilbo, 16 years ago)

Make some MergeNodesAction methods static for speedup - main part

  • src/org/openstreetmap/josm/actions/MergeNodesAction.java

     
    6565        }
    6666    }
    6767
    68     protected void completeTagCollectionWithMissingTags(TagCollection tc, Collection<Node> mergedNodes) {
     68    protected static void completeTagCollectionWithMissingTags(TagCollection tc, Collection<Node> mergedNodes) {
    6969        for (String key: tc.getKeys()) {
    7070            // make sure the empty value is in the tag set if a tag is not present
    7171            // on all merged nodes
     
    8181        tc.removeByKey("created_by");
    8282    }
    8383
    84     protected void completeTagCollectionForEditing(TagCollection tc) {
     84    protected static void completeTagCollectionForEditing(TagCollection tc) {
    8585        for (String key: tc.getKeys()) {
    8686            // make sure the empty value is in the tag set such that we can delete the tag
    8787            // in the conflict dialog if necessary
     
    9797     * @param candidates the collection of candidate nodes
    9898     * @return the selected target node
    9999     */
    100     public Node selectTargetNode(Collection<Node> candidates) {
     100    public static Node selectTargetNode(Collection<Node> candidates) {
    101101        // Find which node to merge into (i.e. which one will be left)
    102102        // - this should be combined from two things:
    103103        //   1. It will be the first node in the list that has a
     
    123123        return targetNode;
    124124    }
    125125
    126 
    127126    /**
    128127     * Merges the nodes in <code>node</code> onto one of the nodes. Uses the dataset
    129128     * managed by <code>layer</code> as reference.
     
    135134     * @throws IllegalArgumentException thrown if targetNode is null
    136135     *
    137136     */
    138     public Command mergeNodes(OsmDataLayer layer, Collection<Node> nodes, Node targetNode) throws IllegalArgumentException{
     137    public static Command mergeNodes(OsmDataLayer layer, Collection<Node> nodes, Node targetNode) throws IllegalArgumentException{
    139138        if (layer == null)
    140139            throw new IllegalArgumentException(tr("parameter ''{0}'' must not be null", "nodes"));
    141140        if (targetNode == null)
     
    162161     * @throw IllegalArgumentException thrown if layer is null
    163162     * @throw IllegalArgumentException thrown if  backreferences.getSource() != layer.data
    164163     */
    165     public Command mergeNodes(OsmDataLayer layer, BackreferencedDataSet backreferences, Collection<Node> nodes, Node targetNode) {
     164    public static Command mergeNodes(OsmDataLayer layer, BackreferencedDataSet backreferences, Collection<Node> nodes, Node targetNode) {
    166165        if (layer == null)
    167166            throw new IllegalArgumentException(tr("parameter ''{0}'' must not be null", "nodes"));
    168167        if (targetNode == null)