Class PythonCodeAssign
java.lang.Object
net.ssehub.easy.instantiation.python.codeArtifacts.PythonCodeElement
net.ssehub.easy.instantiation.python.codeArtifacts.PythonCodeStmt
net.ssehub.easy.instantiation.python.codeArtifacts.PythonCodeAssign
- All Implemented Interfaces:
net.ssehub.easy.instantiation.core.model.vilTypes.IStringValueProvider,net.ssehub.easy.instantiation.core.model.vilTypes.IVilType,IPythonCodeElement,Storable
- Direct Known Subclasses:
PythonCodeEnum.PythonCodeEnumLiteral
Represents a Python value assign in VTL.
- Author:
- Kevin Schaperjahn
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.ssehub.easy.instantiation.core.model.vilTypes.IStringValueProvider
net.ssehub.easy.instantiation.core.model.vilTypes.IStringValueProvider.StringComparator -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate PythonCodeFnCallprivate Stringprivate PythonCodeTypeSpecprivate StringFields inherited from interface net.ssehub.easy.instantiation.python.codeArtifacts.IPythonCodeElement
KEY_COMPARATOR -
Constructor Summary
ConstructorsConstructorDescriptionPythonCodeAssign(IPythonCodeElement parent, String varName, String expr) Creates an assignment statement.PythonCodeAssign(IPythonCodeElement parent, String varName, String type, String expr) Creates an assignment statement. -
Method Summary
Modifier and TypeMethodDescriptionaddCall(String fnName, PythonCodeImportScope scope) addConstructorCall(String cls) booleanReturns whether this element is a (class) property/attribute.voidstore(net.ssehub.easy.instantiation.core.model.templateModel.CodeWriter out) Moves this assignment to the attributes at the beginning of the containing class if there is a containing class.toAttributes(boolean apply) Moves this assignment conditionally to the attributes at the beginning of the containing class if there is a containing class.Methods inherited from class net.ssehub.easy.instantiation.python.codeArtifacts.PythonCodeElement
getArtifact, getParent, setParentMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.ssehub.easy.instantiation.python.codeArtifacts.IPythonCodeElement
addAll, getSortKey, getStringValue, getTopClass, getTracerStringValue, hasPythondocComment, isBlock, isClass, isEmptyLine, moveToAttributes, moveToImportsMethods inherited from interface net.ssehub.easy.instantiation.python.codeArtifacts.Storable
getElementCount, toCode
-
Field Details
-
varName
-
type
-
expr
-
call
-
-
Constructor Details
-
PythonCodeAssign
Creates an assignment statement.- Parameters:
parent- the parentvarName- the variable nameexpr- the value expression
-
PythonCodeAssign
Creates an assignment statement.- Parameters:
parent- the parentvarName- the variable nametype- the type (for annotation)expr- the value expression
-
-
Method Details
-
toAttributes
Moves this assignment to the attributes at the beginning of the containing class if there is a containing class. By default, the assignment occurs wherever it is added.- Returns:
- this for chaining
-
toAttributes
Moves this assignment conditionally to the attributes at the beginning of the containing class if there is a containing class. By default, the assignment occurs wherever it is added.- Parameters:
apply- whether this attribute shall be moved- Returns:
- this for chaining
-
addCall
-
addCall
-
addConstructorCall
-
store
public void store(net.ssehub.easy.instantiation.core.model.templateModel.CodeWriter out) -
isAttribute
public boolean isAttribute()Description copied from interface:IPythonCodeElementReturns whether this element is a (class) property/attribute.- Returns:
truefor attribute,falseelse
-