Package org.eclipse.emf.compare.command.impl

# Class AbstractCopyCommand

java.lang.Object
org.eclipse.emf.common.command.AbstractCommand
org.eclipse.emf.edit.command.ChangeCommand
org.eclipse.emf.compare.command.impl.AbstractCopyCommand

All Implemented Interfaces:
  `Command`, `ICompareCopyCommand`

Direct Known Subclasses:
  `CopyCommand`, `MergeAllNonConflictingCommand`, `MergeCommand`

public abstract class AbstractCopyCommand extends ChangeCommand implements ICompareCopyCommand
This command can be used to copy a number of diffs (or a single one) in a given direction.

Since:
  3.0

## Nested Class Summary

## Nested classes/interfaces inherited from class org.eclipse.emf.common.command.AbstractCommand

`AbstractCommand.NonDirtying`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected final List<? extends Diff>`
`differences`
The list of differences we are to merge.
`protected final boolean`
`leftToRight`
Direction of the merge operation.
`protected final IMerger.Registry`
`mergerRegistry`
Merger registry.

### Fields inherited from class org.eclipse.emf.edit.command.ChangeCommand

`changeDescription, changeRecorder, notifier, notifiers`

### Fields inherited from class org.eclipse.emf.common.command.AbstractCommand

`description, isExecutable, isPrepared, label`

## Constructor Summary

Constructors
Constructor
Description
`AbstractCopyCommand(ChangeRecorder changeRecorder, Collection<Notifier> notifiers, List<? extends Diff> differences, boolean leftToRight, IMerger.Registry mergerRegistry)`
Constructs an instance of this command given the list of differences that it needs to merge.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`canExecute()`
`void`
`dispose()`
`Collection<?>`
`getAffectedObjects()`
`com.google.common.collect.Multimap<DifferenceState,Diff>`
`getChangedDiffs()`
Returns the state changes to any diffs that this command produced.
`static com.google.common.collect.Multimap<DifferenceState,Diff>`
`getChangedDiffs(ChangeDescription changeDescription, Collection<? extends Diff> relevantDiffs)`
Returns the state changes to any relevant diffs modified in the given change description.
`boolean`
`isLeftToRight()`
Returns true if the command will be applied from left to right side, false otherwise.

### Methods inherited from class org.eclipse.emf.edit.command.ChangeCommand

`createChangeRecorder, disposeChangeRecorder, doExecute, execute, getChangeDescription, getChangeRecorder, prepare, redo, setChangeDescription, undo`

### Methods inherited from class org.eclipse.emf.common.command.AbstractCommand

`canUndo, chain, getDescription, getLabel, getResult, setDescription, setLabel, toString`

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

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

### Methods inherited from interface org.eclipse.emf.common.command.Command

`canUndo, chain, execute, getDescription, getLabel, getResult, redo, undo`

## Field Details

### differences

protected final List<? extends Diff> differences
The list of differences we are to merge.

### leftToRight

protected final boolean leftToRight
Direction of the merge operation.

### mergerRegistry

protected final IMerger.Registry mergerRegistry
Merger registry.

## Constructor Details

### AbstractCopyCommand

public AbstractCopyCommand(ChangeRecorder changeRecorder, Collection<Notifier> notifiers, List<? extends Diff> differences, boolean leftToRight, IMerger.Registry mergerRegistry)
Constructs an instance of this command given the list of differences that it needs to merge.

Parameters:
  `changeRecorder` - The change recorder associated to this command.
  `notifiers` - The collection of notifiers that will be notified of this command's execution.
  `differences` - The list of differences that this command should merge.
  `leftToRight` - The direction in which `differences` should be merged.
  `mergerRegistry` - The registry of mergers.

## Method Details

### isLeftToRight

public boolean isLeftToRight()
Returns true if the command will be applied from left to right side, false otherwise.

Specified by:
  `isLeftToRight` in interface `ICompareCopyCommand`
Returns:
  true if the command will be applied from left to right side, false otherwise.
See Also:
  - `ICompareCopyCommand.isLeftToRight()`

### getAffectedObjects

public Collection<?> getAffectedObjects()

Specified by:
  `getAffectedObjects` in interface `Command`
Overrides:
  `getAffectedObjects` in class `AbstractCommand`
See Also:
  - `AbstractCommand.getAffectedObjects()`

### canExecute

public boolean canExecute()

Specified by:
  `canExecute` in interface `Command`
Overrides:
  `canExecute` in class `AbstractCommand`
See Also:
  - `AbstractCommand.canExecute()`

### getChangedDiffs

public com.google.common.collect.Multimap<DifferenceState,Diff> getChangedDiffs()
Returns the state changes to any diffs that this command produced.

Returns:
  the state changes to any diffs that this command produced.

### getChangedDiffs

public static com.google.common.collect.Multimap<DifferenceState,Diff> getChangedDiffs(ChangeDescription changeDescription, Collection<? extends Diff> relevantDiffs)
Returns the state changes to any relevant diffs modified in the given change description.

Parameters:
  `changeDescription` - the change description to process.
  `relevantDiffs` - the diffs for which we can state changes in the map.
Returns:
  the state changes to any relevant diffs modified in the given change description.

### dispose

public void dispose()

Specified by:
  `dispose` in interface `Command`
Overrides:
  `dispose` in class `ChangeCommand`