Class ModelImport<M extends IModel>
java.lang.Object
net.ssehub.easy.basics.modelManagement.ModelImport<M>
- Type Parameters:
M- the specific type of model
Defines model imports and related restrictions.
- Author:
- Holger Eichelberger
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate booleanprivate Stringprivate Mprivate IVersionRestrictionstatic final String -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for serialization.ModelImport(String name) Creates an unrestricted (non-inserting) model import.ModelImport(String name, boolean isConflict, IVersionRestriction restriction) Creates a (non-inserting) model import instance.ModelImport(String name, boolean isConflict, IVersionRestriction restriction, boolean isInsert) Creates a model import instance. -
Method Summary
Modifier and TypeMethodDescriptionCreates a copy of this import.copyVersionRestriction(M model) Copies the version restriction.booleanevaluateRestrictions(IRestrictionEvaluationContext context, Version version) Evaluates the restrictions againstversion.getName()Returns the name of the model to be imported.Returns the resolved model instance.Returns the version restriction.booleanDoes this object represent an import or a conflict.booleanisInsert()Returns whether the import aims at inserting elements at the end of the importing model.booleanReturns whether the related model was already resolved.booleanReturns whether the import targets multiple models to be imported.static booleanisWildcard(String name) Returns whether the given name targets multiple models to be imported.voidsetResolved(M resolved) Defines the resolved model instance.voidsetRestrictions(IVersionRestriction restriction) Setter for setting the version restrictions.
-
Field Details
-
WILDCARD_POSTFIX
- See Also:
-
resolved
-
name
-
restriction
-
isConflict
private boolean isConflict -
isInsert
private boolean isInsert
-
-
Constructor Details
-
ModelImport
ModelImport()Constructor for serialization. -
ModelImport
Creates an unrestricted (non-inserting) model import.- Parameters:
name- The name of the project to be imported, becomes a wildcard import ifnameends withWILDCARD_POSTFIX
-
ModelImport
Creates a (non-inserting) model import instance.- Parameters:
name- the name of the model to be import, becomes a wildcard import ifnameends withWILDCARD_POSTFIXisConflict- does this object represent a conflict or an importrestriction- the version restriction (or null if absent)
-
ModelImport
public ModelImport(String name, boolean isConflict, IVersionRestriction restriction, boolean isInsert) Creates a model import instance.- Parameters:
name- the name of the model to be import, becomes a wildcard import ifnameends withWILDCARD_POSTFIXisConflict- does this object represent a conflict or an importrestriction- the version restriction (or null if absent)isInsert- whether model elements of the resolved model shall be (virtually) insert at the end of the importing model
-
-
Method Details
-
getName
Returns the name of the model to be imported.- Returns:
- Name of the import
-
isConflict
public boolean isConflict()Does this object represent an import or a conflict.- Returns:
truein case of a conflict,falsein case of an import
-
setRestrictions
Setter for setting the version restrictions.- Parameters:
restriction- the version restriction to this import ornullif absent.
-
getResolved
Returns the resolved model instance.- Returns:
- the resolved instance
-
isResolved
public boolean isResolved()Returns whether the related model was already resolved.- Returns:
trueif it was resolved,falseelse
-
isWildcard
public boolean isWildcard()Returns whether the import targets multiple models to be imported.- Returns:
truein case of a wildcard import,falseelse
-
isWildcard
Returns whether the given name targets multiple models to be imported.- Parameters:
name- the name of the model(s) to be imported- Returns:
truein case of a wildcard import,falseelse
-
isInsert
public boolean isInsert()Returns whether the import aims at inserting elements at the end of the importing model.- Returns:
truein case of an inserting import,falseelse
-
setResolved
Defines the resolved model instance.- Parameters:
resolved- the resolved instance or null- Throws:
ModelManagementException- in case of violated model access restrictions
-
evaluateRestrictions
public boolean evaluateRestrictions(IRestrictionEvaluationContext context, Version version) throws RestrictionEvaluationException Evaluates the restrictions againstversion.- Parameters:
context- the output context (interpreted by the respective implementation, e.g., an output visitor in order to continue with the actual indentation, may be null but then false will always be the result)version- the version to evaluate against- Returns:
trueif the restrictions are fulfilled (also if none restrictions were given),falseif the restrictions were not fulfilled- Throws:
RestrictionEvaluationException- in case of evaluation problems
-
getVersionRestriction
Returns the version restriction.- Returns:
- the version restriction (may be null)
-
copyVersionRestriction
Copies the version restriction.- Parameters:
model- the model to instantiate the copied version restriction for- Returns:
- the copied version restriction or null if no restriction was specified before
- Throws:
RestrictionEvaluationException- in case of type/structural problems
-
copy
Creates a copy of this import.- Parameters:
modelName- a new model name, may be null for the original- Returns:
- the copied instance
-