All Implemented Interfaces:
net.ssehub.easy.instantiation.core.model.vilTypes.IStringValueProvider, net.ssehub.easy.instantiation.core.model.vilTypes.IVilType, IPythonCodeElement, Storable

public class PythonCodeEnum extends PythonCodeClass
Represents a Python enum.
Author:
Holger Eichelberger
  • Constructor Details

    • PythonCodeEnum

      PythonCodeEnum(IPythonCodeElement parent, String name)
      Creates an enum.
      Parameters:
      parent - the parent code element
      name - the enum name
    • PythonCodeEnum

      PythonCodeEnum(IPythonCodeElement parent, String name, String comment)
      Creates an enum with comment.
      Parameters:
      parent - the parent code element
      name - the enum name
      comment - the comment
  • Method Details

    • init

      private void init()
      Initializes an instance.
    • addLiteral

      public PythonCodeAssign addLiteral(String name, String value)
      Adds a literal.
      Parameters:
      name - the name of the literal
      value - the (ordinal) value
      Returns:
      the literal declaration (for chaining)
    • addLiteral

      public PythonCodeAssign addLiteral(String name, String value, String comment)
      Adds a commented literal.
      Parameters:
      name - the name of the literal
      value - the (ordinal) value
      comment - the comment (may be empty or null for none)
      Returns:
      the literal declaration (for chaining)
    • addLiteralByOrdinalFunction

      public PythonCodeFunction addLiteralByOrdinalFunction(String name)
      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

      public PythonCodeFunction addLiteralByOrdinalFunction(String name, String argumentName)
      Adds a function/method that returns an enumeration literal by its ordinal.
      Parameters:
      name - the name of the function
      argumentName - the argument name for the function
      Returns:
      the function for chaining