Class PythonCodeEnum
java.lang.Object
net.ssehub.easy.instantiation.python.codeArtifacts.PythonCodeElement
net.ssehub.easy.instantiation.python.codeArtifacts.PythonCodeClass
net.ssehub.easy.instantiation.python.codeArtifacts.PythonCodeEnum
- All Implemented Interfaces:
net.ssehub.easy.instantiation.core.model.vilTypes.IStringValueProvider,net.ssehub.easy.instantiation.core.model.vilTypes.IVilType,IPythonCodeElement,Storable
Represents a Python enum.
- Author:
- Holger Eichelberger
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classRepresents an enum literal with comment.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
Fields inherited from interface net.ssehub.easy.instantiation.python.codeArtifacts.IPythonCodeElement
KEY_COMPARATOR -
Constructor Summary
ConstructorsConstructorDescriptionPythonCodeEnum(IPythonCodeElement parent, String name) Creates an enum.PythonCodeEnum(IPythonCodeElement parent, String name, String comment) Creates an enum with comment. -
Method Summary
Modifier and TypeMethodDescriptionaddLiteral(String name, String value) Adds a literal.addLiteral(String name, String value, String comment) Adds a commented literal.Adds a function/method that returns an enumeration literal by its ordinal.addLiteralByOrdinalFunction(String name, String argumentName) Adds a function/method that returns an enumeration literal by its ordinal.private voidinit()Initializes an instance.Methods inherited from class net.ssehub.easy.instantiation.python.codeArtifacts.PythonCodeClass
add, add, addAttribute, addAttribute, addBase, addBase, addClass, addComment, addConstructor, addConstructor, addEmptyLine, addGetter, addGetter, addMethod, addMethod, addSetter, addSetter, addSLComment, addSLComment, getName, getParentCodeClass, isClass, moveToAttributes, setParent, store, storeElementsMethods 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, isAttribute, isBlock, isEmptyLine, moveToImportsMethods inherited from interface net.ssehub.easy.instantiation.python.codeArtifacts.Storable
getElementCount, toCode
-
Constructor Details
-
PythonCodeEnum
PythonCodeEnum(IPythonCodeElement parent, String name) Creates an enum.- Parameters:
parent- the parent code elementname- the enum name
-
PythonCodeEnum
PythonCodeEnum(IPythonCodeElement parent, String name, String comment) Creates an enum with comment.- Parameters:
parent- the parent code elementname- the enum namecomment- the comment
-
-
Method Details
-
init
private void init()Initializes an instance. -
addLiteral
Adds a literal.- Parameters:
name- the name of the literalvalue- the (ordinal) value- Returns:
- the literal declaration (for chaining)
-
addLiteral
Adds a commented literal.- Parameters:
name- the name of the literalvalue- the (ordinal) valuecomment- the comment (may be empty or null for none)- Returns:
- the literal declaration (for chaining)
-
addLiteralByOrdinalFunction
Adds a function/method that returns an enumeration literal by its ordinal.- Parameters:
name- the name of the function- Returns:
- the function for chaining
-
addLiteralByOrdinalFunction
Adds a function/method that returns an enumeration literal by its ordinal.- Parameters:
name- the name of the functionargumentName- the argument name for the function- Returns:
- the function for chaining
-