Interface IVersionRestriction
-
- All Known Implementing Classes:
ExpressionVersionRestriction,ExpressionVersionRestriction,ExpressionVersionRestriction,ExpressionVersionRestriction
public interface IVersionRestrictionDenotes a version restriction. This abstraction is needed as individual languages may implement the restrictions differently, e.g., using (different versions of) constraints, evaluation mechanisms or simplified version restriction expressions.- Author:
- Holger Eichelberger
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceIVersionRestriction.IVariableMapperMaps a variable to another while copying.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IVersionRestrictioncopy(IModel model)Copies this version restriction for the givenmodel.IVersionRestrictioncopy(IVersionRestriction.IVariableMapper mapper)Copies this version restriction for the given using the givenmapper.voidemit(java.lang.Object context)Emits the version restriction in terms of it's specification representation.booleanevaluate(IRestrictionEvaluationContext context, Version version)Evaluates the restriction.java.lang.StringtoSpecification()Turns the version restriction into it's specification representation.
-
-
-
Method Detail
-
emit
void emit(java.lang.Object context)
Emits the version restriction in terms of it's specification representation.- 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 nothing is emitted)
-
toSpecification
java.lang.String toSpecification()
Turns the version restriction into it's specification representation.- Returns:
- the specification representation
-
evaluate
boolean evaluate(IRestrictionEvaluationContext context, Version version) throws RestrictionEvaluationException
Evaluates the restriction.- 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 (of the project) to be used for evaluation- Returns:
trueif the version matches the restriction,falseelse- Throws:
RestrictionEvaluationException- in case of evaluation problems
-
copy
IVersionRestriction copy(IModel model) throws RestrictionEvaluationException
Copies this version restriction for the givenmodel.- Parameters:
model- the model to copy/instantiate this version restriction for- Returns:
- the copied version restriction (may be null if no restrictions needed to be copied)
- Throws:
RestrictionEvaluationException- in case of evaluation/type problems
-
copy
IVersionRestriction copy(IVersionRestriction.IVariableMapper mapper) throws RestrictionEvaluationException
Copies this version restriction for the given using the givenmapper.- Parameters:
mapper- the variable mapper- Returns:
- the copied version restriction (may be null if no restrictions needed to be copied)
- Throws:
RestrictionEvaluationException- in case of evaluation/type problems
-
-