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>
checkBlock
protected ConstraintContext
constraintContext
protected java.util.List<Fix>
fixes
protected ExecutableBlock<java.lang.Boolean>
guardBlock
protected boolean
isCritique
protected boolean
isDependedOn
This will be set totrue
bySatisfiesOperation
.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 boolean
appliesTo(java.lang.Object object, IEvlContext context)
void
build(AST cst, IModule module)
java.util.Optional<UnsatisfiedConstraint>
check(java.lang.Object self, IEvlContext context)
boolean
equals(java.lang.Object other)
java.util.Optional<UnsatisfiedConstraint>
execute(IEolContext context_, java.lang.Object self)
protected boolean
executeCheckBlock(java.lang.Object self, IEvlContext context)
ConstraintContext
getConstraintContext()
java.lang.String
getUnsatisfiedMessage(java.lang.Object self, IEvlContext context)
Returns the message to be used in UnsatisfiedConstraint.getMessage().boolean
guardBlockUsesSatisfies()
Checks whether this constraint's guard block has dependencies on other constraint(s).int
hashCode()
boolean
isCritique()
boolean
isDependedOn()
boolean
isInfo()
boolean
isLazy(IEvlContext context)
boolean
optimisedCheck(java.lang.Object self, IEvlContext context, boolean result)
protected boolean
postprocessCheck(java.lang.Object self, IEvlContext context, UnsatisfiedConstraint unsatisfiedConstraint, boolean result)
protected UnsatisfiedConstraint
preprocessCheck(java.lang.Object self, IEvlContext context)
void
setAsDependency()
Used to flag this constraint as the target of a dependency.void
setConstraintContext(ConstraintContext constraintContext)
void
setCritique(boolean isCritique)
boolean
shouldBeChecked(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
-
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
-
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 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(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:
execute
in 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 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
-
-