java.lang.Object
de.monticore.generating.templateengine.reporting.commons.Layouter

public class Layouter extends Object
This class provides Layout functionality for the templates. It is typically provided under name "layouter" in the templates. Enables it: op.setValue("layouter", new util.Layouter()); and is set once at the beginning of the main template.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    unqualified class name
    static String
    getSpaceString(int length)
     
    static String
    Provides the Name of the Nonterminal of the AST (no qualifier, no "AST" at the beginning)
    static String
    padleft(Object o, int l)
    Performs a left padding (= fills up with spaces on right) If s is too long, it will not be shortened (no data missing)
    static String
    padright(Object o, int l)
    Performs a right padding (= fills up with spaces) If s is too long, it will not be shortened (no data missing)
    static String
    sourcePos(de.se_rwth.commons.SourcePosition sp)
    Formats the source position of an ASTnode
    static String
    Provides the Name of the Java File (no qualifier, last 2 compartments including file + extension)
    static String
    Provides the Name of the Nonterminal of the AST (no qualifier, no "AST" at the beginning)
    static String
    Provides the name of the Nonterminal of the AST (no qualifier, no "AST" at the beginning)
    static String
    derives a useful (compact) value for any object with special treatment for String, Integers, Boolean.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Layouter

      public Layouter()
  • Method Details

    • padright

      public static String padright(Object o, int l)
      Performs a right padding (= fills up with spaces) If s is too long, it will not be shortened (no data missing)
      Parameters:
      o - Object to be printed (String, Integer, etc.)
      l -
      Returns:
    • padleft

      public static String padleft(Object o, int l)
      Performs a left padding (= fills up with spaces on right) If s is too long, it will not be shortened (no data missing)
      Parameters:
      o - Object to be printed (String, Integer, etc.)
      l -
      Returns:
    • sourcePos

      public static String sourcePos(de.se_rwth.commons.SourcePosition sp)
      Formats the source position of an ASTnode
      Parameters:
      sp -
    • nodeName

      public static String nodeName(ASTNode ast)
      Provides the Name of the Nonterminal of the AST (no qualifier, no "AST" at the beginning)
      Parameters:
      ast -
      Returns:
      Nonterminalname
    • unqualName

      public static String unqualName(String s)
      Provides the Name of the Nonterminal of the AST (no qualifier, no "AST" at the beginning)
      Parameters:
      s -
      Returns:
      Nonterminalname
    • unqual2Name

      public static String unqual2Name(String s)
      Provides the Name of the Java File (no qualifier, last 2 compartments including file + extension)
      Parameters:
      s -
      Returns:
      Nonterminalname
    • className

      public static String className(Object value)
      unqualified class name
      Parameters:
      value -
      Returns:
      String
    • valueStr

      public static String valueStr(Object value)
      derives a useful (compact) value for any object with special treatment for String, Integers, Boolean. We have a length cut at 78 characters, then we use dots + [length] at endto describe incompleteness
      Parameters:
      value -
      Returns:
      String
    • unqualNamePadleft

      public static String unqualNamePadleft(String s, int l)
      Provides the name of the Nonterminal of the AST (no qualifier, no "AST" at the beginning)
      Parameters:
      s -
      l -
      Returns:
      Nonterminalname
    • getSpaceString

      public static String getSpaceString(int length)