org.eclipse.emf.compare.match.engine
Class GenericMatchScope

java.lang.Object
  extended by org.eclipse.emf.compare.match.engine.GenericMatchScope
All Implemented Interfaces:
IMatchScope

public class GenericMatchScope
extends java.lang.Object
implements IMatchScope

The default IMatchScope implementation, which can be constructed with a single Resource or ResourceSet, or a single EObject. In case an instance is constructed by passing in a Resource, it will regard this resource and all its direct and indirect contents (fragments) to be in scope. If being instantiated with a ResourceSet, all resources within the set (as well as their direct and indirect content) are included in the scope. In case an instance is constructed with an EObject, its direct and indirect contents (EObject.eAllContents()) as well as its resource (EObject.eResource()), if specified, will be regarded to be within scope.

Since:
1.1

Constructor Summary
GenericMatchScope(org.eclipse.emf.ecore.EObject eObject)
          Allows to construct a scope based on a single EObject.
GenericMatchScope(org.eclipse.emf.ecore.resource.Resource scope)
          Allows to construct a scope based on a single Resource.
GenericMatchScope(org.eclipse.emf.ecore.resource.ResourceSet scope)
          Allow to construct a scope based on a single ResourceSet.
 
Method Summary
 java.util.List<org.eclipse.emf.ecore.resource.Resource> getResourcesInScope()
          Returns the list of Resources to be included in the scope.
 boolean isInScope(org.eclipse.emf.ecore.EObject eObject)
          Specifies whether the given EObject should be regarded as part of the match scope or not.
 boolean isInScope(org.eclipse.emf.ecore.resource.Resource resource)
          Specifies whether the given Resource should be regarded as part of the match scope or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericMatchScope

public GenericMatchScope(org.eclipse.emf.ecore.EObject eObject)
Allows to construct a scope based on a single EObject. The constructed scope will include the provided EObject, its direct and indirect contents (EObject.eAllContents()) as well as its resource (EObject.eResource()) in case one is specified.

Parameters:
eObject - the EObject used to construct the scope.

GenericMatchScope

public GenericMatchScope(org.eclipse.emf.ecore.resource.Resource scope)
Allows to construct a scope based on a single Resource. The constructed scope will include the Resource as well as its direct and indirect contents Resource.getAllContents() of the provided resource.

Parameters:
scope - the Resource used to construct the scope.

GenericMatchScope

public GenericMatchScope(org.eclipse.emf.ecore.resource.ResourceSet scope)
Allow to construct a scope based on a single ResourceSet. The constructed scope will include all resources of the resource set (@link ResourceSet.getResources()) as well as their content ( Resource.getAllContents()).

Parameters:
scope - the ResourceSet used to construct the scope.
Method Detail

isInScope

public boolean isInScope(org.eclipse.emf.ecore.EObject eObject)
Specifies whether the given EObject should be regarded as part of the match scope or not. If the passed in EObject is contained in a Resource, it may only be regarded to be within scope, if its Resource is also specified to be in scope via IMatchScope.isInScope(Resource).

Specified by:
isInScope in interface IMatchScope
Parameters:
eObject - the EObject of interest
Returns:
true if eObject is part of the scope, false otherwise
See Also:
IMatchScope.isInScope(org.eclipse.emf.ecore.EObject)

isInScope

public boolean isInScope(org.eclipse.emf.ecore.resource.Resource resource)
Specifies whether the given Resource should be regarded as part of the match scope or not.

Specified by:
isInScope in interface IMatchScope
Parameters:
resource - the resource of interest
Returns:
true if resource is part of the scope, false otherwise
See Also:
IMatchScope.isInScope(org.eclipse.emf.ecore.resource.Resource)

getResourcesInScope

public java.util.List<org.eclipse.emf.ecore.resource.Resource> getResourcesInScope()
Returns the list of Resources to be included in the scope. This should only be used to allow the application of IResourceFilter to restrict the scope after its construction.

Returns:
the list of Resources by references.

Copyright 2006 IBM Corporation and others.
All Rights Reserved.