Ignore:
Timestamp:
2017-06-08T23:41:02+02:00 (7 years ago)
Author:
michael2402
Message:

See #13036: Add more consistency checks to move / delete command.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/command/Command.java

    r11243 r12348  
    338338    }
    339339
     340    /**
     341     * Ensures that all primitives that are participating in this command belong to the affected data set.
     342     *
     343     * Commands may use this in their update methods to check the consitency of the primitives they operate on.
     344     * @throws AssertionError if no {@link DataSet} is set or if any primitive does not belong to that dataset.
     345     */
     346    protected void ensurePrimitivesAreInDataset() {
     347        for (OsmPrimitive primitive : this.getParticipatingPrimitives()) {
     348            if (primitive.getDataSet() != this.getAffectedDataSet()) {
     349                throw new AssertionError("Primitive is of wrong data set for this command: " + primitive);
     350            }
     351        }
     352    }
     353
    340354    @Override
    341355    public int hashCode() {
Note: See TracChangeset for help on using the changeset viewer.