M - the specific model typeclass ResolutionContext<M extends IModel>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private java.util.List<ModelImport<M>> |
conflicts |
private IRestrictionEvaluationContext |
evaluationContext |
private java.util.List<ModelInfo<M>> |
inProgress |
private M |
model |
private java.lang.String |
modelName |
private java.net.URI |
modelUri |
private IModelRepository<M> |
repository |
private boolean |
topLevel |
private ModelImport<M> |
toResolve |
| Constructor and Description |
|---|
ResolutionContext(M model,
java.net.URI modelUri,
java.util.List<ModelInfo<M>> inProgress,
IModelRepository<M> repository,
IRestrictionEvaluationContext evaluationContext)
Creates a resolution context.
|
ResolutionContext(M model,
java.net.URI modelUri,
ResolutionContext<M> context)
Creates a resolution context.
|
ResolutionContext(java.lang.String modelName,
java.net.URI baseUri,
IModelRepository<M> repository,
IRestrictionEvaluationContext evaluationContext)
Creates a resolution context for resolving a model by name.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addConflict(ModelImport<M> conflict)
Adds a single conflict to the conflict set of this resolution context.
|
static <M extends IModel> |
addConflicts(java.util.List<ModelImport<M>> conflicts,
java.util.List<ModelImport<M>> toAdd)
Adds the given
toAdd conflicts to conflicts. |
void |
addConflicts(ResolutionContext<M> context)
Adds all conflicts of the given
context. |
boolean |
considerLoading(boolean isTransitiveEnabled)
Returns whether model loading shall be considered.
|
private void |
enumerateDependent(ModelLocations.Location location,
java.util.List<java.lang.String> results,
java.util.Set<ModelLocations.Location> done)
Enumerate the dependent locations in terms of model paths.
|
ModelImport<M> |
getConflict(M model)
Returns the first conflict
model and its (recursive) imports have with the conflict import
statements collected in this context. |
private ModelImport<M> |
getConflict(M model,
java.util.Set<M> done)
Returns the first conflict
model and its (recursive) imports have with the conflict import
statements collected in this context. |
private ModelImport<M> |
getConflict(java.lang.String modelName,
Version version)
Returns the first conflict the described model has with the conflict import statements collected in this context.
|
IRestrictionEvaluationContext |
getEvaluationContext()
Returns the evaluation context for version restrictions.
|
M |
getModel()
Returns the model defining the context.
|
java.lang.String |
getModelName()
Returns the name of the model to resolve.
|
java.util.List<java.lang.String> |
getModelPaths()
Returns the model paths.
|
IModelRepository<M> |
getModelRepository()
Returns the model repository.
|
java.net.URI |
getModelURI()
Returns the URI to
model. |
ModelImport<M> |
getToResolve()
Returns the actual import for resolution.
|
boolean |
isConflict(ModelInfo<M> info)
Returns whether
info has a conflict with the conflict import statements collected in this context. |
boolean |
isLoop(ModelInfo<M> info)
Returns whether loading
info would cause in infinite
loop in type resolution as it is currently being processed in the
same resolution context. |
boolean |
isTopLevel()
Returns whether this is a top-level or a recursively used context.
|
private void |
lazyInitConflicts()
Initializes the conflicts set if required.
|
void |
setToResolve(ModelImport<M> toResolve)
Changes the actual import for resolution.
|
private java.lang.String modelName
private IModelRepository<M extends IModel> repository
private ModelImport<M extends IModel> toResolve
private java.net.URI modelUri
private IRestrictionEvaluationContext evaluationContext
private java.util.List<ModelImport<M extends IModel>> conflicts
private boolean topLevel
public ResolutionContext(M model, java.net.URI modelUri, ResolutionContext<M> context)
model - the model for which the import resolution happensmodelUri - the URI to model (may be null)context - the parent contextspublic ResolutionContext(M model, java.net.URI modelUri, java.util.List<ModelInfo<M>> inProgress, IModelRepository<M> repository, IRestrictionEvaluationContext evaluationContext)
model - the model for which the import resolution happensmodelUri - the URI to model (may be null)inProgress - the models being processed at once with model (may be null)repository - the model repositoryevaluationContext - the context for evaluating import restrictions (variable definitions...
interpreted locally)public ResolutionContext(java.lang.String modelName,
java.net.URI baseUri,
IModelRepository<M> repository,
IRestrictionEvaluationContext evaluationContext)
modelName - the name of the model to resolvebaseUri - the URI where to start the resolution from (may be a model URI)repository - the model repositoryevaluationContext - the context for evaluating import restrictions (variable definitions...
interpreted locally)public void setToResolve(ModelImport<M> toResolve)
toResolve - the actual importpublic ModelImport<M> getToResolve()
public java.net.URI getModelURI()
model.public M getModel()
public java.lang.String getModelName()
public IModelRepository<M> getModelRepository()
public java.util.List<java.lang.String> getModelPaths()
private void enumerateDependent(ModelLocations.Location location, java.util.List<java.lang.String> results, java.util.Set<ModelLocations.Location> done)
location - the location to enumerateresults - the resulting model paths (modified as a side effect)done - the already processed locations in order to avoid cyclespublic boolean isLoop(ModelInfo<M> info)
info would cause in infinite
loop in type resolution as it is currently being processed in the
same resolution context.info - the information object to be checkedtrue if it would cause a loop, false elsepublic IRestrictionEvaluationContext getEvaluationContext()
private void lazyInitConflicts()
public void addConflicts(ResolutionContext<M> context)
context.context - the context to considerpublic static <M extends IModel> java.util.List<ModelImport<M>> addConflicts(java.util.List<ModelImport<M>> conflicts, java.util.List<ModelImport<M>> toAdd)
toAdd conflicts to conflicts. conflicts may be
null and is created then lazily.M - the type of modelsconflicts - the conflicts set to add the toAdd conflicts totoAdd - the conflicts to be addedconflicts if not null, a new list otherwisepublic void addConflict(ModelImport<M> conflict)
conflict - the conflictpublic ModelImport<M> getConflict(M model) throws RestrictionEvaluationException
model and its (recursive) imports have with the conflict import
statements collected in this context.model - the model information to search forRestrictionEvaluationException - in case of evaluation problemsprivate ModelImport<M> getConflict(M model, java.util.Set<M> done) throws RestrictionEvaluationException
model and its (recursive) imports have with the conflict import
statements collected in this context.model - the model information to search for (may be nulldone - the models visited so far (cycle check)RestrictionEvaluationException - in case of evaluation problemsprivate ModelImport<M> getConflict(java.lang.String modelName, Version version) throws RestrictionEvaluationException
modelName - the name of the modelversion - the version of the model (may be null)RestrictionEvaluationException - in case of evaluation problemspublic boolean isConflict(ModelInfo<M> info) throws RestrictionEvaluationException
info has a conflict with the conflict import statements collected in this context.info - the model information to search forcontext implies conflicts on modelRestrictionEvaluationException - in case of evaluation problemspublic boolean isTopLevel()
true for top-level, false elsepublic boolean considerLoading(boolean isTransitiveEnabled)
isTransitiveEnabled - whether transitive loading is enabledtrue for loading, false elseCopyright © 2009 - 2018 SSE. All Rights Reserved.