Class ModelUpdateUtils
- java.lang.Object
-
- net.ssehub.easy.basics.modelManagement.ModelUpdateUtils
-
class ModelUpdateUtils extends java.lang.ObjectA set of algorithms to enable recursive model updates along the imports. This implementation is initial as it rebuilds the importing model structure (to be turned into an incremental version later).- Author:
- Holger Eichelberger
-
-
Constructor Summary
Constructors Constructor Description ModelUpdateUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static <M extends IModel>
java.util.Map<M,M>addReplacing(M old, M model)Adds a pair of original and replacing model into a new mapping structure.(package private) static <M extends IModel>
java.util.Map<M,M>addReplacing(M old, M model, java.util.Map<M,M> result)Adds a pair of original and replacing model into a new mapping structure.(package private) static <M extends IModel>
java.util.Map<M,java.util.List<M>>collectImporting(java.util.List<M> models, java.util.Map<M,M> replacing)Collects all importing models.(package private) static <M extends IModel>
java.util.List<M>determineUpdateSeqence(M model, java.util.Map<M,java.util.List<M>> using)Determines the update sequence formodelbased on the importing models inusing.private static <M extends IModel>
intfollowImporting(M model, java.util.Map<M,java.util.List<M>> using, java.util.Map<M,java.lang.Integer> sequence, int start, java.util.Set<M> done)Recursively follows the importing models provided byusingfrommodeland enumerates them fromstart.
-
-
-
Method Detail
-
addReplacing
static <M extends IModel> java.util.Map<M,M> addReplacing(M old, M model)
Adds a pair of original and replacing model into a new mapping structure.- Type Parameters:
M- the model type- Parameters:
old- the old modelmodel- the replacing model- Returns:
- the mapping structure containing
oldandmodel
-
addReplacing
static <M extends IModel> java.util.Map<M,M> addReplacing(M old, M model, java.util.Map<M,M> result)
Adds a pair of original and replacing model into a new mapping structure.- Type Parameters:
M- the model type- Parameters:
old- the old modelmodel- the replacing modelresult- the mapping structure before adding, may be null then a new one is created- Returns:
- the mapping structure containing
oldandmodel
-
collectImporting
static <M extends IModel> java.util.Map<M,java.util.List<M>> collectImporting(java.util.List<M> models, java.util.Map<M,M> replacing)
Collects all importing models.- Type Parameters:
M- the type of model- Parameters:
models- the models to be consideredreplacing- optional mapping of old and new models in case of updates (result will contain new models rather than old ones mentioned in the mapping), may be null- Returns:
- all importing models, key is model, value is importing models
-
determineUpdateSeqence
static <M extends IModel> java.util.List<M> determineUpdateSeqence(M model, java.util.Map<M,java.util.List<M>> using)
Determines the update sequence formodelbased on the importing models inusing. This method follows all imports and gives the imported model a sequence number. Revisited models receive a higher number in order to be later in sequence.- Type Parameters:
M- the type of model- Parameters:
model- the model to determine the update sequence forusing- the actual importing models- Returns:
- the update sequence (may contain null in case of models shifted in sequence)
-
followImporting
private static <M extends IModel> int followImporting(M model, java.util.Map<M,java.util.List<M>> using, java.util.Map<M,java.lang.Integer> sequence, int start, java.util.Set<M> done)
Recursively follows the importing models provided byusingfrommodeland enumerates them fromstart. Revisited models receive a higher number and, thus, will be later in the update sequence.- Type Parameters:
M- the type of model- Parameters:
model- the model to start the recursive traversalusing- the actual importing modelssequence- the importing models and their assigned sequence numberstart- the start sequence numberdone- already processed models - cycle prevention- Returns:
- the updated start sequence number
-
-