001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.gui.progress;
003
004import java.util.Objects;
005
006/**
007 * The ID of a progress task. It is required to run tasks in background
008 */
009public class ProgressTaskId {
010
011    private final String id;
012
013    /**
014     * Create a new {@link ProgressTaskId}
015     * @param component The JOSM component name that creates this id
016     * @param task The task name
017     */
018    public ProgressTaskId(String component, String task) {
019        this.id = component + '.' + task;
020    }
021
022    /**
023     * Gets the id
024     * @return The task id
025     */
026    public String getId() {
027        return id;
028    }
029
030    @Override
031    public int hashCode() {
032        return Objects.hash(id);
033    }
034
035    @Override
036    public boolean equals(Object obj) {
037        if (this == obj) return true;
038        if (obj == null || getClass() != obj.getClass()) return false;
039        ProgressTaskId that = (ProgressTaskId) obj;
040        return Objects.equals(id, that.id);
041    }
042}