Package org.eclipse.epsilon.evl.dom
Class Constraint
- java.lang.Object
-
- org.eclipse.epsilon.common.module.AbstractModuleElement
-
- org.eclipse.epsilon.eol.dom.AnnotatableModuleElement
-
- org.eclipse.epsilon.erl.dom.NamedRule
-
- org.eclipse.epsilon.evl.dom.Constraint
-
- All Implemented Interfaces:
ModuleElement,IExecutableModuleElementParameter
public class Constraint extends NamedRule implements IExecutableModuleElementParameter
-
-
Field Summary
Fields Modifier and Type Field Description protected ExecutableBlock<java.lang.Boolean>checkBlockprotected ConstraintContextconstraintContextprotected java.util.List<Fix>fixesprotected ExecutableBlock<java.lang.Boolean>guardBlockprotected booleanisCritiqueprotected booleanisDependedOnThis will be set totruebySatisfiesOperation.protected ExecutableBlock<java.lang.String>messageBlock-
Fields inherited from class org.eclipse.epsilon.erl.dom.NamedRule
nameExpression
-
Fields inherited from class org.eclipse.epsilon.eol.dom.AnnotatableModuleElement
annotationBlock
-
-
Constructor Summary
Constructors Constructor Description Constraint()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanappliesTo(java.lang.Object object, IEvlContext context)voidbuild(AST cst, IModule module)java.util.Optional<UnsatisfiedConstraint>check(java.lang.Object self, IEvlContext context)booleanequals(java.lang.Object other)java.util.Optional<UnsatisfiedConstraint>execute(IEolContext context_, java.lang.Object self)protected booleanexecuteCheckBlock(java.lang.Object self, IEvlContext context)ConstraintContextgetConstraintContext()java.lang.StringgetUnsatisfiedMessage(java.lang.Object self, IEvlContext context)Returns the message to be used in UnsatisfiedConstraint.getMessage().booleanguardBlockUsesSatisfies()Checks whether this constraint's guard block has dependencies on other constraint(s).inthashCode()booleanisCritique()booleanisDependedOn()booleanisInfo()booleanisLazy(IEvlContext context)booleanoptimisedCheck(java.lang.Object self, IEvlContext context, boolean result)protected booleanpostprocessCheck(java.lang.Object self, IEvlContext context, UnsatisfiedConstraint unsatisfiedConstraint, boolean result)protected UnsatisfiedConstraintpreprocessCheck(java.lang.Object self, IEvlContext context)voidsetAsDependency()Used to flag this constraint as the target of a dependency.voidsetConstraintContext(ConstraintContext constraintContext)voidsetCritique(boolean isCritique)booleanshouldBeChecked(java.lang.Object modelElement, IEvlContext context)-
Methods inherited from class org.eclipse.epsilon.erl.dom.NamedRule
getName, getNameAst, getNameExpression, setNameExpression, toString
-
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
-
-
-
-
Field Detail
-
isCritique
protected boolean isCritique
-
fixes
protected java.util.List<Fix> fixes
-
constraintContext
protected ConstraintContext constraintContext
-
guardBlock
protected ExecutableBlock<java.lang.Boolean> guardBlock
-
checkBlock
protected ExecutableBlock<java.lang.Boolean> checkBlock
-
messageBlock
protected ExecutableBlock<java.lang.String> messageBlock
-
isDependedOn
protected boolean isDependedOn
This will be set totruebySatisfiesOperation.- Since:
- 1.6
-
-
Method Detail
-
build
public void build(AST cst, IModule module)
- Specified by:
buildin interfaceModuleElement- Overrides:
buildin classNamedRule
-
isInfo
public boolean isInfo()
-
isLazy
public boolean isLazy(IEvlContext context) throws EolRuntimeException
- Throws:
EolRuntimeException
-
shouldBeChecked
public boolean shouldBeChecked(java.lang.Object modelElement, IEvlContext context) throws EolRuntimeException- Throws:
EolRuntimeException
-
execute
public java.util.Optional<UnsatisfiedConstraint> execute(IEolContext context_, java.lang.Object self) throws EolRuntimeException
- Specified by:
executein interfaceIExecutableModuleElementParameter- Throws:
EolRuntimeException
-
appliesTo
public boolean appliesTo(java.lang.Object object, IEvlContext context) throws EolRuntimeException- Throws:
EolRuntimeException
-
optimisedCheck
public boolean optimisedCheck(java.lang.Object self, IEvlContext context, boolean result) throws EolRuntimeException- Parameters:
self-context-result-- Returns:
- Throws:
EolRuntimeException- Since:
- 1.6
-
check
public java.util.Optional<UnsatisfiedConstraint> check(java.lang.Object self, IEvlContext context) throws EolRuntimeException
- Parameters:
self-context-- Returns:
- Throws:
EolRuntimeException- Since:
- 1.6
-
preprocessCheck
protected UnsatisfiedConstraint preprocessCheck(java.lang.Object self, IEvlContext context)
-
executeCheckBlock
protected boolean executeCheckBlock(java.lang.Object self, IEvlContext context) throws EolRuntimeException- Parameters:
self-context-- Returns:
- Throws:
EolRuntimeException- Since:
- 1.6
-
postprocessCheck
protected boolean postprocessCheck(java.lang.Object self, IEvlContext context, UnsatisfiedConstraint unsatisfiedConstraint, boolean result) throws EolRuntimeException- Throws:
EolRuntimeException
-
getUnsatisfiedMessage
public java.lang.String getUnsatisfiedMessage(java.lang.Object self, IEvlContext context) throws EolRuntimeExceptionReturns the message to be used in UnsatisfiedConstraint.getMessage().- Parameters:
self- The model element.context- The execution context.- Returns:
- The message if this Constraint's check block returns false.
- Throws:
EolRuntimeException- Since:
- 1.6
-
guardBlockUsesSatisfies
public boolean guardBlockUsesSatisfies()
Checks whether this constraint's guard block has dependencies on other constraint(s).- Returns:
trueif the guard block exists and has a satisfies call.- Since:
- 1.6
-
getConstraintContext
public ConstraintContext getConstraintContext()
-
setConstraintContext
public void setConstraintContext(ConstraintContext constraintContext)
-
isCritique
public boolean isCritique()
-
setCritique
public void setCritique(boolean isCritique)
-
isDependedOn
public boolean isDependedOn()
- Returns:
- Whether this constraint is the target of a dependency.
- Since:
- 1.6
-
setAsDependency
public void setAsDependency()
Used to flag this constraint as the target of a dependency.- Since:
- 1.6
-
-