Interface IPythonCodeElement

All Superinterfaces:
net.ssehub.easy.instantiation.core.model.vilTypes.IStringValueProvider, net.ssehub.easy.instantiation.core.model.vilTypes.IVilType, Storable
All Known Subinterfaces:
IPythonCodeImport
All Known Implementing Classes:
PythonCodeAlternative, PythonCodeAssert, PythonCodeAssign, PythonCodeBlock, PythonCodeClass, PythonCodeConstructorCall, PythonCodeDecorator, PythonCodeDecoratorArg, PythonCodeDelete, PythonCodeDocComment, PythonCodeElement, PythonCodeEnum, PythonCodeEnum.PythonCodeEnumLiteral, PythonCodeExpr, PythonCodeFnCall, PythonCodeFnCall.NamedArgument, PythonCodeForLoop, PythonCodeFunction, PythonCodeGlobal, PythonCodeImport, PythonCodeLambdaExpr, PythonCodeMatch, PythonCodeMatch.PythonCodeCase, PythonCodeNonLocal, PythonCodeParamSpec, PythonCodeRaise, PythonCodeSingleLineComment, PythonCodeStmt, PythonCodeText, PythonCodeTryBlock, PythonCodeTryBlock.PythonCodeExceptBlock, PythonCodeTypeAlias, PythonCodeTypeSpec, PythonCodeWhileLoop, PythonCodeWith, PythonCodeWith.PythonCodeWithItem

public interface IPythonCodeElement extends net.ssehub.easy.instantiation.core.model.vilTypes.IVilType, net.ssehub.easy.instantiation.core.model.vilTypes.IStringValueProvider, Storable
Declares a generic Python code element.
Author:
Kevin Schaperjahn
  • Field Details

  • Method Details

    • getArtifact

      IPythonCodeArtifact getArtifact()
    • getTopClass

      default IPythonCodeElement getTopClass()
    • getParent

      IPythonCodeElement getParent()
    • setParent

      void setParent(IPythonCodeElement parent)
    • addAll

      default void addAll(List<IPythonCodeElement> list)
    • hasPythondocComment

      default boolean hasPythondocComment()
    • getSortKey

      default String getSortKey()
    • isAttribute

      default boolean isAttribute()
      Returns whether this element is a (class) property/attribute.
      Returns:
      true for attribute, false else
    • isClass

      default boolean isClass()
      Returns whether this element is a class(-like) element.
      Returns:
      true for class, false else
    • isBlock

      default boolean isBlock()
      Returns whether this element is a block element.
      Returns:
      true for block, false else
    • isEmptyLine

      default boolean isEmptyLine()
      Returns whether this element is an empty line.
      Returns:
      true for empty line, false else
    • getTracerStringValue

      default String getTracerStringValue(net.ssehub.easy.instantiation.core.model.vilTypes.IStringValueProvider.StringComparator comparator)
    • getStringValue

      default String getStringValue(net.ssehub.easy.instantiation.core.model.vilTypes.IStringValueProvider.StringComparator comparator)
      Specified by:
      getStringValue in interface net.ssehub.easy.instantiation.core.model.vilTypes.IStringValueProvider
    • add

      static <L, E extends L> E add(List<L> list, E element)
    • add

      static <L, E extends L> E add(List<L> list, E element, int pos)
    • appendWhitespace

      static String appendWhitespace(String text)
    • appendSeparator

      static String appendSeparator(String text, String separator)
    • storeList

      static void storeList(List<? extends IPythonCodeElement> elements, String separator, net.ssehub.easy.instantiation.core.model.templateModel.CodeWriter out)
    • storeList

      static void storeList(String prefix, List<? extends IPythonCodeElement> elements, String separator, net.ssehub.easy.instantiation.core.model.templateModel.CodeWriter out)
    • toList

      static String toList(List<String> elements, String separator)
    • setParent

      static <T extends IPythonCodeElement> void setParent(IPythonCodeElement parent, Class<T> cls, Consumer<T> setter)
    • getFormattingArgument

      static <T extends Enum<T>> T getFormattingArgument(Class<T> cls, String key, T dflt)
    • sort

      static void sort(List<IPythonCodeElement> list, Comparator<IPythonCodeElement> comparator)
    • moveTo

      static void moveTo(List<IPythonCodeElement> elts, IPythonCodeElement elt, Class<?> cls)
      Moves elt after the last instance of cls. If there is no such instance, move elt to the front.
      Parameters:
      elts - the elements to manipulate
      elt - the element to move/insert
      cls - the class to look for
    • moveTo

      static void moveTo(List<IPythonCodeElement> elts, IPythonCodeElement elt, Predicate<IPythonCodeElement> cond)
      Moves elt after the last acceptance of cond. If there is no such acceptance, move elt to the front.
      Parameters:
      elts - the elements to manipulate
      elt - the element to move/insert
      cond - the condition
    • moveToAttributes

      default void moveToAttributes(IPythonCodeElement element)
      Moves the given code element after the last attribute at the beginning of (this) class, or, if there are no attributes, to the front.
      Parameters:
      element - the element to move
    • moveToImports

      default void moveToImports(IPythonCodeImport imp)
      Moves the given import after the last import at the beginning of (this) artifact, or, if there are no imports, to the front.
      Parameters:
      imp - the import to move