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 EolModelElementType
protected TypeExpression
Fields inherited from class org.eclipse.epsilon.eol.dom.AnnotatableModuleElement
annotationBlock
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(IEvlVisitor visitor) final boolean
appliesTo
(Object object, IEvlContext context) boolean
appliesTo
(Object object, IEvlContext context, boolean checkType) void
boolean
boolean
execute
(Object modelElement, IEvlContext context) Executes all of this ConstraintContext's constraints for the given element.boolean
execute
(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.void
execute
(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) int
hashCode()
boolean
isLazy
(IEvlContext context) An entire context is lazy if all constraints are lazy, or if it is itself marked as lazy.boolean
isOfSourceKind
(Object modelElement, IEvlContext context) Checks if the given model element is an instance of the kind described by this ConstraintContext.boolean
isOfSourceType
(Object modelElement, IEvlContext context) Checks if the given model element is an instance of the type described by this ConstraintContext.void
setGuardBlock
(ExecutableBlock<Boolean> guardBlock) boolean
shouldBeChecked
(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, setAnnotationBlock
Methods inherited from class org.eclipse.epsilon.common.module.AbstractModuleElement
getChildren, getComments, getData, getDebugInfo, getFile, getModule, getParent, getRegion, getUri, setModule, setParent, setRegion, setUri
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods 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:
build
in interfaceModuleElement
- Overrides:
build
in 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:
true
if 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:
true
if 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:
execute
in interfaceIExecutableModuleElementParameter
- Parameters:
context_
- The EVL execution context.- Returns:
- nothing.
- Throws:
EolRuntimeException
- Since:
- 1.6
-
execute
- Specified by:
execute
in interfaceIExecutableModuleElement
- Throws:
EolRuntimeException
- Since:
- 1.6
-
toString
- Overrides:
toString
in classAbstractModuleElement
-
hashCode
public int hashCode()- Overrides:
hashCode
in classAbstractModuleElement
- Since:
- 1.6
-
equals
- Overrides:
equals
in classAbstractModuleElement
- Since:
- 1.6
-
accept
-
getGuardBlock
-
setGuardBlock
-