Package org.eclipse.epsilon.evl.dom
Class ConstraintContext
java.lang.Object
org.eclipse.epsilon.common.module.AbstractModuleElement
org.eclipse.epsilon.eol.dom.AnnotatableModuleElement
org.eclipse.epsilon.evl.dom.ConstraintContext
- All Implemented Interfaces:
ModuleElement,IExecutableModuleElement,IExecutableModuleElementParameter
- Direct Known Subclasses:
GlobalConstraintContext
public class ConstraintContext
extends AnnotatableModuleElement
implements IExecutableModuleElement, IExecutableModuleElementParameter
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ArrayList<Constraint>protected ExecutableBlock<Boolean>protected EolModelElementTypeprotected TypeExpressionFields inherited from class org.eclipse.epsilon.eol.dom.AnnotatableModuleElement
annotationBlock -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(IEvlVisitor visitor) final booleanappliesTo(Object object, IEvlContext context) booleanappliesTo(Object object, IEvlContext context, boolean checkType) voidbooleanbooleanexecute(Object modelElement, IEvlContext context) Executes all of this ConstraintContext's constraints for the given element.booleanexecute(Collection<Constraint> constraintsToCheck, Object modelElement, IEvlContext context) Executes all constraints for the given model element, provided it is applicable to this ConstraintContext and that this ConstraintContext is not lazy.voidexecute(Collection<Constraint> constraintsToCheck, IEvlContext context) Executes all of the give constraints for all applicable elements of this type.execute(IEolContext context) execute(IEolContext context_, Object self) Collection<?>getAllOfSourceKind(IEolContext context) Collection<?>getAllOfSourceType(IEolContext context) getType(IEolContext context) inthashCode()booleanisLazy(IEvlContext context) An entire context is lazy if all constraints are lazy, or if it is itself marked as lazy.booleanisOfSourceKind(Object modelElement, IEvlContext context) Checks if the given model element is an instance of the kind described by this ConstraintContext.booleanisOfSourceType(Object modelElement, IEvlContext context) Checks if the given model element is an instance of the type described by this ConstraintContext.voidsetGuardBlock(ExecutableBlock<Boolean> guardBlock) booleanshouldBeChecked(Object modelElement, IEvlContext context) toString()Methods inherited from class org.eclipse.epsilon.eol.dom.AnnotatableModuleElement
accept, getAnnotation, getAnnotationBlock, getAnnotations, getAnnotationsValues, getBooleanAnnotationValue, getBooleanAnnotationValue, getBooleanAnnotationValue, getBooleanAnnotationValue, hasAnnotation, setAnnotationBlockMethods inherited from class org.eclipse.epsilon.common.module.AbstractModuleElement
getChildren, getComments, getData, getDebugInfo, getFile, getModule, getParent, getRegion, getUri, setModule, setParent, setRegion, setUriMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.epsilon.common.module.ModuleElement
getChildren, getComments, getData, getFile, getModule, getParent, getRegion, getUri, setModule, setParent, setRegion, setUri
-
Field Details
-
constraints
-
typeExpression
-
guardBlock
-
type
-
-
Constructor Details
-
ConstraintContext
public ConstraintContext()
-
-
Method Details
-
build
- Specified by:
buildin interfaceModuleElement- Overrides:
buildin classAnnotatableModuleElement
-
shouldBeChecked
- Parameters:
modelElement-context-- Returns:
- Throws:
EolRuntimeException- Since:
- 1.6
-
isOfSourceType
Checks if the given model element is an instance of the type described by this ConstraintContext.- Parameters:
modelElement- The model element.context- The execution context containing the model(s).- Returns:
trueif the object's type is equal to this ConstraintContext's type.- Throws:
EolRuntimeException- Since:
- 1.6
-
isOfSourceKind
Checks if the given model element is an instance of the kind described by this ConstraintContext.- Parameters:
modelElement- The model element.context- The execution context containing the model(s).- Returns:
trueif the model element is compatible with this ConstraintContext.- Throws:
EolRuntimeException- Since:
- 1.6
-
appliesTo
- Throws:
EolRuntimeException
-
appliesTo
public boolean appliesTo(Object object, IEvlContext context, boolean checkType) throws EolRuntimeException - Throws:
EolRuntimeException
-
isLazy
An entire context is lazy if all constraints are lazy, or if it is itself marked as lazy.- Throws:
EolRuntimeException
-
getTypeName
-
getConstraints
-
getTypeExpression
-
getAllOfSourceType
public Collection<?> getAllOfSourceType(IEolContext context) throws EolModelElementTypeNotFoundException, EolModelNotFoundException -
getAllOfSourceKind
public Collection<?> getAllOfSourceKind(IEolContext context) throws EolModelElementTypeNotFoundException, EolModelNotFoundException -
getType
public EolModelElementType getType(IEolContext context) throws EolModelNotFoundException, EolModelElementTypeNotFoundException -
execute
public boolean execute(Collection<Constraint> constraintsToCheck, Object modelElement, IEvlContext context) throws EolRuntimeException Executes all constraints for the given model element, provided it is applicable to this ConstraintContext and that this ConstraintContext is not lazy.- Parameters:
constraintsToCheck- The constraints, which may be a subset of this ConstraintContext's children.modelElement- The model element object.context- The execution context.- Returns:
- Whether the constraints were checked.
- Throws:
EolRuntimeException- Since:
- 1.6
-
execute
public void execute(Collection<Constraint> constraintsToCheck, IEvlContext context) throws EolRuntimeException Executes all of the give constraints for all applicable elements of this type.- Parameters:
constraintsToCheck- The Constraints, which may be a subset of this ConstraintContext's children.context- The execution context.- Throws:
EolRuntimeException- Since:
- 1.6
-
execute
Executes all of this ConstraintContext's constraints for the given element.- Parameters:
modelElement- The model element object.context- The execution context.- Throws:
EolRuntimeException- Since:
- 1.6
-
execute
- Specified by:
executein interfaceIExecutableModuleElementParameter- Parameters:
context_- The EVL execution context.- Returns:
- nothing.
- Throws:
EolRuntimeException- Since:
- 1.6
-
execute
- Specified by:
executein interfaceIExecutableModuleElement- Throws:
EolRuntimeException- Since:
- 1.6
-
toString
- Overrides:
toStringin classAbstractModuleElement
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractModuleElement- Since:
- 1.6
-
equals
- Overrides:
equalsin classAbstractModuleElement- Since:
- 1.6
-
accept
-
getGuardBlock
-
setGuardBlock
-