org.openstreetmap.josm.command
Class PurgeCommand

java.lang.Object
  extended by org.openstreetmap.josm.command.PseudoCommand
      extended by org.openstreetmap.josm.command.Command
          extended by org.openstreetmap.josm.command.PurgeCommand

public class PurgeCommand
extends Command

Command, to purge a list of primitives.


Field Summary
protected  DataSet ds
           
protected  Storage<PrimitiveData> makeIncompleteData
           
protected  java.util.Map<PrimitiveId,PrimitiveData> makeIncompleteData_byPrimId
           
protected  java.util.List<OsmPrimitive> toPurge
           
 
Constructor Summary
PurgeCommand(OsmDataLayer layer, java.util.Collection<OsmPrimitive> toPurge, java.util.Collection<OsmPrimitive> makeIncomplete)
          This command relies on a number of consistency conditions: - makeIncomplete must be a subset of toPurge.
 
Method Summary
 boolean executeCommand()
          Executes the command on the dataset.
 void fillModifiedData(java.util.Collection<OsmPrimitive> modified, java.util.Collection<OsmPrimitive> deleted, java.util.Collection<OsmPrimitive> added)
          Fill in the changed data this command operates on.
 javax.swing.Icon getDescriptionIcon()
          Provides a descriptive icon of this command.
 java.lang.String getDescriptionText()
          Provides a description text representing this command.
 java.util.Collection<? extends OsmPrimitive> getParticipatingPrimitives()
          Return the primitives that take part in this command.
protected  void saveIncomplete(java.util.Collection<OsmPrimitive> makeIncomplete)
           
static java.util.List<OsmPrimitive> topoSort(java.util.Collection<OsmPrimitive> sel)
          Sorts a collection of primitives such that for each object its referrers come later in the sorted collection.
 void undoCommand()
          Undoes the command.
 
Methods inherited from class org.openstreetmap.josm.command.Command
checkAndConfirmOutlyingOperation, getLayer, getOrig, invalidBecauselayerRemoved
 
Methods inherited from class org.openstreetmap.josm.command.PseudoCommand
getChildren
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

toPurge

protected java.util.List<OsmPrimitive> toPurge

makeIncompleteData

protected Storage<PrimitiveData> makeIncompleteData

makeIncompleteData_byPrimId

protected java.util.Map<PrimitiveId,PrimitiveData> makeIncompleteData_byPrimId

ds

protected final DataSet ds
Constructor Detail

PurgeCommand

public PurgeCommand(OsmDataLayer layer,
                    java.util.Collection<OsmPrimitive> toPurge,
                    java.util.Collection<OsmPrimitive> makeIncomplete)
This command relies on a number of consistency conditions: - makeIncomplete must be a subset of toPurge. - Each primitive, that is in toPurge but not in makeIncomplete, must have all its referrers in toPurge. - Each element of makeIncomplete must not be new and must have only referrers that are either a relation or included in toPurge.

Method Detail

saveIncomplete

protected void saveIncomplete(java.util.Collection<OsmPrimitive> makeIncomplete)

executeCommand

public boolean executeCommand()
Description copied from class: Command
Executes the command on the dataset. This implementation will remember all primitives returned by fillModifiedData for restoring them on undo.

Overrides:
executeCommand in class Command

undoCommand

public void undoCommand()
Description copied from class: Command
Undoes the command. It can be assumed that all objects are in the same state they were before. It can also be assumed that executeCommand was called exactly once before. This implementation undoes all objects stored by a former call to executeCommand.

Overrides:
undoCommand in class Command

topoSort

public static java.util.List<OsmPrimitive> topoSort(java.util.Collection<OsmPrimitive> sel)
Sorts a collection of primitives such that for each object its referrers come later in the sorted collection.


getDescriptionText

public java.lang.String getDescriptionText()
Description copied from class: PseudoCommand
Provides a description text representing this command.

Specified by:
getDescriptionText in class PseudoCommand

getDescriptionIcon

public javax.swing.Icon getDescriptionIcon()
Description copied from class: PseudoCommand
Provides a descriptive icon of this command.

Overrides:
getDescriptionIcon in class PseudoCommand

getParticipatingPrimitives

public java.util.Collection<? extends OsmPrimitive> getParticipatingPrimitives()
Description copied from class: Command
Return the primitives that take part in this command.

Overrides:
getParticipatingPrimitives in class Command

fillModifiedData

public void fillModifiedData(java.util.Collection<OsmPrimitive> modified,
                             java.util.Collection<OsmPrimitive> deleted,
                             java.util.Collection<OsmPrimitive> added)
Description copied from class: Command
Fill in the changed data this command operates on. Add to the lists, don't clear them.

Specified by:
fillModifiedData in class Command
Parameters:
modified - The modified primitives
deleted - The deleted primitives
added - The added primitives


JOSM