Class IDChanger

java.lang.Object
org.eclipse.net4j.util.IDChanger

public final class IDChanger extends Object
A utility class for changing IDs according to a set of changes.

The changes are applied by calling a handler for single changes, consecutive changes, and arbitrary changes.

Since:
3.29
Author:
Eike Stepper
See Also:
  • Method Details

    • changeIDs

      public static void changeIDs(Map<Integer,Integer> changes, IDChanger.ChangeHandler handler)
      Changes IDs according to the given map of changes.

      The map's keys are the old IDs, and the values are the new IDs.

      If there are conflicts among the changes (i.e., an old ID is changed to a new ID that is also an old ID), temporary IDs are introduced to resolve the conflicts.

      The changes are applied by calling the given handler. The algorithm tries to group changes into single changes, consecutive changes, and arbitrary changes to minimize the number of calls to the handler.

    • changeIDs

      public static void changeIDs(Map<Integer,Integer> changes, int initialTempID, IDChanger.ChangeHandler handler)
      Changes IDs according to the given map of changes.

      The map's keys are the old IDs, and the values are the new IDs.

      If there are conflicts among the changes (i.e., an old ID is changed to a new ID that is also an old ID), temporary IDs are introduced to resolve the conflicts.

      The changes are applied by calling the given handler. The algorithm tries to group changes into single changes, consecutive changes, and arbitrary changes to minimize the number of calls to the handler.