Package org.eclipse.emf.compare.ide.ui.internal.logical.resolver

# Class AbstractResolution

java.lang.Object
org.eclipse.emf.compare.ide.ui.internal.logical.resolver.AbstractResolution

Direct Known Subclasses:
  `LocalModelResolution`, `LocalModelsResolution`, `ModelsResolution`

public abstract class AbstractResolution extends Object
Abstract super-class of resolving computations.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected final IResolutionContext`
`context`
The context.
`protected DiagnosticSupport`
`diagnostic`
The diagnostic.
`protected IImplicitDependencies`
`implicitDependencies`
The implicit dependencies.
`protected final EMFCompareLogger`
`logger`
The logger
`protected final org.eclipse.core.runtime.SubMonitor`
`monitor`
The monitor.

## Constructor Summary

Constructors
Constructor
Description
`AbstractResolution(IResolutionContext context, org.eclipse.core.runtime.IProgressMonitor monitor)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected Set<URI>`
`asURISet(Set<org.eclipse.core.resources.IStorage> storages)`
Transforms the given `Set` of `IStorage`s into a `Set` of `URI`s.
`protected <T> T`
`call(Callable<T> callable)`
Executes the given callable as soon as there is no other computation running, and automatically runs "finalization" treatment once the computation is over, whatever its outcome (success or failure).
`protected Runnable`
`getFinalizeResolvingRunnable()`
This provides the treatment that is run at the end of the computation, whatever its outcome.
`protected IImplicitDependencies`
`getImplicitDependencies()`
Returns the implicit dependencies which can be used to retrieve a set of files that should be part of the same logical model than a given file.
`protected int`
`getTicks()`
Number of ticks to allocate to the progress monitor used for reporting progress.
`protected Set<org.eclipse.core.resources.IStorage>`
`resolveTraversal(org.eclipse.core.resources.IFile file, Set<URI> bounds)`
Computes the traversal of the given file, excluding the given bounds if needed.

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

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

## Field Details

### context

protected final IResolutionContext context
The context.

### monitor

protected final org.eclipse.core.runtime.SubMonitor monitor
The monitor.

### diagnostic

protected DiagnosticSupport diagnostic
The diagnostic.

### logger

protected final EMFCompareLogger logger
The logger

### implicitDependencies

protected IImplicitDependencies implicitDependencies
The implicit dependencies.

## Constructor Details

### AbstractResolution

public AbstractResolution(IResolutionContext context, org.eclipse.core.runtime.IProgressMonitor monitor)
Constructor.

Parameters:
  `context` - The resolution context, must not be `null`
  `monitor` - The progress monitor, can be `null`

## Method Details

### getImplicitDependencies

protected IImplicitDependencies getImplicitDependencies()
Returns the implicit dependencies which can be used to retrieve a set of files that should be part of the same logical model than a given file.

Returns:
  The `IImplicitDependencies` instance.

### getTicks

protected int getTicks()
Number of ticks to allocate to the progress monitor used for reporting progress.

Returns:
  The number of ticks to use, 100 by default but can be overridden if necessary.

### call

protected <T> T call(Callable<T> callable)
Executes the given callable as soon as there is no other computation running, and automatically runs "finalization" treatment once the computation is over, whatever its outcome (success or failure). A `diagnostic` is instantiated before the computation and should be used thourghout this whole computation. It will be set to `null` before returning, whatever happens.

Type Parameters:
  `T` - The type of the returned value.
Parameters:
  `callable` - Treatment to run
Returns:
  The result of the treatment

### getFinalizeResolvingRunnable

protected Runnable getFinalizeResolvingRunnable()
This provides the treatment that is run at the end of the computation, whatever its outcome. It is guaranteed to run once, in a block "finally", along with other required finalization treatments that are run systematically. There's no need to acquire a lock, this is guaranteed to have been done before, and it is released after this treatment ends.

Returns:
  The `Runnable` to run after having resolved resources.

### asURISet

protected Set<URI> asURISet(Set<org.eclipse.core.resources.IStorage> storages)
Transforms the given `Set` of `IStorage`s into a `Set` of `URI`s.

Parameters:
  `storages` - The storages to transform, must not be `null`.
Returns:
  A mutable set of `URI`s, may be empty but never `)null`.

### resolveTraversal

protected Set<org.eclipse.core.resources.IStorage> resolveTraversal(org.eclipse.core.resources.IFile file, Set<URI> bounds)
Computes the traversal of the given file, excluding the given bounds if needed.

Parameters:
  `file` - File for which the traversal is needed
  `bounds` - URI to exclude from the logical model computation in case both compared resources are part of the same logical model
Returns:
  A `Set` of the file's outgoing and incoming dependencies, never null but possibly empty.