public class Utils
extends java.lang.Object
| Modifier | Constructor and Description |
|---|---|
private |
Utils()
Prevents this class from being instantiated.
|
| Modifier and Type | Method and Description |
|---|---|
(package private) static java.lang.StringBuilder |
appendErrors(java.lang.StringBuilder builder,
java.lang.String errors)
Appends a string of error messages to a given builder.
|
private static <M extends IModel> |
arrangeImportedModels(java.util.List<M> models)
Rearranges all
IModels used in imports. |
private static <M extends IModel> |
arrangeImportedModels(M model,
java.util.Set<M> alreadyVisited,
java.util.List<M> sequence)
Recursive part of
arrangeImportedModels(List) to arrange first the imports before the importing
project without running into an endless loop in case of cycling projects. |
(package private) static <M extends IModel> |
augmentByDepending(java.util.List<ModelInfo<M>> infos,
java.util.List<ModelInfo<M>> allInfos,
java.util.Map<M,ModelInfo<M>> modelInfoMap)
Augments the given model
infos by their depending models,
i.e. the models which import the models in info. |
(package private) static <M extends IModel> |
collectModelInfo(java.util.Collection<java.util.List<VersionedModelInfos<M>>> availableModels,
java.util.List<ModelInfo<M>> info,
java.util.Map<M,ModelInfo<M>> modelInfoMap)
Fills the given list/map as temporary data structures for improved
handling of model information objects and related model.
|
static <M extends IModel> |
discoverImports(M mainModel)
List all imported
IModels for the given model including the model itself. |
(package private) static <M extends IModel> |
enumerateImported(M model,
java.util.Set<M> result,
java.util.Set<M> deleteFrom)
Enumerate all imported (and resolved) models of
model (including model). |
private static <M extends IModel> |
findImportedModels(M model,
java.util.List<M> allModels,
java.util.Set<M> done)
Fills the stack of imported
IModels recursively. |
static boolean |
matches(IModelData data1,
IModelData data2)
Returns whether two model data object match.
|
(package private) static boolean |
sameVersion(Version version1,
Version version2)
Returns whether the given versions are equal.
|
static java.io.File |
toExistingFile(java.net.URI uri)
Returns a file object for
uri which points to an existing file. |
public static boolean matches(IModelData data1, IModelData data2)
matchesFull methods as soon as
full model import and conflicts resolution is available.data1 - the first data object to testdata2 - the second data object to testtrue if both match, false elsestatic boolean sameVersion(Version version1, Version version2)
version1 - the first version to compareversion2 - the second version to comparetrue if both versions are equal, false elsestatic java.lang.StringBuilder appendErrors(java.lang.StringBuilder builder,
java.lang.String errors)
builder
and errors (if errors contains information)builder - the builder to append to (modified as a side effect)errors - the error string (may be null)builderstatic <M extends IModel> void collectModelInfo(java.util.Collection<java.util.List<VersionedModelInfos<M>>> availableModels, java.util.List<ModelInfo<M>> info, java.util.Map<M,ModelInfo<M>> modelInfoMap)
M - the specific model typeavailableModels - all available model infos to be consideredinfo - a list of all available model information objects (modified
as a side effect if not null)modelInfoMap - a reverse mapping between models and their related
models (modified as a side effect if not null)static <M extends IModel> java.util.List<ModelInfo<M>> augmentByDepending(java.util.List<ModelInfo<M>> infos, java.util.List<ModelInfo<M>> allInfos, java.util.Map<M,ModelInfo<M>> modelInfoMap)
infos by their depending models,
i.e. the models which import the models in info. Please
note that this method contains only already resolved models!M - the specific model typeinfos - the model informations to be augmented by their depending
models (modified as a side effect)allInfos - all information objects that are currently availablemodelInfoMap - reverse mapping of models to their information objectspublic static java.io.File toExistingFile(java.net.URI uri)
uri which points to an existing file.uri - the URI to turn into a filestatic <M extends IModel> void enumerateImported(M model, java.util.Set<M> result, java.util.Set<M> deleteFrom)
model (including model).M - the actual model typemodel - the model to enumerate forresult - the imported models (modified as a side effect)deleteFrom - delete models to be added to result if not nullpublic static <M extends IModel> java.util.List<M> discoverImports(M mainModel)
IModels for the given model including the model itself. The most inner model
will be the first element of the list, the main model the last (helpful for a correct initialization). M - the actual model typemainModel - The model to start with. May contain any imports and is the starting point.private static <M extends IModel> void findImportedModels(M model, java.util.List<M> allModels, java.util.Set<M> done)
IModels recursively.M - the actual model typemodel - the model to be considered (should be the main model for starting the recursion).allModels - the list of all included models (modified as a side effect)done - already considered modelsprivate static <M extends IModel> java.util.List<M> arrangeImportedModels(java.util.List<M> models)
IModels used in imports.M - the actual model typemodels - IModels retrieved from findImportedModels(IModel, List, Set).IModels.private static <M extends IModel> void arrangeImportedModels(M model, java.util.Set<M> alreadyVisited, java.util.List<M> sequence)
arrangeImportedModels(List) to arrange first the imports before the importing
project without running into an endless loop in case of cycling projects.M - the actual model typemodel - The current IModel to add/checkalreadyVisited - Already visited IModels, will not be revisited in case of a cycle.
Should be empty when the recursive function is called from outside to start.sequence - The resulting sequence (deepest import should be first, main IModel should be last).
Should be empty when the recursive function is called from outside to start.Copyright © 2009 - 2018 SSE. All Rights Reserved.