Package org.eclipse.net4j.util

# 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:
  - `changeIDs(Map, ChangeHandler)`

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static interface`
`IDChanger.ChangeHandler`
A handler for ID changes.

## Method Summary

Modifier and Type
Method
Description
`static void`
`changeIDs(Map<Integer,Integer> changes, int initialTempID, IDChanger.ChangeHandler handler)`
Changes IDs according to the given map of changes.
`static void`
`changeIDs(Map<Integer,Integer> changes, IDChanger.ChangeHandler handler)`
Changes IDs according to the given map of changes.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## 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.