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
-
Field Summary
Modifier and TypeFieldDescriptionprotected ExecutableBlock<Boolean>
protected ConstraintContext
protected ExecutableBlock<Boolean>
protected boolean
protected boolean
This will be set totrue
bySatisfiesOperation
.protected ExecutableBlock<String>
Fields inherited from class org.eclipse.epsilon.erl.dom.NamedRule
nameExpression
Fields inherited from class org.eclipse.epsilon.eol.dom.AnnotatableModuleElement
annotationBlock
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(IEvlVisitor visitor) boolean
appliesTo
(Object object, IEvlContext context) void
check
(Object self, IEvlContext context) boolean
execute
(IEolContext context_, Object self) protected boolean
executeCheckBlock
(Object self, IEvlContext context) getFixes()
getUnsatisfiedMessage
(Object self, IEvlContext context) Returns the message to be used in UnsatisfiedConstraint.getMessage().boolean
Checks whether this constraint's guard block has dependencies on other constraint(s).int
hashCode()
boolean
boolean
boolean
isInfo()
boolean
isLazy
(IEvlContext context) boolean
optimisedCheck
(Object self, IEvlContext context, boolean result) protected boolean
postprocessCheck
(Object self, IEvlContext context, UnsatisfiedConstraint unsatisfiedConstraint, boolean result) protected UnsatisfiedConstraint
preprocessCheck
(Object self, IEvlContext context) void
Used to flag this constraint as the target of a dependency.void
setCheckBlock
(ExecutableBlock<Boolean> checkBlock) void
setConstraintContext
(ConstraintContext constraintContext) void
setCritique
(boolean isCritique) void
setGuardBlock
(ExecutableBlock<Boolean> guardBlock) void
setMessageBlock
(ExecutableBlock<String> messageBlock) boolean
shouldBeChecked
(Object modelElement, IEvlContext context) 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 Details
-
isCritique
protected boolean isCritique -
fixes
-
constraintContext
-
guardBlock
-
checkBlock
-
messageBlock
-
isDependedOn
protected boolean isDependedOnThis will be set totrue
bySatisfiesOperation
.- Since:
- 1.6
-
-
Constructor Details
-
Constraint
public Constraint()
-
-
Method Details
-
build
- Specified by:
build
in interfaceModuleElement
- Overrides:
build
in classNamedRule
-
isInfo
public boolean isInfo() -
isLazy
- Throws:
EolRuntimeException
-
shouldBeChecked
- Throws:
EolRuntimeException
-
execute
public Optional<UnsatisfiedConstraint> execute(IEolContext context_, Object self) throws EolRuntimeException - Specified by:
execute
in interfaceIExecutableModuleElementParameter
- Throws:
EolRuntimeException
-
appliesTo
- 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
-
executeCheckBlock
- 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
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
-
setConstraintContext
-
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
-
hashCode
public int hashCode() -
equals
-
getGuardBlock
-
setGuardBlock
-
getCheckBlock
-
setCheckBlock
-
getMessageBlock
-
setMessageBlock
-
getFixes
-
accept
-