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
Fields Modifier and Type Field Description protected java.util.ArrayList<Constraint>constraintsprotected ExecutableBlock<java.lang.Boolean>guardBlockprotected EolModelElementTypetypeprotected TypeExpressiontypeExpression-
Fields inherited from class org.eclipse.epsilon.eol.dom.AnnotatableModuleElement
annotationBlock
-
-
Constructor Summary
Constructors Constructor Description ConstraintContext()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanappliesTo(java.lang.Object object, IEvlContext context)booleanappliesTo(java.lang.Object object, IEvlContext context, boolean checkType)voidbuild(AST cst, IModule module)booleanequals(java.lang.Object other)booleanexecute(java.lang.Object modelElement, IEvlContext context)Executes all of this ConstraintContext's constraints for the given element.booleanexecute(java.util.Collection<Constraint> constraintsToCheck, java.lang.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(java.util.Collection<Constraint> constraintsToCheck, IEvlContext context)Executes all of the give constraints for all applicable elements of this type.java.lang.Objectexecute(IEolContext context)java.lang.Objectexecute(IEolContext context_, java.lang.Object self)java.util.Collection<?>getAllOfSourceKind(IEolContext context)java.util.Collection<?>getAllOfSourceType(IEolContext context)java.util.List<Constraint>getConstraints()EolModelElementTypegetType(IEolContext context)TypeExpressiongetTypeExpression()java.lang.StringgetTypeName()inthashCode()booleanisLazy(IEvlContext context)An entire context is lazy if all constraints are lazy, or if it is itself marked as lazy.booleanisOfSourceKind(java.lang.Object modelElement, IEvlContext context)Checks if the given model element is an instance of the kind described by this ConstraintContext.booleanisOfSourceType(java.lang.Object modelElement, IEvlContext context)Checks if the given model element is an instance of the type described by this ConstraintContext.voidsetTypeExpression(TypeExpression typeExpression)booleanshouldBeChecked(java.lang.Object modelElement, IEvlContext context)java.lang.StringtoString()-
Methods inherited from class org.eclipse.epsilon.eol.dom.AnnotatableModuleElement
getAnnotation, getAnnotationBlock, getAnnotations, getAnnotationsValues, getBooleanAnnotationValue, getBooleanAnnotationValue, getBooleanAnnotationValue, getBooleanAnnotationValue, hasAnnotation, setAnnotationBlock
-
Methods inherited from class org.eclipse.epsilon.common.module.AbstractModuleElement
getChildren, getComments, 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, getFile, getModule, getParent, getRegion, getUri, setModule, setParent, setRegion, setUri
-
-
-
-
Field Detail
-
constraints
protected final java.util.ArrayList<Constraint> constraints
-
typeExpression
protected TypeExpression typeExpression
-
guardBlock
protected ExecutableBlock<java.lang.Boolean> guardBlock
-
type
protected EolModelElementType type
-
-
Method Detail
-
build
public void build(AST cst, IModule module)
- Specified by:
buildin interfaceModuleElement- Overrides:
buildin classAnnotatableModuleElement
-
shouldBeChecked
public boolean shouldBeChecked(java.lang.Object modelElement, IEvlContext context) throws EolRuntimeException- Parameters:
modelElement-context-- Returns:
- Throws:
EolRuntimeException- Since:
- 1.6
-
isOfSourceType
public boolean isOfSourceType(java.lang.Object modelElement, IEvlContext context) throws EolRuntimeExceptionChecks 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
public boolean isOfSourceKind(java.lang.Object modelElement, IEvlContext context) throws EolRuntimeExceptionChecks 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
public final boolean appliesTo(java.lang.Object object, IEvlContext context) throws EolRuntimeException- Throws:
EolRuntimeException
-
appliesTo
public boolean appliesTo(java.lang.Object object, IEvlContext context, boolean checkType) throws EolRuntimeException- Throws:
EolRuntimeException
-
isLazy
public boolean isLazy(IEvlContext context) throws EolRuntimeException
An entire context is lazy if all constraints are lazy, or if it is itself marked as lazy.- Throws:
EolRuntimeException
-
getTypeName
public java.lang.String getTypeName()
-
getConstraints
public java.util.List<Constraint> getConstraints()
-
getTypeExpression
public TypeExpression getTypeExpression()
-
setTypeExpression
public void setTypeExpression(TypeExpression typeExpression)
-
getAllOfSourceType
public java.util.Collection<?> getAllOfSourceType(IEolContext context) throws EolModelElementTypeNotFoundException, EolModelNotFoundException
-
getAllOfSourceKind
public java.util.Collection<?> getAllOfSourceKind(IEolContext context) throws EolModelElementTypeNotFoundException, EolModelNotFoundException
-
getType
public EolModelElementType getType(IEolContext context) throws EolModelNotFoundException, EolModelElementTypeNotFoundException
-
execute
public boolean execute(java.util.Collection<Constraint> constraintsToCheck, java.lang.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(java.util.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
public boolean execute(java.lang.Object modelElement, IEvlContext context) throws EolRuntimeExceptionExecutes 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
public java.lang.Object execute(IEolContext context_, java.lang.Object self) throws EolRuntimeException
- Specified by:
executein interfaceIExecutableModuleElementParameter- Parameters:
context_- The EVL execution context.- Returns:
- nothing.
- Throws:
EolRuntimeException- Since:
- 1.6
-
execute
public java.lang.Object execute(IEolContext context) throws EolRuntimeException
- Specified by:
executein interfaceIExecutableModuleElement- Throws:
EolRuntimeException- Since:
- 1.6
-
toString
public java.lang.String toString()
- Overrides:
toStringin classAbstractModuleElement
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAbstractModuleElement- Since:
- 1.6
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classAbstractModuleElement- Since:
- 1.6
-
-