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<Boolean>
checkBlock
protected ConstraintContext
constraintContext
protected List<Fix>
fixes
protected ExecutableBlock<Boolean>
guardBlock
protected boolean
isCritique
protected boolean
isDependedOn
This will be set totrue
bySatisfiesOperation
.protected ExecutableBlock<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
-
Methods inherited from class org.eclipse.epsilon.erl.dom.NamedRule
getName, getNameAst, getNameExpression, 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 Detail
-
isCritique
protected boolean isCritique
-
constraintContext
protected ConstraintContext constraintContext
-
guardBlock
protected ExecutableBlock<Boolean> guardBlock
-
checkBlock
protected ExecutableBlock<Boolean> checkBlock
-
messageBlock
protected ExecutableBlock<String> messageBlock
-
isDependedOn
protected boolean isDependedOn
This will be set totrue
bySatisfiesOperation
.- Since:
- 1.6
-
-
Method Detail
-
build
public void build(AST cst, IModule module)
- Specified by:
build
in interfaceModuleElement
- Overrides:
build
in classNamedRule
-
isInfo
public boolean isInfo()
-
isLazy
public boolean isLazy(IEvlContext context) throws EolRuntimeException
- Throws:
EolRuntimeException
-
shouldBeChecked
public boolean shouldBeChecked(Object modelElement, IEvlContext context) throws EolRuntimeException
- Throws:
EolRuntimeException
-
execute
public Optional<UnsatisfiedConstraint> execute(IEolContext context_, Object self) throws EolRuntimeException
- Specified by:
execute
in interfaceIExecutableModuleElementParameter
- Throws:
EolRuntimeException
-
appliesTo
public boolean appliesTo(Object object, IEvlContext context) throws EolRuntimeException
- Throws:
EolRuntimeException
-
optimisedCheck
public boolean optimisedCheck(Object self, IEvlContext context, boolean result) throws EolRuntimeException
- Parameters:
self
-context
-result
-- Returns:
- Throws:
EolRuntimeException
- Since:
- 1.6
-
check
public Optional<UnsatisfiedConstraint> check(Object self, IEvlContext context) throws EolRuntimeException
- Parameters:
self
-context
-- Returns:
- Throws:
EolRuntimeException
- Since:
- 1.6
-
preprocessCheck
protected UnsatisfiedConstraint preprocessCheck(Object self, IEvlContext context)
-
executeCheckBlock
protected boolean executeCheckBlock(Object self, IEvlContext context) throws EolRuntimeException
- Parameters:
self
-context
-- Returns:
- Throws:
EolRuntimeException
- Since:
- 1.6
-
postprocessCheck
protected boolean postprocessCheck(Object self, IEvlContext context, UnsatisfiedConstraint unsatisfiedConstraint, boolean result) throws EolRuntimeException
- Throws:
EolRuntimeException
-
getUnsatisfiedMessage
public String getUnsatisfiedMessage(Object self, IEvlContext context) throws EolRuntimeException
Returns 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:
true
if 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
-
getGuardBlock
public ExecutableBlock<Boolean> getGuardBlock()
-
setGuardBlock
public void setGuardBlock(ExecutableBlock<Boolean> guardBlock)
-
getCheckBlock
public ExecutableBlock<Boolean> getCheckBlock()
-
setCheckBlock
public void setCheckBlock(ExecutableBlock<Boolean> checkBlock)
-
getMessageBlock
public ExecutableBlock<String> getMessageBlock()
-
setMessageBlock
public void setMessageBlock(ExecutableBlock<String> messageBlock)
-
accept
public void accept(IEvlVisitor visitor)
-
-