Class ConstraintSplitWriter
java.lang.Object
net.ssehub.easy.varModel.model.AbstractVisitor
net.ssehub.easy.varModel.persistency.AbstractVarModelWriter
net.ssehub.easy.varModel.persistency.IVMLWriter
net.ssehub.easy.varModel.persistency.ConstraintSplitWriter
- All Implemented Interfaces:
IConstraintTreeVisitor,ICustomDatatypeVisitor,IModelVisitor,IValueVisitor
Splits the textual output at a given
constraint. This writer is useful
for embedded constraint editors.- Author:
- Holger Eichelberger
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceIdentifies the constraint where to split at.static classAn identity constraint filter.Nested classes/interfaces inherited from class net.ssehub.easy.varModel.persistency.IVMLWriter
IVMLWriter.EmitFilterNested classes/interfaces inherited from class net.ssehub.easy.varModel.persistency.AbstractVarModelWriter
AbstractVarModelWriter.DefaultSpace -
Field Summary
FieldsFields inherited from class net.ssehub.easy.varModel.persistency.AbstractVarModelWriter
DUMMY_PARENT -
Constructor Summary
ConstructorsConstructorDescriptionCreates a split writer for the given writer and splits atconstraint. -
Method Summary
Modifier and TypeMethodDescriptionprivate static booleandoTrim(char ch) Returns whetherchshall be trimmed.protected voidemitConstraintExpression(IModelElement context, ConstraintSyntaxTree constraint) Visits the expression of a constraint (for extension).protected voidemitDecisionVariableDeclarationDefault(DecisionVariableDeclaration decl, ConstraintSyntaxTree defaultValue) Emits the default value of a decision variable declaration (for extension).Returns the textual model representation after the constraint.Returns the textual model representation before the constraint.Returns the textual model representation of the constraint.String[]getSplit(boolean trimConstraint, boolean trimParenthesis) Returns the split as needed for embedding xText editors.private voidpost(boolean split) To be called after a potential split point (checking the filter).private booleanpre(IModelElement context, ConstraintSyntaxTree constraint) To be called before a potential split point (checking the filter).Methods inherited from class net.ssehub.easy.varModel.persistency.IVMLWriter
appendOCLFeatureCall, beforeNestedElement, emitComments, endWritingCompound, endWritingProject, forceComponundTypes, getInstance, printDefaultSpace, processVersion, releaseInstance, setEmitFilter, setEmitProjectFreezeDot, setFormatInitializer, startWritingCompound, startWritingProject, visitAnnotationVariable, visitAttribute, visitAttributeAssignment, visitBlockExpression, visitBooleanValue, visitComment, visitComment, visitCompound, visitCompoundAccess, visitCompoundAccessStatement, visitCompoundInitializer, visitCompoundValue, visitConstraint, visitContainerInitializer, visitContainerOperationCall, visitContainerValue, visitDecisionVariableDeclaration, visitDeferInitExpression, visitDerivedDatatype, visitEnum, visitEnumLiteral, visitEnumValue, visitFreezeBlock, visitIfThen, visitIntValue, visitLet, visitMetaTypeValue, visitMultiAndExpression, visitNullValue, visitOclFeatureCall, visitOperationDefinition, visitParenthesis, visitPartialEvaluationBlock, visitProject, visitProjectImport, visitProjectInterface, visitRealValue, visitReference, visitReferenceValue, visitSelf, visitSequence, visitSet, visitStringValue, visitVariable, visitVersionValue, writeValueMethods inherited from class net.ssehub.easy.varModel.persistency.AbstractVarModelWriter
addParent, appendIndentation, appendOutput, appendOutput, considerOclCompliance, decreaseAdditionalIndentation, flush, getExpressionContext, getIndentation, getIvmlIndentStep, getLogger, getParent, getParent, getParent, getParentCount, getUseIvmlWhitespace, getWriter, increaseAdditionalIndentation, removeLastParent, setExpressionContext, setIndentationStep, setIndentStep, setOclCompliance, setUseIvmlWhitespace, setUseWhitespaces, setWriter, visitConstantValue, visitConstraintValue, visitOrderedEnum, visitUnresolvedExpression
-
Field Details
-
before
-
constraint
-
after
-
filter
-
-
Constructor Details
-
ConstraintSplitWriter
Creates a split writer for the given writer and splits atconstraint.- Parameters:
filter- the constraint filter identifying the split point
-
-
Method Details
-
pre
To be called before a potential split point (checking the filter).- Parameters:
context- the enclosing model elementconstraint- the constraint to check- Returns:
trueif a split shall happen,falseelse
-
post
private void post(boolean split) To be called after a potential split point (checking the filter).- Parameters:
split- the output of the correspondingprecall
-
emitConstraintExpression
Description copied from class:AbstractVarModelWriterVisits the expression of a constraint (for extension).- Overrides:
emitConstraintExpressionin classAbstractVarModelWriter- Parameters:
context- the visiting contextconstraint- the (specified) constraint;
-
emitDecisionVariableDeclarationDefault
protected void emitDecisionVariableDeclarationDefault(DecisionVariableDeclaration decl, ConstraintSyntaxTree defaultValue) Description copied from class:IVMLWriterEmits the default value of a decision variable declaration (for extension).- Overrides:
emitDecisionVariableDeclarationDefaultin classIVMLWriter- Parameters:
decl- the declarationdefaultValue- the specified default value
-
getBeforeText
Returns the textual model representation before the constraint.- Returns:
- the textual model representation before the constraint
-
getConstraintText
Returns the textual model representation of the constraint.- Returns:
- the textual model representation of the constraint
-
getAfterText
Returns the textual model representation after the constraint.- Returns:
- the textual model representation after the constraint
-
getSplit
Returns the split as needed for embedding xText editors.- Parameters:
trimConstraint- trim the constraint from leading/trailing whitespacestrimParenthesis- trims the constraint from a leading/trailing parenthesis moving them to prefix/suffix- Returns:
- an array consisting of the values of
getBeforeText(),getConstraintText()andgetAfterText()
-
doTrim
private static boolean doTrim(char ch) Returns whetherchshall be trimmed.- Parameters:
ch- the character to check- Returns:
trueifchshall be trimmed,falseelse
-