    001// License: GPL. For details, see LICENSE file.
    002package org.openstreetmap.josm.plugins.streetside.history.commands;
    003
    004import java.util.Set;
    005import java.util.concurrent.ConcurrentSkipListSet;
    006
    007import org.openstreetmap.josm.plugins.streetside.StreetsideAbstractImage;
    008
    009/**
    010* Abstract class for any Streetside command.
    011*
    012* @author nokutu
    013*
    014*/
    015public abstract class StreetsideCommand {
    016/** Set of {@link StreetsideAbstractImage} objects affected by the command */
    017public Set<StreetsideAbstractImage> images;
    018
    019/**
    020* Main constructor.
    021*
    022* @param images
    023*          The images that are affected by the command.
    024*/
    025public StreetsideCommand(Set<StreetsideAbstractImage> images) {
    026 this.images = new ConcurrentSkipListSet<>(images);
    027}
    028
    029/**
    030* Undoes the action.
    031*/
    032public abstract void undo();
    033
    034/**
    035* Redoes the action.
    036*/
    037public abstract void redo();
    038
    039/**
    040* If two equal commands are applied consecutively to the same set of images,
    041* they are summed in order to reduce them to just one command.
    042*
    043* @param command
    044*          The command to be summed to last command.
    045*/
    046public abstract void sum(StreetsideCommand command);
    047
    048@Override
    049public abstract String toString();
    050}